Skip to content

Commit

Permalink
⏫ Forwardport of #11337 to 2.3-develop branch
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
magento-engcom-team committed Jan 23, 2018
1 parent 8e77e2f commit c8abb13
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions app/code/Magento/Store/Model/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -1182,18 +1182,29 @@ public function getCurrentUrl($fromStore = true)
if (!$this->isUseStoreInUrl()) {
$storeParsedQuery['___store'] = $this->getCode();
}

if ($fromStore !== false) {
$storeParsedQuery['___from_store'] = $fromStore ===
true ? $this->_storeManager->getStore()->getCode() : $fromStore;
}

$requestStringParts = explode('?', $requestString, 2);
$requestStringPath = $requestStringParts[0];
if (isset($requestStringParts[1])) {
parse_str($requestStringParts[1], $requestString);
} else {
$requestString = [];
}

$currentUrlQueryParams = array_merge($requestString, $storeParsedQuery);

$currentUrl = $storeParsedUrl['scheme']
. '://'
. $storeParsedUrl['host']
. (isset($storeParsedUrl['port']) ? ':' . $storeParsedUrl['port'] : '')
. $storeParsedUrl['path']
. $requestString
. ($storeParsedQuery ? '?' . http_build_query($storeParsedQuery, '', '&') : '');
. $requestStringPath
. ($currentUrlQueryParams ? '?' . http_build_query($currentUrlQueryParams, '', '&') : '');

return $currentUrl;
}
Expand Down

0 comments on commit c8abb13

Please sign in to comment.