Pages

Monday, July 8, 2013

Magento display brand image on product

Hey as many of the user wants to have this feature and for this just us the following method first thing is to  get the data for brand
we can have the data for product bran using the php code

$brand=$_product->getAttributeText('manufacturer'); // here manufacture is attribute code for brand

Now you have to get path for brand image to do this locate path to your brand images

$filename= '/var/www/vhosts/***path to folder***/media/catalog/brands/'.str_replace(' ', '_',$brand).'.gif';

Now just print the brand image at desired location
echo '<a href="/'.str_replace(' ', '_',$brand).'"><img style="float: right; margin: 2px;" src="/media/catalog/brands/'.str_replace(' ', '_',$brand).'.gif" alt="'.$brand.'"></a>'

No comments:

Post a Comment