Got Magento Error – Call To Undefined Method Mage_Catalog_Model_Resource_Category_Flat_Collection::getAllIdsSql()

I got following error in error.log. How to fix it? Call to undefined method Mage_Catalog_Model_Resource_Category_Flat_Collection::getAllIdsSql() in app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php

It is a Magento bug.

When flat tables was disabled, Mage::getModel(‘catalog/category’)->getCollection() will return a Mage_Catalog_Model_Resource_Category_Collection object, which extends from Mage_Eav_Model_Entity_Collection_Abstract which has the getAllIdsSql() method.

However, if flat tables are enabled the collection will be a Mage_Catalog_Model_Resource_Category_Flat_Collection which does not inherit the getAllIdsSql() method, resulting in the error you’re seeing.

To fix this issue, just find out the following file


and find the line

change to

0 0 vote
Article Rating
Notify of
Inline Feedbacks
View all comments