Repository navigation
#11211 Fix Store View switcher - #11337
Conversation
| if (!$this->isUseStoreInUrl()) { | ||
| $storeParsedQuery['___store'] = $this->getCode(); | ||
| } | ||
| if ($this->getCode() !== $this->_storeManager->getStore()->getCode()) { |
There was a problem hiding this comment.
@thiagolima-bm Please explain why usage of __from_store query parameter should be used.
There was a problem hiding this comment.
for tracking, maybe?
|
|
||
| //avoid query params duplication | ||
| if (!preg_match('/___store=(.*?)&___from_store=(.*?)/', $requestString)) { | ||
| $currentUrl .= $requestString; |
There was a problem hiding this comment.
$requestCode also contains path and this data may be lost
STR:
- go to Privacy and Cookie Policy
- switch store view (store view switched, user still on Privacy and Cookie Policy)
- switch store view again (store view switched, user on main page but should be on Privacy and Cookie Policy)
| $currentUrl .= $requestString; | ||
| } | ||
|
|
||
| $currentUrl .= ($storeParsedQuery ? '?' . http_build_query($storeParsedQuery, '', '&') : ''); |
There was a problem hiding this comment.
I think the source of the issue is concatenation with ? while $requestString may contain query. To fix this I propose:
- Split
$requestStringinto path and query:
$requestStringParts = explode('?', $requestString, 2);
$requestStringPath = $requestStringParts[0];
if (isset($requestStringParts[1])) {
parse_string($requestStringParts[1], $requestStringQuery);
} else {
$requestStringQuery = []
}- Merge original query params and store parsed query
$currentUrlQueryParams = array_merge($requestStringQuery, $storeParsedQuery);- Safely concatenate all parts of url:
$currentUrl = $storeParsedUrl['scheme']
. '://'
. $storeParsedUrl['host']
. (isset($storeParsedUrl['port']) ? ':' . $storeParsedUrl['port'] : '')
. $storeParsedUrl['path']
. $requestStringPath
. ($currentUrlQueryParams ? '?' . http_build_query($currentUrlQueryParams, '', '&') : '');|
@vkublytskyi fixes applied. |
[EngCom] Public Pull Requests - 2.2-develop - MAGETWO-82955: [Backport 2.2-develop] FIX show visual swatches in admin - product attribute #11747 - MAGETWO-82943: Magetwo 70954: Remove the component.clear from the custom options type. This causes the 'elem' array to become out of sync with the recordData #11824 - MAGETWO-82710: Fix issue #10032 - Download back-up .tgz always takes the latest that's created (2.2-develop) #11595 - MAGETWO-81994: Products added to cart with REST API give total prices equal to zero #11458 - MAGETWO-81422: #11211 Fix Store View switcher #11337
|
Gents, still not able to manage this issue to get it work (( |
Applied pull request patch https://github.com/magento/magento2/pull/11337.patch (created by @thiagolima-bm) based on commit(s): 1. ce4fb97 2. beccd7d 3. 84729b5 Fixed GitHub Issues in 2.3-develop branch: - magento#10908: [2.2.0-rc3.0] Language switcher is broken when using multiple times (reported by @hostep) - magento#11211: Store View switcher not working on front-end and it throws an error (reported by @latypatil)
Applied pull request patch https://github.com/magento/magento2/pull/11337.patch (created by @thiagolima-bm) based on commit(s): 1. ce4fb97 2. beccd7d 3. 84729b5 Fixed GitHub Issues in 2.3-develop branch: - magento#10908: [2.2.0-rc3.0] Language switcher is broken when using multiple times (reported by @hostep) - magento#11211: Store View switcher not working on front-end and it throws an error (reported by @latypatil)
Store View switcher not working on front-end and it throws an error #11211 #10908