Get product attribute label & value in Magento


/ Published in: PHP
Save to your folder(s)

Displays the attribute label and value by using the attribute code.

This works on the Product Detail page in Magento.


Copy this code and paste it in your HTML
  1. <?php if($_product->getData('attribute_code')) : ?>
  2. <?php echo $_product->getResource()->getAttribute('attribute_code')->getStoreLabel(); ?>: <?php echo $this->htmlEscape($_product->getData('attribute_code')); ?>
  3. <?php endif; ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.