How to call an attributes on product page in Magento

Create a new attribute or find a existing attribute to call on product page.

Step 1:- First of all go to catalog->attributes->manage attributes on this page you will see a list of attributes under attribute code you will see all the attribute code copy any code. For example “cost” to display it on front end on product view page.

Step 2:- Open \template\catalog\product\view.phtml now find this code line.

“<?php $_product = $this->getProduct(); ?>”

After this code we call our attribute by this code.

<?php
If($_product->getCost ()):
echo $_product->getCost ()
endif;
?>


That’s it.

No comments:

Post a Comment