Add manufacturers name to a category listing
I want to add the manufacturers name to a category listing. Found this thread, http://www.magentocommerce.com/boards/viewthread/1610/P15/#t42109 but I can´t get it to work.
In the catalog.xml I have added
<action method="addAttribute"><attribute>manufacturer</attribute></action>
after
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
in both section
<catalog_category_default translate="label">
and
<catalog_category_layered translate="label">
In 开发者_JS百科my list.phtml I have tried
echo $_product->getAttributeText('manufacturer');
which gave an empty result and
echo $_product->getResource()->getAttribute('manufacturer')->getFrontend()->getValue($_product);
which gave the result "No"
I´m running version 1.5.1.0
1) Simply put the required to "YES" via the magento backoffice
2) Reindex
3) It will work (either $_product->getManufacturer(), $_product->getdata("manufacturer") or echo $_product->getAttributeText('manufacturer')
)
Regards, Kenny
You need to set Used in Product Listing to Yes for the 'manufacturer' attribute and the code will work just fine.
精彩评论