Fatal error: Call to undefined method Mage_Catalog_Model_Resource_Category_Flat_Collection::joinUrlRewrite() in app/code/local/Mage/Catalog/Block/Navigation.php on line 213
This error is coming after upgrade magento to 1.9 CE.
public function getCurrentChildCategories($sort_by = 'position', $sort_order = 'asc')
{
$layer = Mage::getSingleton('catalog/layer');
$category = $layer->getCurrentCategory();
$collection = Mage::getModel('catalog/category')->getCollection();
$collection->addAttributeToSelect('url_key')
->addAttributeToSelect('name')
->addAttributeToSelect('image')
->addAttributeToSelect('is_anchor')
->addAttributeToFilter('is_active', 1)
->addAttributeToSort($sort_by, $sort_order)
->addIdFilter($category->getChildren())
->joinUrlRewrite()
->load();
$productCollection = Mage::getResourceModel('catalog/product_collection');
$layer->prepareProductCollection($productCollection);
$productCollection->addCountToCategories($collection);
return $collection;
}
change "->joinUrlRewrite()" to "->addUrlRewriteToResult()".
Then it will work fine!!!!!!!!!!!!!!
This error is coming after upgrade magento to 1.9 CE.
public function getCurrentChildCategories($sort_by = 'position', $sort_order = 'asc')
{
$layer = Mage::getSingleton('catalog/layer');
$category = $layer->getCurrentCategory();
$collection = Mage::getModel('catalog/category')->getCollection();
$collection->addAttributeToSelect('url_key')
->addAttributeToSelect('name')
->addAttributeToSelect('image')
->addAttributeToSelect('is_anchor')
->addAttributeToFilter('is_active', 1)
->addAttributeToSort($sort_by, $sort_order)
->addIdFilter($category->getChildren())
->joinUrlRewrite()
->load();
$productCollection = Mage::getResourceModel('catalog/product_collection');
$layer->prepareProductCollection($productCollection);
$productCollection->addCountToCategories($collection);
return $collection;
}
change "->joinUrlRewrite()" to "->addUrlRewriteToResult()".
Then it will work fine!!!!!!!!!!!!!!
No comments:
Post a Comment
Thanks for your comments.