I have enabled "Use Flat Catalog Category" & "Use Flat Catalog Product" to "yes" for getting better performance. But after enabling this options one of my previous cms page on which I was getting a list of all subcategories is not working anymore.
The code using which I was getting sub-categories before enabling flat data is:
$_category = Mage::getModel('catalog/category')->load(CATEGORY-ID);
$_categories = $_category->getCollection()->addAttributeToSelect(array('url_key','name','image','all_children','is_anchor','description'))
->addAttributeToFilter('is_active', 1)
->addIdFilter($_category->getChildren())
->setOrder('position', 'ASC')
->joinUrlRewrite();
Note: I have checked that, both of my flat data tables have been successfully populated. This code still works if I change the "Use Flat Catalog Category" option to "No".
Now, what should be the code to get a list of category along with its subcategories where as it may pull data from "catalog_category_flat_store_*" table?
Best Answer
Here I got this code working