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?
2 Answers
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" />
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'
.