我们刚刚将我们的网站从Magento 1.9.1.1升级到Magento 1.9.3.3。Magento1.9.3.3可配置产品色板bug
不幸的是,我们的网站坏了,所以我调查了这个问题。 错误通知如下。
Fatal error: Uncaught Error: Call to undefined method
Mage_ConfigurableSwatches_Helper_Mediafallback :: attachProductChildrenAttributeMapping()在 /var/www/html/source/app/code/core/Mage/ConfigurableSwatches/Model/Observer.php:59堆栈跟踪:#0/var/www/html/source/app/code/core/Mage/Core/Model/App.php(1358):Mage_ConfigurableSwatches_Model_Observer-productListCollectionLoadAfter(Object(Varien_Event_Observer))#1/var/www/html/source/app/code /core/Mage/Core/Model/App.php(1337):Mage_Core_Model_App-_callObserverMethod(Object(Mage_ConfigurableSwatches_Model_Observer),'productListColl ...',Object(Varien_Event_Observer))#2/var/www/html/source/app/Mage.php(448):Mage_Core_Model_App-dispatchEvent('catalog_block_p ...',Array)#3 /var/www/html/source/app/code/core/Mage/Catalog/Block/Product/List.php(160):Mage :: dispatchEvent('catalog_block_p ...' ,Array)#4 /var/www/html/source/app/code/core/Mage/Core/Block/Abstract.php(922):Mage_Catalog_Block_Product_Li /var/www/html/source/app/code/core /Mage/ConfigurableSwatches/Model/Observer.php on line 59
该代码块如下。
public function productListCollectionLoadAfter(Varien_Event_Observer $observer)
{
if (!Mage::helper('configurableswatches')->isEnabled()) { // check if functionality disabled
return; // exit without loading swatch functionality
}
/* @var $mediaHelper Mage_ConfigurableSwatches_Helper_Mediafallback */
$mediaHelper = Mage::helper('configurableswatches/mediafallback');
/** @var $priceHelper Mage_ConfigurableSwatches_Helper_List_Price */
$priceHelper = Mage::helper('configurableswatches/list_price');
/* @var $collection Mage_Catalog_Model_Resource_Product_Collection */
$collection = $observer->getCollection();
if ($collection
instanceof Mage_ConfigurableSwatches_Model_Resource_Catalog_Product_Type_Configurable_Product_Collection) {
// avoid recursion
return;
}
$products = $collection->getItems();
$mediaHelper->attachChildrenProducts($products, $collection->getStoreId());
$mediaHelper->attachProductChildrenAttributeMapping($products, $collection->getStoreId());
if ($priceHelper->isEnabled()) {
$priceHelper->attachConfigurableProductChildrenPricesMapping($products, $collection->getStoreId());
}
$mediaHelper->attachGallerySetToCollection($products, $collection->getStoreId());
/* @var $product Mage_Catalog_Model_Product */
foreach ($products as $product) {
$mediaHelper->groupMediaGalleryImages($product);
Mage::helper('configurableswatches/productimg')
->indexProductImages($product, $product->getListSwatchAttrValues());
}
}
旧块(Magento1.9.1.0)是遵循。
public function productListCollectionLoadAfter(Varien_Event_Observer $observer)
{
if (!Mage::helper('configurableswatches')->isEnabled()) { // check if functionality disabled
return; // exit without loading swatch functionality
}
/* @var $helper Mage_ConfigurableSwatches_Helper_Mediafallback */
$helper = Mage::helper('configurableswatches/mediafallback');
/* @var $collection Mage_Catalog_Model_Resource_Product_Collection */
$collection = $observer->getCollection();
if ($collection
instanceof Mage_ConfigurableSwatches_Model_Resource_Catalog_Product_Type_Configurable_Product_Collection) {
// avoid recursion
return;
}
$products = $collection->getItems();
$helper->attachChildrenProducts($products, $collection->getStoreId());
$helper->attachConfigurableProductChildrenAttributeMapping($products, $collection->getStoreId());
$helper->attachGallerySetToCollection($products, $collection->getStoreId());
/* @var $product Mage_Catalog_Model_Product */
foreach ($products as $product) {
$helper->groupMediaGalleryImages($product);
Mage::helper('configurableswatches/productimg')
->indexProductImages($product, $product->getListSwatchAttrValues());
}
}
要修复的部位折断的问题,我禁用了颜色样本设置在系统/目录/配置色板/常规设置。
然后,我们的网站被检索到。但是,当然,色板功能不再适用。
为了确保这个问题是否是核心问题,我在本地服务器上安装了原始的Magento 1.9.3.3。但是,同样的问题。
有没有解决方法?
对不起,没了。发生同样的错误。有什么想法吗? –
最近我们在色板上也遇到了同样的问题,我们添加了product_options.js并解决了我的问题。 – hardik
请检查上面的JS是否包含在您的项目中? – hardik