Image label per store view does not work as expected
Steps to reproduce:
Create at least one store view other than the default one Create a simple product From the default store view add an image to the product with the label 'AAA' and set it as the base image, small image and thumbnail Switch to the non-default store view and make sure that the "base image", "small image" and "thumbnail" radios are set to "use default value". Save the product. Go back to the default store view and change the image label to 'BBB'. Save the product.
Expected result: in the frontend of the non-default store view the image should have the BBB label
Actual result: in the frontend of the non-default store view the image has the AAA label
Back in the admin, go to the non-default store view. Set the image label to 'CCC' and save the product.
Expected result: in the frontend of the non-default store view the image should have the CCC label
Actual result: in the frontend of the non-default store view the image has the AAA label
In the admin add another image to the product with the label DDD in the default store view. Mark it as the default base image, small image and thumbnail and set its label to DDD
Expected result: in the frontend of the non-default store view the image should be the new one with the DDD label
Actual result: in the frontend of the non-default store view the image is the new one, but with the AAA label
Notice: in the admin panel product image tab all the data seem to be displayed correctly. That's because in the catalog_product_entity_media_gallery and catalog_product_entity_media_gallery_value tables the values are correct, and the admin panel uses those tables. It's the image_label, small_image_label and thumbnail_label attributes that are not epdated correctly.
From our investigations, it seems like the issue lies in the Mage_Catalog_Model_Product_Attribute_Backend_Media::beforeSave() method. When saving a product in a non-default store view where the images are set to "use default", the line
$attrData = $object->getData($mediaAttrCode);
returns false. The following in_array() checks fail and so the values for the XXX_label attributes that were loaded get duplicated in the non-default store view.
@azambon could you please check PR https://github.com/OpenMage/magento-lts/pull/2481 ? we should approve it and get it merged
@azambon could you please check PR #2481 ? we should approve it and get it merged
Hello, thank you @fballiano :+1:
It will be a few days before I can check this, but I will do so as soon as possible.