1

I could add product label (New, Sale tec) following this tutorial. https://www.ubertheme.com/docs/add-product-labels/

I don't use their theme, so I used the section 3 method to manually achieve this. The code suggested was

<?php   $_product = Mage::getModel('catalog/product')->load($_product->getId());   
  $attribute = $_product->getResource()->getAttribute('label');  
      if(is_object($attribute)) {
        $attdefaultvalue = $attribute->getDefaultValue();
        $attributeValue = Mage::getModel('catalog/product')->load($_product->getId())->getlabel();
        $attributeValueName = Mage::getModel('catalog/product')->load($_product->getId())->getAttributeText('label');
        if(strlen($attributeValue) &&  ($attdefaultvalue !== $attributeValue)) { 
           $labeltype = $attributeValueName;        
        } 
        else {
        $labeltype = "";
        }     
    } ?>   
    <?php if ($labeltype): ?>    
    <span class="<?php echo $labeltype; ?>-label"><?php echo $labeltype; ?></span>     
<?php endif; ?>

Now I am wondering if it is possible to show product label on product view page (= view.phtml).

closed as off-topic by Raphael at Digital Pianism, Qaisar Satti, Marius Feb 11 '16 at 9:56

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about third-party modules are generally off-topic because the scope of functionality and code are not available. For more information, see this meta post/answer." – Raphael at Digital Pianism, Qaisar Satti, Marius
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    your question is not really clear, but I can tell you that the code you posted is really bad. Not only you have a load in a loop in a template file you have 3 loads in a loop in a template. – Marius Feb 11 '16 at 9:49
2

Add the following code in your catalog/product/view.phtml

<?php echo $_product->getAttributeText('your_attribute_code'); ?>

Not the answer you're looking for? Browse other questions tagged or ask your own question.