Ina Code Blog

bunch of code in one place
« Magento: remove break (br) tag from textarea
Magento: How to move cart block from sidebar to header? »


Jun
3

Magento: how to display a certain attribute?

Posted by admin in Magento

Here is how you can display certain attribute on product page. In my case I needed to display cost price:

<?php echo $_helper->productAttribute($_product, $this->htmlEscape($_product->getCost()), ‘cost’) ?>

Or use this for your custom attributes:

<?php echo $_helper->productAttribute($_product, $this->htmlEscape($_product->getCustom()), ‘Custom’) ?>

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

2 Responses to “Magento: how to display a certain attribute?”

  1. Added by admin on Jun at 3

    You can also try and use:

    < ?php echo $_product->getResource()->getAttribute(’cost’)->getFrontend()->getValue($_product); ?>

  2. Added by Morgan on Sep at 22

    THANK YOU!

Leave a Reply

Comment