Skip to content

Commit

Permalink
Merge 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 authored Jan 23, 2018
2 parents 060a8f9 + c8abb13 commit 4da2a7d
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 4da2a7d

Please sign in to comment.