Magento – Display Product Attribute on Products Grid/List View

attributesgrid layoutlayoutproductproduct-list

I try to show Product-Attributes on the Grid-View (catalog(products/list.phtml).

At app/code/coreMage/Catalog/Block/Product/List.php I found this

public function addAttribute($code)
{
    $this->_getProductCollection()->addAttributeToSelect($code);
    return $this;
}

At my catalog.xml (theme/layout/catalog.xml) I add the following "addAttribute in my block

    <catalog_category_default translate="label">
    <label>Catalog Category (Non-Anchor)</label>
    <reference name="left">
        <block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>
    </reference>
    <reference name="content">
        <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
            <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">

                <action method="addAttribute"><attribute>Manufacturer</attribute></action>

At my PHTML-Template, I try to show the Manufacturer like this:

<?php echo $_product->getAttributeText('manufacturer') ?>

But it doesen't work. I don't know why. I found the tutorial via Google and I'm sure that I 've done it right. I work with Magento Enterprise 1.13. Where is my fault? Thanks for your help.

Best Answer

You don need all that xml markup to add an attribute to the product grid. Just edit the attribute in the backend, set the field Used in Product Listing to Yes, reindex everything and you should be able to use in catalog/product/list.phtml this:

<?php echo $_product->getAttributeText('manufacturer') ?>
Related Topic