Tuesday, 18 February 2014

How to get all category in magento


<?php $category_model = Mage::getModel('catalog/category')->load($categoryid);
       $all_child_categories = $category_model->getResource()->getAllChildren($category_model );
   
 foreach ($all_child_categories as $child_id){
}

//===============OR=====================

$categories = Mage::getModel('catalog/category')->getCollection()->addAttributeToSelect('*')->addIsActiveFilter();
     foreach($categories as $ubcat){
 
 
   $catId=$ubcat->getId();
 
     }
     ?>

No comments:

Post a Comment