Friday, April 20, 2012

Get child categories in Magento

to get all the child categories of the required category id



<?php    

    $category_model = Mage::getModel('catalog/category'); //get category model

    $_category = $category_model->load($categoryid); //$categoryid for which the child categories to be found        

   $all_child_categories = $category_model->getResource()->getAllChildren($_category); //array consisting of all child categories id

?>

No comments:

Post a Comment

Fatal error: Class Zend\Stdlib\Parameters contains 1 abstract method... magento 2

Fatal error: Class Zend\Stdlib\Parameters contains 1 abstract method and must therefore be declared abstract or implement the remaining met...