In my website I have a default menu which always shows in the header part. Now I want to add another root category which will show up in a specific page(not all pages). I already created a new root category from magento admin but don't know how to show only this category in frontend. point that my new category id is '12' I tried

      $category = Mage::getModel('catalog/category'); 
      $ids = $tree->getCollection()->getAllIds(); 
      $arr = array();
      if ($ids){ 
    foreach ($ids as $id){ 
     $cat = Mage::getModel('catalog/category'); 
  $cat_id = Mage::app()->getStore()->getRootCategoryId(); 
$collection = Mage::getModel('catalog/category')->getCategories($cat_id,12, true, true);
foreach($collection as $key=>$cat) {
echo '<ul class="jetmenu blue">';
foreach($index as $index_new){
foreach($collection as $cat){
    if( $index_new==$cat->getPosition())
    echo '<li><a href="'.$cat->getURL().'" />'.$cat->getName().'</a>';
    echo $subcategory_html;
    echo '</li>'; 

but this only shows the default category, not the other category.

2 Answers 2


You can pass your category id in and based on that you got all category details. if you want to get sub category then same process but you have to pass $cat->getId() which we will get from the for loop.

$category = Mage::getModel('catalog/category')->load($categoryId);
$coll = $category->getResourceCollection();
$result = '';
foreach ($coll as $cat) {
  echo $cat->getName().'/'. $cat->getId();

hope you got the solutions.


To display the root category with all categories underneath it.


  $root_category = Mage::getModel('catalog/category')->load(12); // Put your root category ID here.
  $subcategories = $root_category->getChildren();
  foreach(explode(',',$subcategories) as $subcategory) {
        $category = Mage::getModel('catalog/category')->load($subcategory);
        echo '<a href="'.$category->getURL() .'" />'.$category->getName().'</a><br/>';


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.