Skip to content

Commit 4da2a7d

Browse files
Merge forwardport of #11337 to 2.3-develop branch
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: - #10908: [2.2.0-rc3.0] Language switcher is broken when using multiple times (reported by @hostep) - #11211: Store View switcher not working on front-end and it throws an error (reported by @latypatil)
2 parents 060a8f9 + c8abb13 commit 4da2a7d

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
@@ -1182,18 +1182,29 @@ public function getCurrentUrl($fromStore = true)
11821182
if (!$this->isUseStoreInUrl()) {
11831183
$storeParsedQuery['___store'] = $this->getCode();
11841184
}
1185+
11851186
if ($fromStore !== false) {
11861187
$storeParsedQuery['___from_store'] = $fromStore ===
11871188
true ? $this->_storeManager->getStore()->getCode() : $fromStore;
11881189
}
11891190

1191+
$requestStringParts = explode('?', $requestString, 2);
1192+
$requestStringPath = $requestStringParts[0];
1193+
if (isset($requestStringParts[1])) {
1194+
parse_str($requestStringParts[1], $requestString);
1195+
} else {
1196+
$requestString = [];
1197+
}
1198+
1199+
$currentUrlQueryParams = array_merge($requestString, $storeParsedQuery);
1200+
11901201
$currentUrl = $storeParsedUrl['scheme']
11911202
. '://'
11921203
. $storeParsedUrl['host']
11931204
. (isset($storeParsedUrl['port']) ? ':' . $storeParsedUrl['port'] : '')
11941205
. $storeParsedUrl['path']
1195-
. $requestString
1196-
. ($storeParsedQuery ? '?' . http_build_query($storeParsedQuery, '', '&') : '');
1206+
. $requestStringPath
1207+
. ($currentUrlQueryParams ? '?' . http_build_query($currentUrlQueryParams, '', '&') : '');
11971208

11981209
return $currentUrl;
11991210
}

0 commit comments

Comments
 (0)