How to get sub categories by parent category id in Magento?
You can try below code for display all sub category of one particular category by category id.
<?php
$category_id = 13; // you can change category id according to you
$parentCat = Mage::getModel('catalog/category')->load($category_id);
$subCat = explode(',',$parentCat ->getChildren());
$collection = $parentCat
->getCollection()
->addAttributeToSelect("*")
->addFieldToFilter("entity_id", array("in", $subCat) );
foreach($collection as $catname)
{
echo $catname->getName();
}
?>
I like this kind of posts which includes more informations. This post is one of them. Thank you for this kind of posts, keep updating.
ReplyDeletebuy neelambri sapphire online
This post is so informative and pretty well maintained. Thanks for sharing this post, and keep updating.
ReplyDeletecoenzyme q10 capsules
Really good to know about the magento, thanks for it.
ReplyDeleteumbilical hernia treatment in delhi