Show a Custom or default attributes in the phtml file

To show a particular attributes value of the products u have to add this simple code

For Text attributes

$_product->getData('attribute_name') 

For Dropdown attributes

$_product->getAttributeText('attribute_name') 

It is so simple….

Advertisements

Tagged:

2 thoughts on “Show a Custom or default attributes in the phtml file

  1. sandeep Kumar May 10, 2012 at 12:09 am

    Hi
    I use getAttributeText(‘color’) ?> this code in my home.phtml file to show all option of color attribute in a dropdown but its give following error.
    Fatal error: Call to a member function getAttributeText() on a non-object in C:wampwwwmagentoappdesignfrontenddefaultdefaulttemplatesamplehome.phtml on line 27

    Could you please help me?

    Thanks

  2. sandeep Kumar May 10, 2012 at 12:10 am

    getAttributeText(‘color’) ?>

Comments are closed.

%d bloggers like this: