B-219 Sec-55 Noida, India
+918010221733

Fetch Subcategory of a category in magento in select box dropdown

<select name=”” style=”width:220px;” onchange=”location.href=this.value”>
  <?php $children  = Mage::getModel(‘catalog/category’)->getCategories(YOUR_CAT_ID); ?>

 <?php foreach ($children as $category) {  $i++;
 $cat = Mage::getModel(‘catalog/category’)->load($category->getID()); ?>
  <option value=”<?php echo $cat->geturl(); ?>”  <? if(Mage::registry(‘current_category’)->getId()==$category->getID()) echo ‘selected’;?>><?php echo $category->getName(); ?></option>
 <?php } ?>

 </select>

(Visited 57 times, 1 visits today)

Leave a reply

You must be logged in to post a comment.