سؤال

I created a new media attribute called 'rollover_image' for some frontend rollover functionality. Reindex was completed and attribute set was also changed - I can see the new 'Rollover Image' radio button when I go to the Images panel under Configure Products. When trying to retrieve this file, I get the following error:

Image file was not found.
#0 /home/www/booboo/app/code/core/Mage/Catalog/Helper/Image.php(166): Mage_Catalog_Model_Product_Image->setBaseFile(NULL)
#1 /home/www/booboo/app/design/frontend/enterprise/booboo/template/catalog/product/list.phtml(175): Mage_Catalog_Helper_Image->init(Object(Mage_Catalog_Model_Product), 'rollover_image')

Anyone had a similar issue? I am on Magento Enterprise ver. 1.12.0.0.

UPDATE

If there are ANY images with the 'rollover_image' media attribute not set from the category list, Magento seems to crash. Any reliable way to patch this?

هل كانت مفيدة؟

المحلول

You get this error because for some reason Magento does not allow you to select 'Used in product listing'=> 'Yes' when adding a 'Media image' attribute but you can set this manually in the database. Identify the id of your attribute and run this query:

UPDATE catalog_eav_attribute set used_in_product_listing = 1 where attribute_id = 'ID HERE'

Then reindex everything and it should work.

[UPDATE] I forgot something. You also need to create this image skin/frontend/{interface}/{theme}/images/catalog/product/placeholder/rollover_image.jpg to use a the default image for the rollover_image attribute. This way you won't get the error.
I suggest creating it in the base/default theme so it will be available for all the themes you have.

نصائح أخرى

I would like to add to Marius's answer and say that all the options for Media Image are in the attribute edit page but are hidden (with display: none), so you could use Firebug or 'Inspect Element' from your browser to show those hidden <tr> tags and change "Used in Product Listing" to "Yes"

I haven't tried to change any other option than "Used in Product Listing" so I can't say what works and what doesn't.

Good luck :)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top