Get child categories in Magento


/ Published in: PHP
Save to your folder(s)

One approach to get all child categories of a magento category.


Copy this code and paste it in your HTML
  1. <?php
  2.  
  3. $category_model = Mage::getModel('catalog/category'); //get category model
  4. $_category = $category_model->load($categoryid); //$categoryid for which the child categories to be found
  5. $all_child_categories = $category_model->getResource()->getAllChildren($_category); //array consisting of all child categories id
  6.  
  7. ?>

URL: http://blog.decryptweb.com/child-categories-magento/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.