
In Magento, you can create unlimited number of custom attributes to show different type of information about your product. These attributes can be different type as Text Field, Text Area, Date, Yes/No, Multiple Select, Dropdown, Price, Gallery, Media Image etc. Sometimes you need to get these attributes value to show in different places. There are different way to get different type of attributes.
you can get almost type of attribute value by using the following code:
- <?php
- echo $_product->getAttributeName();
- ?>
<?php echo $_product->getAttributeName(); ?>
For example, suppose you are selling computer monitor in your web store and you created a attribute by using ‘screen_resolution‘ as its attribute code. Then You can get this attribute value by using the following code:
- <?php
- echo $_product->getScreenResolution();
- ?>
<?php echo $_product->getScreenResolution(); ?>
If it not work you can also try following code:
- <?php
- echo $this->htmlEscape($_product->getData('screen_resolution'));
- ?>
<?php
echo $this->htmlEscape($_product->getData('screen_resolution'));
?>If you want to get any “Dropdown or a Multiple Select” type attribute’s value, then you should use following code to to get their value:
- <?php
- echo $_product->getAttributeText('screen_resolution');
- ?>
<?php
echo $_product->getAttributeText('screen_resolution');
?>Here i used screen_resolution which is my attribute code. You must use your attribute code.
Note: Make sure your attribute field “Visible on Product View Page on Front-end” is set as Yes. otherwise that attribute value don’t show on forntend.








thanks!
Great post about getting Magento attributes values!! Thanks
It is still working in 1.7.x.x . Thanks for share about getting Magento attribute value
Amazing!!! I showed my custom attribute’s value in front-end by following this post. thanks.