I have created a attribute
newsale with two value
Catalog Input Type for Store Owner as
dropdown and added it to a attribute set. And then I have added images into the media with same name as the added value (new.png, sale.png)
My code at frontend to call the attribute in product category page is:
<div class="product-badge"> <span> <?php $Feature = explode(",",$_product->getResource() ->getAttribute('newsale')->getFrontend() ->getValue($_product)); foreach($Feature as $key => $value): ?> <a href="<?php echo $_product->getProductUrl() ?>" ?> <?php echo "<img src='".Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)."/wysiwyg/".trim($value).".png'/>"; ?> </a> <?php endforeach; ?> </span> </div>
My problem here is even when I didn't select any value for this attribute at admin panel, a broken image is getting displayed.
Help me to resolve this issue.