Thứ Ba, 4 tháng 1, 2011

How to get sub category list of a particular category in magento

To get all subcategory list under a particular category you need to know the category id of that particular id, then you can get the subcategory .In the below example I have taken My category id is 69.



<?php

$category = Mage::getModel('catalog/category')->getCategories(69);

foreach($category as $_category){

$currentCat = Mage::getModel('catalog/category')->load($_category->getId());

?>

<li><a href="<?php echo $currentCat->getUrl()?>"><?php echo $currentCat->getName();?></a></li>

<?php

}


?>

Không có nhận xét nào:

Đăng nhận xét