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

Magento 2.1 visual swatch changes only the first picture of product #6195

Closed
ps202 opened this issue Aug 17, 2016 · 19 comments
Closed

Magento 2.1 visual swatch changes only the first picture of product #6195

ps202 opened this issue Aug 17, 2016 · 19 comments
Assignees
Labels
bug report Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@ps202
Copy link

ps202 commented Aug 17, 2016

Preconditions

Operating System: Ubuntu 15.10

PHP 5.6.11-1ubuntu3.4 (cli)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

mysql Ver 14.14 Distrib 5.6.31, for debian-linux-gnu (x86_64) using EditLine wrapper

Magento 2.1.0 CE

Steps to reproduce

  1. Install Magento
  2. Create one configurable product with 2 images
  3. Create configurations (simple products) for that configurable product (color, size for example)
  4. Add 2 images to each simple product
  5. Browse to the product and use the visual swatches to change the color

Expected result

  1. Clicking on the swatches should change BOTH images

Actual result

  1. Only the FIRST image changes, second image stays as it was before. Stepping through the images is weird, because first image is for example red, second white...

Configurable product with simple images:
1

Images in the configurable product:
2

Images in the simple product:
3

Default product view:
4

Product view after clicking on the swatch:
5

Gallery view after clicking on the swatch:
6

@ps202
Copy link
Author

ps202 commented Aug 17, 2016

Isssue is similar to this one here:
#4101

@pboisvert
Copy link

Olena--can you check on this one? Seems like a duplicate.

@ps202
Copy link
Author

ps202 commented Aug 18, 2016

Yeah, it seems to be a duplicate, but I think the other one was closed without providing a real solution. :(

@JesseEnd
Copy link

I'm having this same issue.

@tkacheva
Copy link

tkacheva commented Aug 19, 2016

@JesseEnd @ps202
Gallery supports several modes to show images from configurable options:

  • Replace images in gallery with the ones from configurable options
  • Upend images from configurable option to the images in gallery

Currently the second option is broken. Internal issue MAGETWO-57210

@tkacheva tkacheva added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report labels Aug 19, 2016
@erikhansen
Copy link
Contributor

@tkacheva Where would a merchant customize the gallery modes? Is this something they can do from the admin, or would a developer need to make (possibly in the etc/view.xml file)?

I was working with a merchant yesterday and uncovered that the Blank and Luma themes handle this differently: The Luma theme has the issue discussed in this issue. However the Blank theme works as you would expect: when a swatch is selected, all of the images of the simple product are shown in the gallery, not just the first one. So there is clearly something happening in the Luma theme that is causing different behavior from the Blank theme.

@ps202
Copy link
Author

ps202 commented Aug 19, 2016

@tkacheva
Replace is also not really functioning, because if I have 2 images in the gallery of the configurable product, and also 2 images in the gallery of the simple product (as displayed above), according to your comment, the replace function should replace the existing images in the gallery.
But it is only replacing the first one.
So I would say both options are broken, not only the second one.

@ps202
Copy link
Author

ps202 commented Aug 19, 2016

@erikhansen @tkacheva
I just tried out what Eric wrote above: I can confirm, that just switching to the Blank theme solves the issue...
Both images are changed, not just the first one.

@ps202
Copy link
Author

ps202 commented Aug 28, 2016

Any update on this one?
Switching to the Blank Theme just raised more issues...

@tkacheva
Copy link

tkacheva commented Aug 30, 2016

@ps202 @erikhansen
Yes, the setting I'm referring to is available only for developers that allows to change it per theme. That's why gallery in Blank and Luma behaves differently.

Work in progress

@ps202
Copy link
Author

ps202 commented Sep 10, 2016

@tkacheva
can you provide a workaround for luma?
thanks!

@ps202
Copy link
Author

ps202 commented Sep 10, 2016

@tkacheva
Does not matter, I found it.
/app/design/frontend/Magento/luma/etc/view.xml

Change these to false:

<vars module="Magento_ConfigurableProduct">
    <var name="change_only_base_image">false</var>
</vars>
<vars module="Magento_Swatches">
    <var name="change_only_base_image">false</var>
</vars>

@nelsonvpf
Copy link

@ps202 Well done. It's working now

@erikhansen
Copy link
Contributor

@tkacheva I'm glad @ps202 found a workaround. While I understand that it may be easier from a development standpoint to make some settings be configured in etc/view.xml, this seems like a feature that would be ideal to have as an admin config setting. Just my two cents.

@carlowens
Copy link

👍 Thanks for the fix

mmansoor-magento pushed a commit that referenced this issue Nov 10, 2016
…dded to configurable options

- Implement new behavior for a gallery on configurable product
mmansoor-magento pushed a commit that referenced this issue Nov 10, 2016
…dded to configurable options

- Remove redundant configuration for the Swatches module.
- Add descrtiption of the "gallerySwitchStrategy" option.
mmansoor-magento pushed a commit that referenced this issue Nov 10, 2016
mmansoor-magento pushed a commit that referenced this issue Nov 10, 2016
Fixed issues:
- MAGETWO-59579: [Github #6943] grunt exec:<theme> doesn't work with @import</theme>
- MAGETWO-57210: [github #6195, #4101] Gallery doesn't show all images added to configurable options
- MAGETWO-59003: Js file version regenerated in browser on every page reload in develop mode
okorshenko pushed a commit that referenced this issue Feb 7, 2017
…ll images added to configurable options - for 2.1.x
okorshenko pushed a commit that referenced this issue Feb 7, 2017
…ll images added to configurable options - for 2.1.x

Merge remote-tracking branch 'mainline/2.1-develop' into pr-2.1-develop

# Conflicts:
#	app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js
@rashidtahir
Copy link

After implementing this solution images are now switching fine when selecting color swatches but we have video that's not showing now.When page load first time its show for couple of seconds and then it goes although we have assign video to simple products as well.

magento-team pushed a commit that referenced this issue Oct 5, 2017
…all images added to configurable options to 2.0.x
magento-team pushed a commit that referenced this issue Oct 5, 2017
…all images added to configurable options to 2.0.x
magento-team pushed a commit that referenced this issue Oct 5, 2017
Bug fixes:
- MAGETWO-61112: [Backport] [github #6195, #4101] Gallery doesn't show all images added to configurable options
- MAGETWO-61326: [Backport] State/Province dropdown is broken in frontend customer gift registry
@thaddeusmt
Copy link

Just FYI, it appears that the way to change this functionality in your theme has changed a bit. The change_only_base_image option is gone. Now, in your theme's view.xml, you need to add this:

    <vars module="Magento_ConfigurableProduct">
        <var name="gallery_switch_strategy">prepend</var>
    </vars>

The default is replace, which prepend is overriding.

It appears that the Swatches module knows to look for this single setting, and you only need to set it on the ConfigurableProduct module.

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Nov 8, 2017
joanhe pushed a commit that referenced this issue Dec 4, 2020
@AngeloZou
Copy link

Magento 2.4.2 the same problem exists. Do you have a solution?

@AngeloZou
Copy link

Hi everyboby,
I found a solution, modify your magento2.4.2 view.xml
app/design/frontend/yourtheme/yourtheme/etc/view.xml
<vars module="Magento_ConfigurableProduct"> <var name="gallery_switch_strategy">prepend</var> </vars>
change into
<vars module="Magento_ConfigurableProduct"> <var name="gallery_switch_strategy">replace</var> </vars>

It works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests