In Magento it is possible to access a product’s attributes with a simple getter method. Let’s get the attribute
<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>
There is one thing different here though. If your Attribute Code is “shirt_size”, then you would use getShirtSize(). Remove the underscores and capitalize the first letter of each word. It is picky that way. if you use getshirtsize(), it won’t work.
If you are using a dropdown or a multiple select, you have to call it a little differently:
test
:<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>
There is one thing different here though. If your Attribute Code is “shirt_size”, then you would use getShirtSize(). Remove the underscores and capitalize the first letter of each word. It is picky that way. if you use getshirtsize(), it won’t work.
If you are using a dropdown or a multiple select, you have to call it a little differently:
<?php echo $_product->getAttributeText('shirt_size') ?>
<?php $_product->getResource()->getAttribute('contrast_ratio')
->getFrontend()->getValue($_product);
?>
Note : contrast_ratio
is your dropdown attribute code
Great blog. All posts have something to learn. Your work is very good and i appreciate you and hoping for some more informative posts.keep writing
ReplyDeletemagento development company in bangalore