0

I want to show a custom label on product detail page as well as on product listing in magento 1.9.0.1

This label will be visible based on an attribute.(if I select an attribute to yes while creating product, only then this label should be visible.)

I am very new to magento so detailed instruction will be better.

0

2 Answers 2

0

Try this,

First create Yes/No attribute then assign.

  1. The first step is to create a new attribute. Log into your Magento admin panel. Select “Attributes” -> “Manage Attributes” from the “Catalog” menu.
  2. Click “Add New Attribute”.
  3. Under Properties, enter “new” in the Attribute Code Select “YES/NO” in the Catalog Input Type for Store.
  4. Click the Manage Label / Options tab on the left, enter a name, for example “New label” in the Admin field and Save Attribute.
  5. Assign that attribute in your attribute set that it will come will adding Product section

Use this code in you list.phtml & view.phtml

 <?php $isvalue = $_product->getData('attribute_code');
                    if($isvalue == 1){
                        echo "Custom Value";
                        }?>
0

if you are using on list page then in attribute it should be

and in attribute edit Used in Product Listing set to yes

and in your app/design/frontend/YourPackage/YourTheme/template/catalog/product/view.phtml

and

app/design/frontend/YourPackage/YourTheme/template/catalog/product/list.phtml

<?php if($_product->getAttributeCode()):
    echo "your label";
 endif;
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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