Magento Themes and Magento Extensions

How to check if product image added or place holder image used


in Magento place holder image are always used when you get product URL or using Catalog_Helper_Image. But you know sometime, you don’t like this behavior and you need to be able to check if there is an image associated with the product or if the placeholder image will be used.

OK here is the solution

if ($_product->getSmallImage()=='no_selection' ) { //small_image is not set
// do your custom code
} else {
//display normal image?

This solution is used in many problem, for example when you need to handle images between product type Simple Product, Grouped Product and Configuration Product.
Thats it. Magento Programming is interesting.

Comments are closed.