Skip to content

Commit 09b449b

Browse files
MAGETWO-81422: #11211 Fix Store View switcher #11337
2 parents bf8eb47 + 6067706 commit 09b449b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

app/code/Magento/Store/Model/Store.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,18 +1166,29 @@ public function getCurrentUrl($fromStore = true)
11661166
if (!$this->isUseStoreInUrl()) {
11671167
$storeParsedQuery['___store'] = $this->getCode();
11681168
}
1169+
11691170
if ($fromStore !== false) {
11701171
$storeParsedQuery['___from_store'] = $fromStore ===
11711172
true ? $this->_storeManager->getStore()->getCode() : $fromStore;
11721173
}
11731174

1175+
$requestStringParts = explode('?', $requestString, 2);
1176+
$requestStringPath = $requestStringParts[0];
1177+
if (isset($requestStringParts[1])) {
1178+
parse_str($requestStringParts[1], $requestString);
1179+
} else {
1180+
$requestString = [];
1181+
}
1182+
1183+
$currentUrlQueryParams = array_merge($requestString, $storeParsedQuery);
1184+
11741185
$currentUrl = $storeParsedUrl['scheme']
11751186
. '://'
11761187
. $storeParsedUrl['host']
11771188
. (isset($storeParsedUrl['port']) ? ':' . $storeParsedUrl['port'] : '')
11781189
. $storeParsedUrl['path']
1179-
. $requestString
1180-
. ($storeParsedQuery ? '?' . http_build_query($storeParsedQuery, '', '&') : '');
1190+
. $requestStringPath
1191+
. ($currentUrlQueryParams ? '?' . http_build_query($currentUrlQueryParams, '', '&') : '');
11811192

11821193
return $currentUrl;
11831194
}

0 commit comments

Comments
 (0)