How to get a category listing from Magento?

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

    I adapted this from Paul Whipp's website:

    SELECT e.entity_id AS 'entity_id', vn.value AS 'name'   
    FROM catalog_category_entity e  
    LEFT JOIN catalog_category_entity_varchar vn  
    ON e.entity_id = vn.entity_id AND vn.attribute_id = 33 
    ORDER BY entity_id;
    

    This will provide you with the catalog category IDs.

    0 讨论(0)
  • 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()."<br/>";
    
    }
    
    0 讨论(0)
提交回复
热议问题