Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image label per store view does not work as expected #685

Closed
azambon opened this issue May 31, 2019 · 2 comments · Fixed by #2481
Closed

Image label per store view does not work as expected #685

azambon opened this issue May 31, 2019 · 2 comments · Fixed by #2481

Comments

@azambon
Copy link
Contributor

azambon commented May 31, 2019

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.

@fballiano
Copy link
Contributor

@azambon could you please check PR #2481 ? we should approve it and get it merged

@azambon
Copy link
Contributor Author

azambon commented Sep 8, 2022

@azambon could you please check PR #2481 ? we should approve it and get it merged

Hello,
thank you @fballiano 👍

It will be a few days before I can check this, but I will do so as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants