Skip to main content
added 51 characters in body
Source Link
Keyul Shah
  • 7.2k
  • 13
  • 38
  • 60
<?php
    $categoryId = 10 ;  // get current category id
    $category = Mage::getModel('catalog/category')->load($categoryId) ;
    $catList = explode(",", $category->getChildren();) ;
    foreach{$catList as $cat} 
    {
       $subcategory = Mage::getSingleton('catalog/category')->load($cat) ;
       echo $subcategory->getName() ; 
    }
?>

It will display the second level. ifIf you want to display further levels, put this code in recursive.

$categoryId = 10 ;  // get current category id
$category = Mage::getModel('catalog/category')->load($categoryId) ;
$catList = explode(",", $category->getChildren();) ;
foreach{$catList as $cat} 
{
   $subcategory = Mage::getSingleton('catalog/category')->load($cat) ;
   echo $subcategory->getName() ; 
}

It will display the second level. if you want to display further levels, put this code in recursive.

<?php
    $categoryId = 10 ;  // get current category id
    $category = Mage::getModel('catalog/category')->load($categoryId) ;
    $catList = explode(",", $category->getChildren();) ;
    foreach{$catList as $cat} 
    {
       $subcategory = Mage::getSingleton('catalog/category')->load($cat) ;
       echo $subcategory->getName() ; 
    }
?>

It will display the second level. If you want to display further levels, put this code in recursive.

Source Link
alamelu
  • 446
  • 3
  • 14

$categoryId = 10 ;  // get current category id
$category = Mage::getModel('catalog/category')->load($categoryId) ;
$catList = explode(",", $category->getChildren();) ;
foreach{$catList as $cat} 
{
   $subcategory = Mage::getSingleton('catalog/category')->load($cat) ;
   echo $subcategory->getName() ; 
}

It will display the second level. if you want to display further levels, put this code in recursive.