Tuesday, 1 December 2015

Get list of main Category on listing page by default category ID in Magento

Get list of main Category on product listing page by passing default category ID
************************************************************************
<?php
$parentCategoryId = 2;
$children = Mage::getModel('catalog/category')->getCategories($parentCategoryId);
foreach ($children as $category) { ?>
   <li><a href="<?php echo $category->getURL(); ?>"><?php echo $category->getName(); ?></a></li>
    <?php
}

?>
************************************************************************

No comments:

Post a Comment