Category Listing in Magento : Category listing is very common and useful for all the magento information .Many time magento developers needs this information . So here i’ll explain to get all the categories and subcategories in magento.Open the phtml file of the magento (where you want the listing ) and add the following code
$MainCat = Mage::getModel(‘catalog/category’)->load(3)->getChildren();
$cats=explode(“,”,$MainCat);
foreach($cats as $opt)
{
$catname=Mage::getModel(‘catalog/category’)->load($opt);
?>
<?php echo $catname->getName();?>
<?php
}
Be the first to comment.