So I just started using Magento 1.9 and playing around with custom attributes.

Is it possible to display the value of a custom attribute on the homepage? When doing some googling around, I only find things about the product view, but this is not what I'm after.

What I did was through the cms created a new attribute called Button text. After this, I opened up the .phtml file of the homepage and added the following php line:

echo $_product->getAttributeText('button_text');

Refreshed the browser, cleared Magento cache: the value isn't shown. I think I'm missing something small here, but not sure exactly what.

Any ideas?

the frontend properties

  • You want to show custom attribute value on home page with products information? Feb 17, 2018 at 17:09
  • Euhm no, not really. I'm thinking more of the wordpress equivalent when you want to grab some field values, like $quote = get_field('quote');, where the quote field is just a global field I can use everywhere. But maybe this is not how magento works...
    – floi
    Feb 17, 2018 at 20:32
  • You can’t do this via gui but have to do it in code. Search for sth like load custom product attribute.
    – pong
    Feb 18, 2018 at 21:54
  • Will do. Maybe what I'm after simply isn't doable with Magento...
    – floi
    Feb 19, 2018 at 20:25

3 Answers 3


Use template path hints to locate which file contains the button then add your code to that file using an if statement.

To enable template path hints go to configuration page in admin panel, in the top left under "current configuration scope" select "default store view" then go all the way to the bottom to advanced > developer > debug. Enable template path hints.

Please note that when you do this EVERYONE who visits your site can see the path hints.

Alternatively you can install an extension that turns them on for only you to see. I use Easy Template Path Hints by Magepsycho but there are plenty around.

  • p.s. if I'm not mistaken, the location of the add to cart button is in frontend/your_theme/default/template/catalog/product/list.phtml Feb 17, 2018 at 18:21
  • Thanks, I'll give that a shot. But to be honest, I'm allready in the correct template (I think).
    – floi
    Feb 17, 2018 at 20:33
  • If you're trying to do something similar to following page where you see a "purchase options" button instead of add to cart then this is definitely possible by editing the list.phtml. You might have to create a custom module to be able to call the attribute. homeavdirect.co.uk/catalogsearch/result/index/… Feb 20, 2018 at 10:03

If the product attribute is configured correctly, you can print this:

  • Have tried that one, to no avail.
    – floi
    Feb 17, 2018 at 20:33

So, after some fiddling around, I came across this webpage: https://www.atwix.com/magento/add-category-attribute/

I ran through the steps and now I can display the value of the custom made attribute on the category page. I think I'm getting closer to the answer. I'll go ahead and play with this some more...

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.