display a single specific product attribute.


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



Copy this code and paste it in your HTML
  1. <?php echo $_product->getResource()->getAttribute('attribute name')->getFrontend()->getValue($_product) ?>
  2.  
  3. //text
  4. <?php echo $_product->getExtras() ?>
  5.  
  6. //dropdown
  7. <?php echo $_product->getAttributeText('extras') ?>
  8.  
  9. <?php $oa_herstellerland = $_product->getData('oa_herstellerland');
  10. if (trim($oa_herstellerland) != '') { ?>
  11. <li class="<?php echo $_product->getResource()->getAttribute('oa_herstellerland')->getAttributeCode($_product) ?>">
  12. <div class="label"><?php echo $_product->getResource()->getAttribute('oa_herstellerland')->getFrontend()->getStoreLabel($_product) ?></div>
  13. <div class="infotxt">
  14. <?php echo nl2br($oa_herstellerland); ?>
  15. </div>
  16. </li>
  17. <?php } ?>

URL: http://snippi.net/magento-display-specific-product-attribute

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.