I have a new attribute 'delivered_in' and I'd like to add it to the product page in Magento. I have edited the view.phtml and added the following code:

    <div><p><?php $_product->getResource()->getAttribute('delivered_in')->getFrontend()->getValue($_product);?></p></div>

When I go to the product page I can see the div and p tags are there but the attribute in between doesn't seem to be called (even though it exists within the product).

Can anyone help?

Thank you.


You forgot echo before the statement. Besides, it can be simplified to:

<div><p><?php echo $_product->getAttributeText('delivered_in') ?></p></div>
  • Hello this solution worked for me. Thank you very much, apologies for the late response guys. Thanks for all your help. Jul 21 '15 at 7:46
  • If it worked for you, please accept the answer, so that it does not count as unanswered anymore for the site statistics (important to get out of beta eventually). magento.stackexchange.com/help/someone-answers Jul 21 '15 at 7:58

Is "Visible on Product View Page on Front-end" set this option to YES ? This option has to be set as yes while creating custom attribute ?

  • Yes it is marked a visitble on product view page on front-end. Jul 13 '15 at 14:10
  • did you tried any other solution mentioned below ? Jul 14 '15 at 6:49
  • Yes this one worked thanks <div><p><?php echo $_product->getAttributeText('delivered_in') ?></p></div> Jul 21 '15 at 7:46

Try this code.

<?php $product->getResource()->getAttributeRawValue($product->getId(), 'delivered_in', Mage::app()->getStore());?>

We can get any attribute value by this code.

Source : Link


Or i'm pretty sure if you have it set to visible on frontend you can use camel case function to get it as:

<div><p><?php echo $_product->getDeliveredIn() ?></p></div>

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.