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”
Comments are closed.
This will not count the disabled subcategories, do you have any trick for that?
Please check this post of mine, Category Tree Magento I have the added the condition explicitly
Hello… is it possible to arrange the child categories according to its order in the admin panel? Thank you so much! 🙂
Can you please elaborate your requirement ?, not able to get you
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
@Nisha – Please check this post of mine Category Tree Magento
Nice one! Thanks!
Thank you very much! It helped me a lot to filter categories where i wanna print an Ad!
thanks a lot!
@fox – u r welcome
thanks !