Reputation: 1629
In my Magento store I have created a new attribute with an attribute code of 'brand_info'.
How can I echo/print the contents of this attribute onto a product page ie. below the description?
Upvotes: 7
Views: 27489
Reputation: 11
I found that adding to view.phtml was best for me
print $_product[brand_info];
Upvotes: 1
Reputation: 185
Add the following code to your catalog/product/view.phtml
or catalog/product/list.html
template files:
echo $_product->getAttributeText('your_attribute_code');
Just change out your_attribute_code
with your attribute code and you’re done.
Upvotes: 5
Reputation: 688
To display the contents of attribute on product page you need to add following code in view.phtml file.
$_product->getResource()->getAttribute('brand_info')->getFrontend()->getValue($_product);
Upvotes: 11
Reputation: 27099
Make sure that the attribute is marked as "used in frontend", then in your template name write the following where you want to see the attribute:
<?php print $_product->getBrandInfo(); ?>
Upvotes: 7