Pergunta

I've added the brand logo in the product view phtml file like this:

<div>
<?php $brand=$_product->getAttributeText('brand');
echo '<img src="media/catalog/brand/'.str_replace(' ', '_',$brand).'.png" alt="'.$brand.'">' ?>
</div>

It returns the correct url, for example for "acme" brand the resulting url is:

media/catalog/brand/acme.png

I tried to add the same code in the catalog/product/list.phtml file, but the link is broken and the generate url is:

media/catalog/brand/.png

So it seems like the brand attribute is not extracted. What's wrong?

Foi útil?

Solução

Make sure you set the value for 'Use in product listing' to 'Yes' on the attribute 'brand'.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top