Skip to content

Commit

Permalink
MAGETWO-81422: #11211 Fix Store View switcher #11337
Browse files Browse the repository at this point in the history
 - Merge Pull Request #11337 from thiagolima-bm/magento2:fix#11211
 - Merged commits:
   1. ce4fb97
   2. beccd7d
   3. 84729b5
  • Loading branch information
Volodymyr Kublytskyi committed Oct 23, 2017
2 parents 4d26093 + 84729b5 commit 6067706
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 @@ -1166,18 +1166,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 6067706

Please sign in to comment.