Hi guys,
i created an attribute at magento backend and i want display the value of that attribute in product details page . how can i acheive it ?
can anyone help me ?
Solved! Go to Solution.
yah i got, we can use below code to get label and value
for label :<?php echo $_product->getResource()->getAttribute('dem')->getStoreLabel(); ?>
for value : <?php echo $_product->getResource()->getAttribute('dem')->getFrontend()->getValue($_product); ?>
You can get attribute value in product page using below way,
Let's assume you have created attribute name like product_custom_attribute and if you want to get that attribute in detail page,
You need to use get method of the attribute using product object,
echo $_product->getProductCustomAttribute()
You got a $_product object in the product page and get that attribute using above way.
Edit:
for Label of attribute :<?php echo $_product->getResource()->getAttribute('dem')->getStoreLabel(); ?>
for Value of attribute : <?php echo $_product->getResource()->getAttribute('dem')->getFrontend()->getValue($_product); ?>
yah i got, we can use below code to get label and value
for label :<?php echo $_product->getResource()->getAttribute('dem')->getStoreLabel(); ?>
for value : <?php echo $_product->getResource()->getAttribute('dem')->getFrontend()->getValue($_product); ?>