0

Currently the additional information shows the names of the attributes and then the content, like the image for example:

enter image description here

I would like to have icons for some attributes to show, the icons should take the place of the attribute name.

for example: Country flag instead of the text "country of manufacture", so also for other attributes

Which file should I modify to make it happen?

Thanks

1

You could modify catalog/product/view/attributes.phtml

<?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>
                <td class="data">
                    <?php /* Change here: */ ?>
                    <?php if ($_data['code'] == 'manufacturer'): ?>
                        Whatever you want.
                    <?php else: ?>
                        <?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?>
                    <?php endif; ?>
                 </td>
            </tr>
        <?php endforeach; ?>
        </tbody>
    </table>
    <script type="text/javascript">decorateTable('product-attribute-specs-table')</script>
<?php endif;?>

UPDATE: answering your comment

You can filter attributes by loading them first and then get what fields you want. In the file above, you can use this piece of code:

$attribute = Mage::getSingleton('eav/config')->getAttribute(Mage_Catalog_Model_Product::ENTITY, $_data['code']);

if ($attribute->getIsVisibleOnFront()) {
    // add a wrapper to display the icon, maybe?
}

I'd use "manual" ifs (as I suggested in the first place) for this task because it's much faster.

3
  • hi Predram, this way I add my custom attributes, but if I wanted to add an icon for each attribute that I make visible in the frontend, without having to recall them one by one, how could I do? – Joso Jan 20 '18 at 17:49
  • Please see my update on the answer – Pedram Behroozi Jan 21 '18 at 7:21
  • Hi, well, I take the test and then I'll let you know the result... – Joso Jan 21 '18 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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