How to get sub category list for specific category in magento

How to get sub category list for specific category in magento

August 3, 2011 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>

Related Posts

from my blog


How To Reset Admin Password in Magento

January 20, 2017

As an ecommerce website developer or magento website developer, sometime we  get the a situation when we forget the magento website admin access detail. To reset the password of any...

How to show all attribute after layered navigation filter in Magento

April 10, 2015

Magento Layered Navigation is really good for filter the product but problem is that, if we select any attribute like color or price all other attribute hide which are not...

How to fix layered navigation filer URL in Magento?

April 2, 2015

Magento is really good eCommerce CMS in terms of functionality. Layered Navigation is really good feature of Magento to filter the product in frontend side. Only problem with the layered navigation filter...