Skip to content

Upgrading to 2.1.7 changed dropdown attributes to swatches #9923

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

Closed
roseofgold opened this issue Jun 12, 2017 · 18 comments
Closed

Upgrading to 2.1.7 changed dropdown attributes to swatches #9923

roseofgold opened this issue Jun 12, 2017 · 18 comments
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed 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 Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release

Comments

@roseofgold
Copy link

Preconditions

  1. Magento 2.1.7
  2. PHP 7.0.17
  3. mySQL 5.6.35-80.0

Steps to reproduce

  1. Installed Magento 2.1.2 with custom products
  2. Used Web Setup Wizard to Upgrade System to 2.1.7

Expected result

  1. Size options show on front end as dropdown list. Code is placed in <div class="field configurable required">
    image

Actual result

  1. Size options do not show on front end. Code shows as swatch. <div class="swatch-opt" data-role="swatch-options">
    image
@korostii
Copy link
Contributor

korostii commented Jun 13, 2017

Whis seems to be a duplicate of #9832.

Please check if you have uses of isProductHasSwatchAttribute in your customized code as per this comment and update those. That should resolve your issue.

@antboiko
Copy link

Hi @roseofgold, thank you for your report. We checked the opposite case (swatch attributes being converted to dropdowns) within #9832 and we couldn't reproduce the issue.
Can you please check the suggestion provided by @korostii and let us know if the issue is still reproducible.

@roseofgold
Copy link
Author

@korostii it is very similar to #9832. It is the opposite case as @antboiko said.

I have not extended the swatches module. I have checked the vendor files (vendor/magento/module-swatches/Block/Product/Renderer/) and the getRendererTemplate fuction does have $this->isProductHasSwatchAttribute() in it.

Is there somewhere else I should check? Novice Magento coder here

@korostii
Copy link
Contributor

I'd start in app folder if you have any local customizations and also I would check all of 3-rd party modules\themes you happen to have.

vendor/magento folder is expected to be okay, in this case it's probably your other code that got outdated and needs to be adjusted.

Any chance you could find amore experienced colleague to lend you a hand and help you find the issue?
Magento StackExchange might also be helpful in such cases (if you're able\allowed to disclose the source code).

@roseofgold
Copy link
Author

I will see if I can find some help on StackExchange or through my PHP groups.

@roseofgold
Copy link
Author

I have searched through my files. The only place that isProdustHasSwatchAttribute or getRendererTemplate shows up is in the vendor files.

@korostii
Copy link
Contributor

korostii commented Jun 23, 2017

Ok, so. I had this reproduced on 2.1.7 CE.

Steps to reproduce: save the configurable attribute with frontend input "Text Swatch", then switch back to dropdown and save again.
Actual result: select won't appear on the product page anymore (only the label shows up).

In contrast, an attribute created before upgrade from 2.1.5 to 2.1.7 shows up okay.

Additional considerations: As far as I can tell the issue is introduced in 2.1.6 and remains in 2.1.7
It seems that the check performed by the isProductHasSwatchAttribute() method depends on whether
the attribute has corresponding entries in eav_attribute_option_swatch table.
Apparently, those records don't get flushed when you switch the frontend_input type to "dropdown". Cleaning them up manually seems to fix the attribute and the dropdown appears as expected.

"Well-tested, backwards-compatible, non-breaking patch releases." Yeah, right.

@roseofgold
Copy link
Author

@korostii Thank you for tracking that down. However that still didn't work for me. I did have NULL entries for the attribute in that table. I deleted those line, flushed cache and it still doesn't show up. Is there another table that I should be looking in as well?

I'm about ready to recreate the option to not have to deal with it anymore. Thankfully this is an option for me at this time.

@korostii
Copy link
Contributor

Is there another table that I should be looking in as well?

Not that I know of, unfortunately. Flushing eav_attribute_option_swatch entries corresponding to the attribute (all of them, not just specific to single product or option) worked for me.
Hope you're able to resolve your issue, good luck with your findings!

P.S. I wish the Magento guys would be able to catch this before the release. I think some thorough code review might've spotted this bug.

@koenner01
Copy link
Contributor

Why is this issue marked as 'needs update'. This is clearly still an open issue and has been described perfectly to standards

@OZZlE
Copy link
Contributor

OZZlE commented Aug 29, 2017

It's fixed in 2.1.8 but if you don't want to upgrade then you can patch this in: b84fe27

@GuidoHub
Copy link

I had color swatch but after the update from 2.1.7 to 2.1.8 it became dropdown and I cannot turn it back to swatch.

@GuidoHub
Copy link

@OZZlE the fix in file vendor\magento\module-swatches\view\adminhtml\templates\catalog\product\attribute\text.phtml breaks my excisting Text swatch. I suddenly have an extra column Description. After replacing the file with a copy of 2.1.7 it solved. Can you explain why this file has been changed and why the extra column is there?

First image is with file 2.1.8, second with 2.1.7

swatch-1

swatch-2

@magento-engcom-team magento-engcom-team added Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Progress: needs update labels Sep 11, 2017
@OZZlE
Copy link
Contributor

OZZlE commented Sep 11, 2017

@GuidoHub as far as I an tell both the columns "Swatch" & "Description" are required where "Swatch" is the actual text the buttons get and the "Description" is the title text.

In 2.1.7 it lacks the "Swatch" column and only shows the "Description" column (without any hint). So what you are saving then is essentially NULL on the "Swatch" and then things start to go wrong. I did not investigate it further than that but saw in the table that eav_attribute_option_swatch everything was null. After Truncating this table as mentioned in a previous comment (not by me) and using the 2.1.8 template and saving again all my Text Swatches started to work properly for me.

I do not work at Magento so I cannot say why.

@shreyap26
Copy link

Hi @roseofgold! I had the same bug. After upgrading from 2.1.2 to 2.1.8, Size attribute which was dropdown was used as Swatch on Configurable Product Pages. I had Null values for the attribute option_ids in eav_attribute_option_swatch table. I deleted those rows from the table but the Size attribute was still treated as a Swatch. This was because the swatch attribute_ids were retrieved from CacheInterface.
writing $this->cache->clean() in module-swatches/Model/SwatchAttributeCodes getCodes() solved the issue. I removed this line after loading the product page once.

@magento-engcom-team magento-engcom-team added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed and removed Progress: needs update labels Sep 18, 2017
@magento-engcom-team magento-engcom-team added Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed labels Sep 29, 2017
@magento-engcom-team magento-engcom-team added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release labels Oct 11, 2017
@okorshenko okorshenko removed the 2.1.x label Dec 14, 2017
@eugene-shab
Copy link
Contributor

Closed because duplicate #12695

@sidolov sidolov added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Jun 24, 2018
@ishakhsuvarov
Copy link
Contributor

Hi @roseofgold. Thank you for your report.
The issue has been fixed in #17750 by @nmalevanec in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.0 release.

@ishakhsuvarov ishakhsuvarov added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Sep 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed 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 Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release
Projects
None yet
Development

No branches or pull requests