0

I have created an attribute of type media image and now the attribute is showing in a Product Edit page in admin panel. For some products no image is selected for this attribute. I need to show any default image in the case where no image is selected. Because it is throwing an error on those product where this attribute doesn't have any value.

On front-end i am calling this image like this:

<img src="<?php  $imprint_image_url = (string)Mage::helper('catalog/image')->init($_product, 'attribute_code')->resize(400,500); ?>">  

Thanks

2

You need to create the default image on the disk.
copy the default image from skin/frontend/base/default/images/catalog/product/placeholder/image.jpg to skin/frontend/base/default/images/catalog/product/placeholder/attribute_code.jpg.
Give the new image the same name as the your attribute code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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