get all categories in magento


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



Copy this code and paste it in your HTML
  1. private function getCategories() {
  2. $categories = Mage::getModel('catalog/category')
  3. ->getCollection()
  4. ->addAttributeToSelect('*')
  5. ->addIsActiveFilter();
  6.  
  7. $all = array();
  8.  
  9. foreach ($categories as $c) {
  10. $all[$c->getId()] = $c->getName();
  11. }
  12.  
  13. return $all;
  14. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.