由于几天,我在每个应该加载产品集合的页面上都得到以下错误:
在非对象中调用成员函数setStoreId()/app/code/core/Mage/Catalog/Model/Category.php on line 287
这是错误发生的函数:
public function getProductCollection()
{
$collection = Mage::getResourceModel('catalog/product_collection')
->setStoreId($this->getStoreId())
->addCategoryFilter($this);
return $collection;
}
我不知道发生了什么事。我已经尝试重新索引所有内容并刷新缓存,但我仍然得到这个错误。
Override /app/code/core/Mage/Catalog/Model/Category.php
和尝试这个代码可能会帮助你
public function getProductCollection()
{
$model->setStoreId(Mage::app()->getStore(true)->getId());
$collection = Mage::getResourceModel('catalog/product_collection')
->setStoreId($this->getStoreId())
->addCategoryFilter($this);
return $collection;
}