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

Not possible to use Visual Swatch attributes #691

Open
simonrl opened this issue May 24, 2024 · 2 comments
Open

Not possible to use Visual Swatch attributes #691

simonrl opened this issue May 24, 2024 · 2 comments

Comments

@simonrl
Copy link
Contributor

simonrl commented May 24, 2024

Environment and configuration

  1. Magento 2 Open Source 2.4.6-p3
  2. Akeneo CE 7.0.13
  3. Connector 104.3.7

Steps to reproduce

  1. have "Simple Select" attribute in Akeneo
  2. configure it as "Visual Swatch" in the Akeneo-Connector-Configuration
  3. import everything
  4. add colors / images to swatch options in Magento
  5. import "option"

Expected result

  1. The swatch colors/images should stay intact

Actual result

  1. The colors/images are removed

Additional info

We also tried to remove the attribute again from the Akeneo-Connector-Configuration's attribute type mapping, which results in: "option"-import works fine, but "attribute" import changes the attribute type in Magento from "Visual Swatch" to "Drop Down". After this is changed manually, the swatch colors/images are still there.

The comment for the Job/Option::insertSwatchOption() reads

Insert Swatch options Values for swatch attributes (visual swatch have no data on V1)

...so how are we supposed to handle Visual Swatches, if no configuration seems to work?

@akosglue
Copy link

akosglue commented Jun 3, 2024

I could reproduce this issue with
CE 7.0.66
magento 2.4.7
connector 104.3.7
Annoying because you select all the colors for each swatch and in 1 second your work is gone.

edit: after a closer look, this line and the next should be properly changed:

'type' => ($swatchesAttributes[$swatchesAttributeData['attribute']] === Swatch::SWATCH_TYPE_TEXTUAL_ATTRIBUTE_FRONTEND_INPUT) ? Swatch::SWATCH_TYPE_TEXTUAL : Swatch::SWATCH_TYPE_EMPTY,

so that other types are checked as well like SWATCH_TYPE_VISUAL_ATTRIBUTE_FRONTEND_INPUT
and the correspondent type is inserted like SWATCH_TYPE_VISUAL_COLOR or SWATCH_TYPE_VISUAL_IMAGE, etc.

@akosglue
Copy link

@simonrl you may try the aforementioned PR that fixes the color/images issue.
Tested with m2 2.4.7, php 8.3, akeneo 7.0.66 with sample data, connector 104.3.7

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

No branches or pull requests

2 participants