0

This question already has an answer here:

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.

Thanks

marked as duplicate by TBI Infotech, Marius, David Manners, Moose, Mufaddal Jun 27 '14 at 11:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

To display categories if you there is product assigned, you need to hide categories which don't have product items.

You can do it by rewriting some of the core files. One of my friend has wrote an article about you. You can read it from there. The link of the article is Hide Categories without product

Not the answer you're looking for? Browse other questions tagged or ask your own question.