I want all parent category name using category Id

  • Main Category
    • Sub Category 1
      • Sub Category 3
      • Sub Category 4
    • Sub Category 2
      • Sub Category 5
      • Sub Category 6

Now I have id of this category Sub Category 6 Now, i want this two name Sub Category 2,Main Category in frontend.
 How to get all parent category name?

1 Answers

You can find parent category name by following method:-
$category = Mage::getModel(‘catalog/category’)->load($categoryId());

$names = array(); foreach ($category->getParentCategories() as $parent) {

$names[] = $parent->getName();


//here you will find `$names` in array

Please login or Register to submit your answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.