This question already has an answer here:
- Hide empty categories in Magento 4 answers
I only want to display the categories in Navigation Menu which has product associated with it. Categories without products shouldn't be displayed. I have tried below code but it doesn't work. Any help will be appreciated
$_storeId = Mage::app()->getStore()->getId(); $_rootCatId = 7; $_rootCategory = Mage::getModel('catalog/category')->load($_rootCatId); $collection = $_rootCategory->getChildrenCategories($_storeId);
I have checked $collection->ProdcutCount() > 0. But its not working.