Take the 2-minute tour ×
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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
}
share|improve this answer
    
It also doesn't return the category which isn't not showing in menu @marius –  DRAJI May 5 at 8:29
1  
@DRAJI. hmmm...it should. Make sure your indexes are up to date. –  Marius May 5 at 8:34
    
Sorry this also "$collection = Mage::getResourceModel('catalog/category_collection')" doesn't return those categories –  DRAJI May 5 at 9:55
    
@DRAJI. Then It might be something wrong with your category tree. Corrupted data maybe. Some values for path field might be wrong. Or parent ids may be wrong. –  Marius May 5 at 10:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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