Tuesday, February 9, 2010

Displaying Custom Attributes on Product View Page of Magento

These methods will be used to get the custom attributes for any products

File that you need to make change will be find here:
magentoRoot/app/design/frontend/default/default/template/catalog/product/view.phtml

If it is a text field (textbox or textarea), this is all you have to do:
 echo $_product->getAttributeName()

If your Attribute Code is "shirt_color, then you would use getShirtColor(). Remove the underscores and capitalize the first letter of each word. If you use getshirtcolor(), it won’t work.

If you are using a dropdown or a multiple select, you have to call it a little differently:

echo $_product->getAttributeText('shirt_color)

Hope this helps.

0 comments:

Post a Comment