How to get sub-categories of a specific parent category?

atif picture atif · Mar 8, 2011 · Viewed 66.4k times · Source

I had a main category (parent category) whose id = 10. I want to echo just its sub-categories. How can I do that?

Answer

clockworkgeek picture clockworkgeek · Mar 8, 2011
$children = Mage::getModel('catalog/category')->getCategories(10);
foreach ($children as $category) {
    echo $category->getName();
}