Magento 1.9 – How to Show Image by Product Attribute Value on Product Page

attributesmagento-1.9product-attributeproduct-view

I need to show product image in product page on additional information tab.
I created a attribute name certification marks.
that attribute contain CE, CLASSE II, ENEC, F, IP20 these values.
on additional information page i want to show the logo of these certification marks.
Basically i want to konow that how to show images instead of product attribute value on product page page in additional tab in magento.

I add image of additional details.
enter image description here

here you can see the attributes values is showing…here i want to show logo of these values…

my logos

enter image description here

this is individuals logo..i want to show in additional information page in magento instead of attribute value.

Best Answer

Create or replace with the below content and put it in app\design\frontend\Your-Package\Your-theme\template\catalog\product\view\attributes.phtml

Also make logo named as CE.png,CLASSE II.png, ENEC.png, F.png, IP20.png and place it in skin\frontend\Your-Package\Your-theme\images

<?php
$_helper = $this->helper('catalog/output');
$_product = $this->getProduct()
?>
<?php if ($_additional = $this->getAdditionalData()): ?>
    <h2><?php echo $this->__('Additional Information') ?></h2>
    <table class="data-table" id="product-attribute-specs-table">
        <col width="25%" />
        <col />
        <tbody>
            <?php foreach ($_additional as $_data): ?>
                <tr>
                    <th class="label"><?php echo $this->escapeHtml($this->__($_data['label'])) ?></th>
                    <?php if ($_data['code'] == "certification_mark"): ?>
                        <?php $values = explode(',', $_helper->productAttribute($_product, $_data['value'], $_data['code'])); ?>
                        <td class="data">
                            <?php foreach ($values as $value): ?>
                                <div style="float:left;"><img src="<?php echo $this->getSkinUrl("certification_marks/" . trim($value) . ".jpg") ?>"></div>
                            <?php endforeach; ?>
                        </td>
                    <?php endif; ?>
                    <?php if ($_data['code'] != "certification_mark" ): ?>
                        <td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
                    <?php endif; ?>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
    <script type="text/javascript">decorateTable('product-attribute-specs-table')</script>
<?php endif; ?>

It is working for me. Let me know once you tried it.