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

Dropdown on configurable products page is missing when using caches [Magneto 2.1.0] #5241

Closed
RG-1 opened this issue Jun 24, 2016 · 14 comments
Closed
Labels
bug report Component: Catalog Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed

Comments

@RG-1
Copy link

RG-1 commented Jun 24, 2016

Steps to reproduce

  1. I am using Magento 2.1.0 (after update form Magento 2.0.7 using Setup Wizard + MDVA-532 patch).
  2. Create new configurable product or use one created before the update. It should use 2 configurable attributes: visual swatch and dropdown.
  3. Enable all caches.
  4. Try to add this product to the cart.

Expected result

  1. On product page, there should be visual swatch and dropdown.
  2. The product should be added to cart successfully.
    exp

Actual result

  1. Unfortunately, there isn't any dropdown. Just visual swatch.
  2. The product can't be added to cart and this message is displayed under "add to cart" button: "This field is required".
  3. Browser console is clear of any errors.
    is
Follow these steps, to see dropdown on just one product
  1. In one tab open admin panel and in second open category page on store front.
  2. Enable all caches and "Flush Magento Cache".
  3. Go to any configurable product with dropdown and visual swatches. Dropdown should be missing.
  4. "Flush Magento Cache" one more time.
  5. Refresh product page. Now dropdown is there and it works, but only for this one product.
@RG-1
Copy link
Author

RG-1 commented Jun 25, 2016

Update

After flushing caches, the dropdown is not working only when accessing the product page through any category page. When accessing it through a widget ("Product list") or search, dropdown is displayed correctly.

@RG-1
Copy link
Author

RG-1 commented Jun 30, 2016

I think that this issue is related to "Collections Data" cache.
Dropdown is always displayed, after I disabled "Collections Data" and flushed cache.

Please, have a look at the issue.

@davidbilly
Copy link

@RG-1 i have faced this issue too. i need flush magento cache, it's work for awhile, after that the "Size" dropdown disappear again.

@wbyrnetx
Copy link
Contributor

I am also experiencing this same issue. Clearing the cache temporarily resolves the issue. I find that if you clear the cache, visit a category page first, and then a configurable product page you'll be able to reproduce the issue every time.

@wbyrnetx
Copy link
Contributor

I tracked the issue down to this method

Magento\ConfigurableProduct\Model\Product\Type\Configurable::getConfigurableAttributes

It caches configurable attributes and their options. What happening for us is that when browsing a category page, only a subset of the configurable attributes are needed (i.e. for layered nav). That cache entry gets saved. Then when you browse to a product page, it picks up that cache entry from the category page. That cache entry doesn't contain ALL the config attributes, so the dropdowns are empty.

There really needs to be 2 cache entries. One specifically for the category page, and one for the production page. Right now it's just cached by product and store ID.

@HellgaM
Copy link

HellgaM commented Dec 6, 2016

Have the same issue, is there a workaround?

@bpoiss
Copy link

bpoiss commented Jan 30, 2017

One workaround is update catalog_eav_attribute set used_in_product_listing = 1 where used_in_product_listing = 0; (or just update the attributes that are configurable on your products) and deal with the consequences on the frontend.

Another way is to seperate cache identifiers for catalog and product view. Inject a request object in the constructor (don't judge me for placing controller code in the model), change the Magento\ConfigurableProduct\Model\Product\Type\Configurable.php::getConfigurableAttributes() method and insert an ugly controller name check after the $cacheId initialization:

if($this->request->getControllerName() == "product") {
    $cacheId = "product-" . $cacheId;
} else if ($this->request->getControllerName() == "category") {
    $cacheId = "category-" . $cacheId;
}

Also you have to change the save method, to remove caches by their new key.

@IlnitskiyArtem
Copy link

@RG-1, thanks for reporting this issue
Unfortunately I could not reproduce this issue. May you please advise if this problem is still relevant for latest release Magento 2?

@korostii
Copy link
Contributor

After flushing caches, the dropdown is not working only when accessing the product page through any category page. When accessing it through a widget ("Product list") or search, dropdown is displayed correctly.

Hi @IlnitskiyArtem
Confirmed: Experienced the same symptoms on 2.1.7.
Steps to reproduce: save attribute with frontend input "Text Swatch", switch back to dropdown, select won't appear on the product page (only the label shows up).
Attribute created before upgrade from 2.1.5 to 2.1.7 shows up okay.

@IlnitskiyArtem
Copy link

@korostii, Excuse me, but I didn't understand the comment.
You change frontend input type from "Text Swatch" to "Dropdown".
And attribute Is displayed as "Text Swatch" on the product page?

@korostii
Copy link
Contributor

Hi @IlnitskiyArtem, maybe you should've read it more carefully.
First I switched from "Dropdown" to "Text swatch", and then back to "Dropdown".

Result: "select won't appear", meaning the attribute's dropdown is not displayed at all (not as swatch, not as dropdown, just the label), but only on product page.

Do you speak English okay or are you using a translator? I can duplicate the description in Russian, if that'd be easier for you to understand.

@IlnitskiyArtem
Copy link

@korostii please create separate GitHub issue for the issue you describe as it differs from the one described by @RG-1 in this issue report. You change attribute type while in his case attribute is just not displayed according to the description.

@korostii
Copy link
Contributor

Hi @IlnitskiyArtem, the symptoms are the same.
I'd rather guess the reporter missed some steps because he didn't think they're relevant.

If you'd like a different issue, here, have it: #9923 has exactly the same symptoms I do.

@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 the Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch label Sep 25, 2017
@magento-engcom-team
Copy link
Contributor

@RG-1, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Catalog Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed
Projects
None yet
Development

No branches or pull requests

10 participants