How to get a category listing from Magento?

后端 未结 8 2079
野性不改
野性不改 2021-01-31 22:33

I want to create a page in Magento that shows a visual representation of the categories.. example

CATEGORY
 product 1
 product 2

ANOTHER CATEGORY
 product 3
         


        
8条回答
  •  星月不相逢
    2021-01-31 23:18

    Here's a quick example

    $categories = Mage::getModel('catalog/category')->getCollection()  
        ->addAttributeToSelect('name')
        ->addAttributeToSelect('url_key')
        ->addAttributeToSelect('my_attribute')
        ->setLoadProductCount(true)
        ->addAttributeToFilter('is_active',array('eq'=>true))
        ->load();
    

提交回复
热议问题