1

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?

1 Answer 1

2

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

1
  • Thank you!! How could I have missed that???
    – TopperH
    Commented Mar 15, 2013 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.