Skip to content

Commit 38b91b7

Browse files
committed
ENGCOM-1928: 14294 - Fixes 'back' functionality after switching a store view. #15961. Fix functional tests.
1 parent c260a75 commit 38b91b7

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

app/code/Magento/Store/Block/Switcher.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,24 @@ public function getTargetStorePostData(Store $store, $data = [])
265265
$data
266266
);
267267
}
268+
269+
/**
270+
* Returns target store redirect url.
271+
*
272+
* @param Store $store
273+
* @return string
274+
*/
275+
public function getTargetStoreRedirectUrl(Store $store)
276+
{
277+
return $this->getUrl(
278+
'stores/store/redirect',
279+
[
280+
'___store' => $store->getCode(),
281+
'___from_store' => $this->getCurrentStoreCode(),
282+
ActionInterface::PARAM_NAME_URL_ENCODED => $this->urlHelper->getEncodedUrl(
283+
$store->getCurrentUrl(false)
284+
),
285+
]
286+
);
287+
}
268288
}

app/code/Magento/Store/view/frontend/templates/switch/languages.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<?php foreach ($block->getStores() as $_lang): ?>
2828
<?php if ($_lang->getId() != $block->getCurrentStoreId()): ?>
2929
<li class="view-<?= $block->escapeHtml($_lang->getCode()) ?> switcher-option">
30-
<a href="<?= $block->escapeUrl($_lang->getCurrentUrl(true)) ?>">
30+
<a href="<?= $block->escapeUrl($block->getTargetStoreRedirectUrl($_lang)) ?>">
3131
<?= $block->escapeHtml($_lang->getName()) ?>
3232
</a>
3333
</li>

0 commit comments

Comments
 (0)