How to get Sub-categories of Any Category in Magento?

Get Sub Categories of Categories in Magento: You can get the desired result for displaying all the sub-categories of a particular categories by using the below code accordingly whether it is current one or root.


<?php 

$catID = $current_category->getId(); //or any specific category id, e.g. 9

$cloth= Mage::getModel('catalog/category')->getCategories($catID);

foreach ($cloth as $category)

{

echo $category->getId();

echo $category->getName();

echo $category->getRequestPath();

print_r($category->getData());

}

?>

To display all the sub-categories of any specific category assign category id in $categoryID to get the desired result.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *