0

I think that my question yesterday was a bit confusing, so today I'm asking again. In my magento shop I wan't to display icons instead text for product attributes. Attributes that we found under additional information, as you can see below. Code that generates attributes with corresponding values is below:

<?php foreach ($_additional as $_data): ?>
<tr>
    <th class="label"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
    <td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
</tr>

enter image description here

Thanks for any suggestions.

1 Answer 1

1

I think you can replace this code:

<?php echo $this->htmlEscape($this->__($_data['label'])) ?>

with

<?php if ($_data['code'] == 'processor') : //or any other code?>
    <img src="<?php echo $this->getSkinUrl('images/attributes/processor.png')?>" alt="<?php echo $this->htmlEscape($this->__($_data['label'])) ?>" />
<?php else : ?>
    <?php echo $this->htmlEscape($this->__($_data['label'])) ?>
<?php endif;?>

If you want to replace for all attributes, just create images with the same name as the attribute code inside the images/attributes/ folder of your theme skin and replace

<?php echo $this->htmlEscape($this->__($_data['label'])) ?>

with

<img src="<?php echo $this->getSkinUrl('images/attributes/'.$_data['code'].'.png')?>" alt="<?php echo $this->htmlEscape($this->__($_data['label'])) ?>" />
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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