Skip to content

Commit

Permalink
ENGCOM-1928: 14294 - Fixes 'back' functionality after switching a sto…
Browse files Browse the repository at this point in the history
…re view. #15961. Fix functional tests.
  • Loading branch information
nmalevanec committed Oct 11, 2018
1 parent c260a75 commit 38b91b7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions app/code/Magento/Store/Block/Switcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,24 @@ public function getTargetStorePostData(Store $store, $data = [])
$data
);
}

/**
* Returns target store redirect url.
*
* @param Store $store
* @return string
*/
public function getTargetStoreRedirectUrl(Store $store)
{
return $this->getUrl(
'stores/store/redirect',
[
'___store' => $store->getCode(),
'___from_store' => $this->getCurrentStoreCode(),
ActionInterface::PARAM_NAME_URL_ENCODED => $this->urlHelper->getEncodedUrl(
$store->getCurrentUrl(false)
),
]
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<?php foreach ($block->getStores() as $_lang): ?>
<?php if ($_lang->getId() != $block->getCurrentStoreId()): ?>
<li class="view-<?= $block->escapeHtml($_lang->getCode()) ?> switcher-option">
<a href="<?= $block->escapeUrl($_lang->getCurrentUrl(true)) ?>">
<a href="<?= $block->escapeUrl($block->getTargetStoreRedirectUrl($_lang)) ?>">
<?= $block->escapeHtml($_lang->getName()) ?>
</a>
</li>
Expand Down

0 comments on commit 38b91b7

Please sign in to comment.