Get child categories in Magento

Hello All,

I am writing here a script for getting 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

?>

Hope this is useful

11 thoughts on “Get child categories in Magento

  1. Hello… is it possible to arrange the child categories according to its order in the admin panel? Thank you so much! 🙂

  2. Didn’t get the code properly. I want to display all categories and all their subcategories to the end level. Can you provide some help?

    Regards,

    Nisha

Leave a Reply to SimoneFreelance Cancel reply

Your email address will not be published. Required fields are marked *

Scroll to top