1

I wish to add a "Certified Organic" logo to the Product Description of some products but not all. If I try to add an image tag to the description it does not stick. Is there another way of doing this by maybe creating an attribute that is turned on/off per product. If on the image is shown on the product page, and if off the image is not shown?

1
  • 1
    You've answered yourself, add a yes/no attribute which you can place logic on the frontend(like Matheus points out correctly)
    – Jeroen
    Commented Mar 13, 2015 at 11:55

2 Answers 2

1

You need to check what type of product (simple, configurable, etc.), if the filter type, you can make a module with the only action of adding the image in the description. The file should be changed in your folder template/modulo_custom is the app\design\frontend\base\default\template\catalog\product\view\description.phtml. Copy the file, change and enter the code: <img src = "link.of.image.jpeg" alt = "some description" />

1

You can do this way:

Create an attribute named organic and make sure you set it as Media Image and apply this attribute to all of your Attribute Sets.

Now, go to your desired product's image section and upload the image and set this image to newly created attribute (organic) and also exclude it if you don't want to show in more image section.

Then, open your template/catalog/view/description.phtml and add following code:

<?php if($this->getProduct()->getOrganic()):?>
     <?php echo '<img id="image" src="'.$this->helper('catalog/image')->init($this->getProduct(), 'organic')->keepAspectRatio(true)->keepFrame(false)->resize(950, null).'"/>';?>
<?php endif;?>

Hope this helps.

Important

organic is the name I gave to attribute, if you give something else, then need to change these too:

getOrganic() to getYourname() and $this->getProduct(), 'organic' to $this->getProduct(), 'yourname'.

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.