How to get a category listing from Magento?

后端 未结 8 2085
野性不改
野性不改 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:36

    Hey something like this might help you, I've adapted it slightly to answer your question more specifically.

     $h3h3=Mage::getModel('catalog/category')->load(5);  // YOU NEED TO CHANGE 5 TO THE ID OF YOUR CATEGORY
    
    
    $h3h3=$h3h3->getProductCollection();
    
    
    foreach($h3h3->getAllIds() as $lol)
    {
        $_product=Mage::getModel('catalog/product')->load($lol);
    
        print $_product->getName()."
    "; }

提交回复
热议问题