Repository navigation
Store View switcher not working on front-end and it throws an error #11211
Copy link
Copy link
Closed
Labels
Fixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 release
Description
If we select any store then site will go to that store and again we select another store then it throws an error because the url is wrong.
Preconditions
- Magento ver. 2.2.0
- PHP 7.0.24, mysql Ver 14.14
Steps to reproduce
- Create different store view from admin panel and all will appear on front-end
- Select any store view (No error)
- Again select another store view(error will be there)
Expected result
- It should show all store views without any error
Ex. http://10.16.16.141/magento2.2/?___store=aus ==>this is for one of store view
http://10.16.16.141/magento2.2/?___store=usa ==> This should be for different store view
OR
Base url should be the same for any store ,only store will get switch!
Actual result
After changing the store view second time it redirect to below url :
http://10.16.16.141/magento2.2/?___store=aus?___store=usa
(URL is only for reference , it will not work)
Reacted by Simon Dakin
Metadata
Metadata
Assignees
Labels
Fixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 release

Activity
magento-engcom-team commentedon Oct 4, 2017
@latypatil, thank you for your report.
We've created internal ticket(s) MAGETWO-80840 to track progress on the issue.
latypatil commentedon Oct 4, 2017
The issue is in /vendor/magento/module-store/Block/Switcher.php with function getTargetStorePostData () where $store->getCurrentUrl(false) , Current url has been passed there and It should be $this->getUrl('stores/store/switch').
duckchip commentedon Oct 9, 2017
this issue is a result of merge in issue [https://github.com//issues/8509] which fixes cookie redirect problems with multidomains
thiagolima-bm commentedon Oct 10, 2017
Hey @okorshenko PR #11337
TomashKhamlai commentedon Oct 11, 2017
@latypatil, I think that this issue is similar to issue #10908? Do you have logs in var/logs/exception.log?
magento#11211 Fix Store View switcher, update integration test
magento#11211 Fix Store View switcher, undo integration test changes …
#11211 Fix Store View switcher
MAGETWO-81422: #11211 Fix Store View switcher #11337
MAGETWO-81422: #11211 Fix Store View switcher #11337
Merge pull request #1641 from magento-engcom/2.2-develop-prs
okorshenko commentedon Oct 31, 2017
the issue has been fixed and delivered to 2.2-develop branch. WIll be available with 2.2.2 release
davidroberto commentedon Nov 24, 2017
@latypatil, i had the same problem and was able to fix it with this small fix.
I know it's not perfect and that i should overwrite the core module in a custom plugin, but anyway i'll not need this fix anymore when i'll update the code with the new release containing the official fix.
In /vendor/magento/module-store/block/switcher.php, in getTargetStorePostData method, replace
return $this->_postDataHelper->getPostData( $store->getCurrentUrl(false), $data );by:
$currentUrl = strtok($store->getCurrentUrl(false), '?'); return $this->_postDataHelper->getPostData( $currentUrl, $data );magento-engcom-team commentedon Jan 30, 2018
Hi @latypatil. Thank you for your report.
The issue has been fixed in magento-engcom/magento2ce#1285 by @magento-engcom-team in 2.3-develop branch
Related commit(s):
The fix will be available with the upcoming patch release.
⏫ Forwardport of magento#11337 to 2.3-develop branch
Merge forwardport of magento#11337 to 2.3-develop branch
🔃 [EngCom] Public Pull Requests - 2.3-develop