A bit of a simple one, I just want to load a category collection and for it to include disabled categories either on their own or along with the enabled categories.

It seems that the standard collection call has an automatic 'active' filter on it:


If anyone's done this before it would be a great help!

3 Answers 3


I had the same problem as you:

I was passing the following into the addIdFilter:


Internally, getChildren() as well as getAllChildren() use Mage_Catalog_Model_Resource_Category::getChildren() which explicitly joins the is_active attribute and returns ids of active children only.

But the resource model also has a getChildrenIds() method which does not add this join. Also it conveniently returns a comma separated list by default.



$categoryCollection->addIdFilter(explode(',', $parentCategory->getChildren()));



I'd expect the following to give you what you need:

$categories = Mage::getModel('catalog/category')
    ->addFieldToFilter('is_active',array("in"=>array('0', '1')))
    ->addAttributeToSelect('*'); // optional
  • No, it brings back active and inactive categories. just tested it, and it works fine. Jun 11, 2014 at 19:00

I realised I was being an idiot!

I was passing the following into the addIdFilter:


Instead of:


My final code is now this:

$category = Mage::getModel('catalog/category')->load($id);
    $categories = $category->getCollection()
    ->addAttributeToSelect(array('name', 'thumbnail', 'description'))
  • Seems a little backward to get the collection, and then filter by all the IDs that are available anyway. What if you wanted to use the addIdFilter to filter down certain categories, but required active and inactive categories to be returned? Jun 11, 2014 at 19:02
  • I'm wondering why this worked for you, getAllChildren() calls getChildren() and only adds the id of the category itself. You probably changed something else as well Aug 30, 2016 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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