-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Magento2 Switches back to Default Storeview eachtime I change page #6404
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
Comments
@Sid-95 thank you for your report. |
@veloraven Thanks for your answer, I am using Magento 2.1.0 I switch from one storeview to the other using the storeview switcher (which appears in my store with languages icon & label). Here's the step to reproduce the bug on my site:
Expected result Actual result Annotations |
@Sid-95 Thanks for reporting. We have followed those steps:
In those steps language was preserved and related to corresponding store view.
|
@picamator this is the link: texbook.it Here what I've done:
Maybe is something with cookie that I am missing |
I can confirm the same behaviour with CE 2.1.1. The next action will immediately bring you back to the German view store, for example: We are using SEO and mod_rewrite, so each category has a different SEO URL in every language. As Sid-95 did mention, there doesn't seem to be a language cookie set, I can see the same here on my end. But I would expect the PHP session to remember the current language selection of the user. |
I forget to mention, this is a clean install of CE 2.1.1 on CentOS 7, running with a 2.4 apache server on PHP 5.6.25. Alle caches are disabled and we are in development mode. |
Some observation from a TCP trace. GET /magento2/category1.html?___store=sv_en&_from_store=sv_de HTTP/1.1 It does request the correct URL and the cookie "store" is still set to the German view, all good. Now the server responds: HTTP/1.1 302 Found As you can see, the Location is still set to the English category name, but the cookie "store" is not transferred, hence the client will now issue the following request: GET /magento2/category1.html HTTP/1.1 Still all cool, but as you can see in the request, the cookie "store" is still set to the German view and now the server doesn't have any clue anymore, that we actually wanted the English view, so of course it will reply with: HTTP/1.1 301 Moved Permanently So back to German it is. I do assume, that in the "HTTP/1.1 302 Found" reply from the server, the cookie "store" should have been changed to "sv_en". Ronny |
There was another (now closed) issue related to the "store" cookie value. Maybe they are related? |
Thank you for details, @Sid-95 , we have:
Could you please clear all Browser Storage: Cache, Cookies, Session Storage, Local Storage?
|
@picamator actually I solved it by adding virtual sub dom, and separating eng storeview in subdomain en.texbook.it & italian in it.texbook.it. Yes it's very ugly to see a .IT domain with subdomain en. But that's a thing a we are going to change & it's out of scope. In my guess it's something related to hardcoded linking |
@picamator Thank you for your response, it pointed me in the right direction. The culprit was found in the template we are using, for the language switcher the following code was used as the anchor inside the foreach loop to generate the drop down box: This might have worked in older versions of Magento, but doesn't seem to work in 2.1. Maybe this should be part of a FAQ for theme developers, if it isn't already. Thank you for your time and assistance, from my perspective the issue can be closed. Yours, Ronny |
@ronnybremer @Sid-95 We glad to hear that issue was solved. Please feel free to reopen it if you need. |
Hi, same issue here with a theme that uses the "old" Now, if I replace it with I get the following error:
|
I am also facing the same issue. It shows different store in the cookie. Please suggest the solution. |
The solution provided here (#3676 (comment)) resolved the issue for me. I still have an open question as to why this isnt being included in the Magento code. |
If the "fix" from #3676 was included then it would break the standard store switcher that replies on cookies overriding server settings. The standard approach is for the server to set a default store, and then your cookie determines whether a different store is used. |
@ronnybremer solutions worked for me. |
@ronnybremer solutions worked for me too. |
@ronnybremer your solution worked for me. Thank you |
Hello, I am facing the same issue. I have 2 store views one Telegu and other English. When i am using English language store view and try to click any menu or any link it redirects to default store view. When i switch from telegu language to english My site url displays like this http://bharatka.nextmp.net/mobiles-and-accessories.html?___store=kleverk&___from_store=default I tried using this code in pub index.php but it does not work #3676 Any advice how to fix this. Thanks |
same issue in 2.3.3 |
Uh oh!
There was an error while loading. Please reload this page.
Magento2 Switches back to Default Storeview eachtime I change page
I've setted up my magento store @ the following link (http://162.252.104.103/), i successfully added 2 storeviews. One with italian language (default) & one with eng lang.
When I switch to eng lang it works fine, but if I do any action it reverts back to the default storeview (italian lang). I checked several thing, and I noticed that when I change the storeview no cookie related to storeview setted. But I can't figure out why this isn't working
Preconditions
Steps to reproduce
Expected result
Actual result
The text was updated successfully, but these errors were encountered: