2

I'm having this problem where i want to display a custom attribute outside the product page in magento. (view.phtml).

For example. I would like to display custom attribute (its value) to specific place in list.phtml (not navigation layout) and in home page. I tried so many solution, but nothing worked.

Any guidance or assistance would be very appreciated.

3
  • Please post some code of what you tried
    – Marius
    Commented Oct 14, 2014 at 11:47
  • 1
    please be a little more specific on what you want to achieve. Commented Oct 14, 2014 at 11:50
  • for example: I managed to display wanted attributes with the following code: $_product->getData('shoes_model'); in my product view page. But with this code, i'm not able to call this function when i want to display the attributes on home page of my web site. it returns nothing.
    – haver15
    Commented Oct 14, 2014 at 12:02

3 Answers 3

6

To display a custom product attribute on the product list page

Go Admin -> Catalog -> Attributes -> Manage Attributes

Set "Used in Product Listing" to Yes

Then in 'list.phtml'

Add $_product->getData('attribute_name_here')

10
  • thanks, this work perfect on list.phtml but on home page isn't not. any idea?
    – haver15
    Commented Oct 14, 2014 at 14:51
  • What code are your using on your homepage (I need to know the block type and template)? Commented Oct 14, 2014 at 15:01
  • i just posted code that I use on my custom theme template.
    – haver15
    Commented Oct 14, 2014 at 15:33
  • I just need the code you added to your homepage cms page . Something like {{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" template="catalog/product/list.phtml"}} Commented Oct 14, 2014 at 15:38
  • is it possible that I don't have block code, as it is empty. I build the theme from scratch, and I only use the code I provided. is it possible to display attribute value anythere on the web site. outside view page and list page?
    – haver15
    Commented Oct 14, 2014 at 15:45
2

To display a product manufactures attribute on the product list page

Go Admin -> Catalog -> Attributes -> Manage Attributes

Set "Used in Product Listing" to Yes

Then in 'list.phtml'

 <?php echo $_product->getAttributeText('manufacturer') ?>
2
  • Need to show this at homepage. any solution?
    – w3debugger
    Commented Apr 9, 2015 at 9:39
  • Fatal error: Call to a member function getAttributeText() on a non-object Commented Jul 8, 2015 at 7:44
1

In Magento-1.9, Display the custom attribute settings

Magento Admin Panel -> Catalog -> Attributes -> Manage Attributes -> Add Attribute ->

Frontend Properties -> Visible on Product View Page on Front-end -> Yes

Once you can try this method.

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.