Magento – How to get list of all subcategories which are set “Include in Navigation Menu” as no

categorymenunavigation

I have tried to get all sub categories which are not include in navigation menu but those are being active, of current category in list page.

$children = Mage::getModel('catalog/category')->getCategories(10); //10 current category id

Even this category collection also return only subcategories which are include in navigation menu.

How to get category which isn't include in navigation menu?

Best Answer

Try this:

$collection = Mage::getResourceModel('catalog/category_collection')
    ->addAttributeToSelect('*')
    ->addAttributeToFilter('is_active', 1) //only active categories
    ->addAttributeToFilter('include_in_menu', 0) //only categories not included in menu
    ->addAttributeToFilter('parent_id', 10)//get only subcategories of the category with id 10
    ->addAttributeToSort('position')//sort by position
;

foreach ($collection as $category) {
    //do something with $category
}