0

This was already asked in this thread but didn't get a correct response.

I also did the two answers in the previous thread.

I need Mage::helper('catalog/category'); to display all categories, not just those that have "Include in Navigation Menu" checked.

2
  • Try Mage::getModel('catalog/category')->getCollection()
    – Kenny
    Jul 23, 2014 at 8:25
  • Like the previous thread. I also need to use Mage::helper because using what you said returns nothing. Jul 23, 2014 at 8:29

3 Answers 3

1

I also need to use Mage::helper because using what you said returns nothing

You need to use Mage::helper, because this returns nothing? This argument is wrong :-)

Get a collection of the categories, filter them if you want:

$categories = Mage::getResourceModel('catalog/category');
foreach($categories as $cat) {
    echo $cat->getName();
}

If this return nothing, please tell me, what you are doing.

2
  • To be honest. I'm not sure why. All I know is that Mage::helper('catalog/category')->getStoreCategories() only returns those that are included in the menu. Are there any function other than getStoreCategories() that gets all? Jul 23, 2014 at 8:44
  • yes, a generic collection without any filter, like the one I wrote in the answer. and KennyDs already mentioned ;) Jul 23, 2014 at 9:39
1

try Mage::getResourceModel('catalog/category_collection')

0
$helper = Mage::helper('catalog/category');

// sorted by name, fetched as collection
$categoriesCollection = $helper->getStoreCategories('name', true, false);

// sorted by name, fetched as array
$categoriesArray = $helper->getStoreCategories('name', false, false);

Via model:

 $_categories = Mage::getModel('catalog/category')->getCollection()->addAttributeToSelect('*');
2

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.