-1

I have category pages and within those are sub-category pages. Those sub-category pages have a sidebar displaying the filterable options within that subcategory. I want to echo out the name of the parent category at the top of that sidebar. I'll need to do this for each parent category.

closed as unclear what you're asking by sv3n, Siarhey Uchukhlebau, Prince Patel, liyakat, brentwpeterson Aug 13 '17 at 15:12

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1

Try below

$allCategoryIds = ALL_YOUR_CATEGORIES_AS_ARRAY;
foreach($allCategoryIds as $categoryId){
    $_category = Mage::getModel('catalog/category')->load($categoryId);    
    echo $categoryName = $_category->getName()."<br />";  
}
  • That works but i'll need this to work for more than one category. Sorry, I should've mentioned that in the question. – totneschap Aug 10 '17 at 12:52
  • You can loop through all your category ids and then can get names for each category. check updated answer @totneschap – Yogesh Trivedi Aug 10 '17 at 12:56

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