Reputation: 55
Since a few days I am getting the following error on every page, where the product collection should be loaded:
Call to a member function setStoreId() on a non-object in /app/code/core/Mage/Catalog/Model/Category.php on line 287
This is the function, where the error occurs:
public function getProductCollection()
{
$collection = Mage::getResourceModel('catalog/product_collection')
->setStoreId($this->getStoreId())
->addCategoryFilter($this);
return $collection;
}
I don't know what happened. I have tried to re-index everything and refreshed the cache, but I'm still getting this error.
Upvotes: 0
Views: 83
Reputation: 864
Override /app/code/core/Mage/Catalog/Model/Category.php
and try this code may help you
public function getProductCollection()
{
$model->setStoreId(Mage::app()->getStore(true)->getId());
$collection = Mage::getResourceModel('catalog/product_collection')
->setStoreId($this->getStoreId())
->addCategoryFilter($this);
return $collection;
}
Upvotes: 0