DecryptWeb Blog

Opensource Web Solutions

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. This will not count the disabled subcategories, do you have any trick for that?

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

  3. 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

Comments are closed.

Scroll to top