2

Am using Magento 1.9.2.4. I want to display icons respective to the products in product list page (i.e. below the 'price'). So I created an attribute with label Iconlist like below,

enter image description here

and I added the attribute in list.phtml like

            <?php echo $_product->getIconlist(); ?>

But am not able to see any changes. Kindly help me.

3 Answers 3

5

You don need all that xml markup to add an attribute to the product grid. Just edit the attribute in the backend, set the field Used in Product Listing to Yes, reindex everything and you should be able to use in catalog/product/list.phtml this:

<?php echo $_product->getAttributeText('manufacturer') ?>
5
  • 1
    manufacturer is the attribute name. Commented May 4, 2016 at 8:59
  • how to exhibit an icon in list page?
    – Ramya
    Commented May 4, 2016 at 9:10
  • Is this <?php echo $_product->getAttributeText('manufacturer') ?> the way to bring the content we enter in TextArea at list page?
    – Ramya
    Commented May 4, 2016 at 9:42
  • For icon you have to add an attribute to images tab of your product. Commented May 4, 2016 at 10:27
  • Also check this link you will be getting all the details how to add an attribute and how to get that on the frontend. sarathlal.com/create-and-use-custom-image-attribute-in-magento Commented May 4, 2016 at 10:30
2

You should select "Media Image"

enter image description here

Then after assigning this attribute to attribut set, you can see this attribute in "Images" tab.

enter image description here

Upload/Select Icon here and you can fetch this icon to Listing page

$p = Mage::getModel("catalog/product")->load($_product->getId());
echo $p->getIconsunderPrice();
3
  • how to fetch this icon to list page?
    – Ramya
    Commented May 4, 2016 at 9:47
  • In this way we can only add one image to list page.
    – Ramya
    Commented May 4, 2016 at 9:58
  • Updated answer. For Multiple icons you should create MultiSelect attribute with options like abc.png, def.png, etc... (NAME of icon images, PRE-UPLOADED somewhere in media directory). Then in listing page you can use this attribute to generate image sources(SRC) for <IMG /> tag Commented May 4, 2016 at 10:08
2

Use this

echo $this->helper('catalog/output')->productAttribute($_product, $_product->getIconlist(), 'Iconlist');

This will do the translatation of {{media .... }}

Your Answer

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

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