• By Pushpendra Singh
  • August 3, 2011
  • Magento
How to get sub category list for specific category in magento

Below is the code to get sub categories list from specific category in magento. For example, if we make a category by name “brand” (fro example id is 35) and we want to show all the subcategory list as select dropdown. So we can use below code :

<select id="select-manufacturer" style="font-size: 11px;" onchange="window.location.href=this.value">
<option selected="selected" value="#">----Select Brand----</option>
<?php $_category = $this->getCurrentCategory();
$collection = Mage::getModel('catalog/category')->getCategories(35);
$helper = Mage::helper('catalog/category');
?>
<?php foreach ($collection as $cat):?>
<?php if($_category-&gt;getIsActive()):?>
<?php $cur_category = Mage::getModel('catalog/category')->load($cat-&gt;getId());
$_img = $cur_category->getImageUrl();
?>
<option value="<?php echo $helper->getCategoryUrl($cat);?>">
<?php echo $cat->getName();?>
</option>
<?php endif?>
<?php endforeach;?>

</select>