Showing posts with label display brand logo using brand name. Show all posts
Showing posts with label display brand logo using brand name. Show all posts

Thursday, September 16, 2010

Display Brand Logo (attribute) of a product depending on the Brand Name



<!-- ##### CODE TO SET THE BRAND LOGO USING BRAND NAME ##### -->
<div class="product-brand-logo">
<?php $brandname = $_product->getbrand_name() ?>
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . "brandlogo/" .$brandname . ".png"; ?>" />
</div>

I just fetched the brand name and put it inside a variable and then fetched the image using Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)

reference:
http://www.magentocommerce.com/boards/viewthread/9701/
http://activecodeline.com/retrieving-url-paths-in-magento