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

messages.js breaks minicart item count update in mixed HTTP/HTTPS mode #6487

Closed
torbre16 opened this issue Sep 5, 2016 · 3 comments
Closed
Labels
bug report Component: Customer Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@torbre16
Copy link

torbre16 commented Sep 5, 2016

Preconditions

  1. Magento 2.1.0 (also all release candidates), Magento 2.1.1

Steps to reproduce

  1. Use Magento in mixed HTTP/HTTPS mode (i. e. unsecure base URL uses HTTP, secure base URL uses HTTPS)
  2. Add a product to the cart on a product details page
  3. Go to the cart page and change the quantity of the previously added product
  4. Go back to the product details page (reload it). Sporadically, the number of items in the minicart is not updated correctly.

Expected result

  1. Show the correct number of items in the minicart both on HTTPS and HTTP pages.

Actual result

  1. Sporadically, the number of items in the minicart is not updated correctly when switching between HTTP and HTTPS pages.

Root cause

The number of items in the minicart is stored in the browser's local storage. As the browser has different local storages for HTTP and HTTPS pages, Magento uses a 'section_data_ids' cookie to remember what local storage keys to invalidate (this is all performed in module-customer/view/frontend/web/js/customer-data.js).

The file module-theme/view/frontend/web/js/view/messages.js sets the expires parameter of the cookie storage globally to -1 in the initialize method. Effectively, this disables the cookie storage feature completely in case a new cookie is set via $.cookieStorage, and thus also breaks $.cookieStorage.set('section_data_ids', [...]); which is used to update the number of items in the minicart.

In our case, it helped to change the line

$.cookieStorage.setConf({path: '/', expires: -1}).set('mage-messages', null);

in module-theme/view/frontend/web/js/view/messages.js to

$.cookieStorage.setConf({path: '/'}).set('mage-messages', null);

to fix the issue, but I am not completely sure if this breaks something else in regards to the error message handling (not sure why the expires parameter has been set to -1 originally).

@sevos1984
Copy link
Contributor

Internal ticket created MAGETWO-58182. Thanks for reporting

@sevos1984 sevos1984 added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Sep 8, 2016
mmansoor-magento pushed a commit that referenced this issue Oct 5, 2016
Fixed issues:
- MAGETWO-56938: CLONE - [Github] API salesOrderRepositoryV1 can't create shipping address #5544
- MAGETWO-55342: [GITHUB] Free shiping coupon usage is not tracked #3506
- MAGETWO-59137: It's impossible to create a catalog price rule
- MAGETWO-59090: [Github] Admin can't reset password for more than one customer #5260
- MAGETWO-58182: [Github] Minicart item count is not updated if switch from https to http #6487
@sdzhepa
Copy link
Contributor

sdzhepa commented Oct 6, 2016

@torbre16
Fix for this issue was delivered to develop branch. Pls feel free to check it in develop and reopen if need

  • Fix for Magento 2.1 will be delivered late in scope of internal ticket MAGETWO-59211
  • Fix for Magento 2.0 will be delivered late in scope of internal ticket MAGETWO-59209

@sdzhepa sdzhepa closed this as completed Oct 6, 2016
okorshenko pushed a commit that referenced this issue Dec 14, 2016
…ed if switch from https to http #6487 - for 2.0

 - MAGETWO-58182: [Github] Minicart item count is not updated if switch from https to http #6487
okorshenko pushed a commit that referenced this issue Dec 14, 2016
Fixed issues:
 - MAGETWO-59547: Static versioning is not working under nginx
 - MAGETWO-59374 [Backport]- Ship To section on Checkout's Review & Payments step, clears out the Ship To address on page reload - for 2.0
 - MAGETWO-55664 Portdown MAGETWO-51428 down to M2.0.x branch
 - MAGETWO-58793 Unable to edit configurations options after product options lose price on regeneration
 - MAGETWO-58894 [Backport] Customer is redirected to "Compare Products" Frontend page if tries to remove a Product from comparing - 2.0
 - MAGETWO-58917 Error adding simple product to configurable product with advanced configurations - for 2.0.x
 - MAGETWO-59211 [Backport] - [Github] Minicart item count is not updated if switch from https to http #6487 - for 2.0
 - MAGETWO-57036 [Backport] - Unable to upload change robots.txt file via admin panel - for 2.0
okorshenko pushed a commit that referenced this issue Dec 14, 2016
okorshenko pushed a commit that referenced this issue Dec 14, 2016
Fixed issues:
- MAGETWO-58090: [Magento Cloud] - Intermittent HTTP ERROR 500 during checkout 
- MAGETWO-59024: [Github] Ship To section on Checkout's Review & Payments step, clears out the Ship To address on page reload
- MAGETWO-55447: Portdown MAGETWO-54718 down to M2.1.x branch
- MAGETWO-55662: Portdown MAGETWO-51428 down to M2.1.x branch
- MAGETWO-59209: [Github] Minicart item count is not updated if switch from https to http #6487 
- MAGETWO-56964: [GitHub] Validate attribute values #4881
@elenleonova
Copy link

This issue has been delivered to 2.1.3 and 2.0.11 as of today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Customer 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

5 participants