简体   繁体   中英

Magento how to display a block with a small image over the actual product image by using product id

I have a table which contain some product ids and small images. I need to display the image over the actual product image. how can i display the small image in every place where the product image is appeared, that is: product view, related product, list, grid.. without changing there template.

Is there any programmatic way to display the small image everywhere without the need to change something in every template where the product image is display.

Yes this is quite possible. Not easy though.

There is a helper for that

Mage_Catalog_Helper_Image

Within the helper extend the init function and rewrite the assignment of the watermark. Enable it in backend in system > configuration > design > watermark. Then use the helper init function to assign the additional image you have.

When you are finished, make sure you clean the cache AND image cache. Otherwise the images are not generated.

It is still possible that some images wont have the additional image overlay. But this is more of a template issue that doesn't use the helper function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM