EmicoEcommerce / Magento2Tweakwise-archived

Magento 2 module for Tweakwise integration
Other
9 stars 25 forks source link

Swatches that have a translation won't work when you use multiple languages #231

Closed leonhelmus closed 2 years ago

leonhelmus commented 2 years ago

Issue Brief

What is the purpose of this issue? Explain the background context. A client of ours want to use a product attribute "derived property" which is a visual swatch and uses replace. The attribute code that is used is a visual swatch that has been translated in the backend of magento.

When using a derived property with a swatch it will look at the value that is configured in Tweakwise. This could for example be a color like "Niebieski" (polish) which means "Blauw". Once i go to the polish website this swatch does not work. The reason why is because in the function \Emico\Tweakwise\Model\Swatches\SwatchAttributeResolver::getSwatchData it compares the labels from default store which is for our client dutch to the ones that are translated in polish (which comes from tweakwise). After it shows the results which are less or 0 which should have been more according to the demo shop in tweakwise.

The other way around you could also try to use the dutch default language for the polish website and than also get the same error, because at \Emico\Tweakwise\Block\LayeredNavigation\RenderLayered\SwatchRenderer::getSwatchData you get less or 0 values of filters since the $attribute->getOptions() returns the store labels in the store you are visiting in this case polish.

I have tried to resolve a few options, but since swatches make use of the \Emico\Tweakwise\Model\Catalog\Layer\Filter class to get the option values. I either fix the ones that are in tweakwise "derived property" and than break the ones that are just filters without derived property.

It looks to me that emico tweakwise only supports the default language of options for swatches and not the store languages of options for swatches.

Environment

Steps to reproduce

  1. Create a visual swatch in magento with multiple languages that is assigned to multiple products in the same category.
  2. Create a "derived property" of that attribute in Tweakwise using replaced
  3. Translate a few of those values in tweakwise
  4. Check your demo if you filter works
  5. Check if it works in the store view that does not have the same language as default shop. For example Dutch is default store and Polish is other Store.

Actual result

  1. On dutch you do see filter options for swatches and in polish you don't see a swatch.

Expected result

  1. You should see filter options in both stores.
RemcoWolterink commented 2 years ago

Hopefully, this could be added soon.