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).

1
  • 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
    Commented Feb 11, 2016 at 9:49

1 Answer 1

1

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

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