Showing posts with label Get sub-category in Magento. Show all posts
Showing posts with label Get sub-category in Magento. Show all posts

Friday, 5 February 2016

How to get sub-category by category id in Magento


How to get sub-category by category id in Magento

Try to use below code for subcategories in magento

$subcategoryCollection = Mage::getModel('catalog/category')
 ->getCollection()
 ->addAttributeToFilter('parent_id', 35);
foreach($subcategoryCollection as $_subcategoryCollection)
 {
  $categoryId = $_subcategoryCollection->getEntityId();
  $categoryName = Mage::getModel('catalog/category')->load($categoryId);
  $categoryName->getName();
 }