Skip to content

Commit 618d8e3

Browse files
author
Janak
committed
Fixed Travis CI build failed
1 parent 54a4039 commit 618d8e3

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

app/code/Magento/UrlRewrite/Model/StoreSwitcher/RewriteUrl.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,16 @@ public function switch(StoreInterface $fromStore, StoreInterface $targetStore, s
6666
UrlRewrite::STORE_ID => $oldStoreId,
6767
]);
6868
if ($oldRewrite) {
69+
$targetUrl = $targetStore->getBaseUrl();
6970
// look for url rewrite match on the target store
70-
$currentRewrites = $this->urlFinder->findAllByData([
71+
$currentRewrite = $this->urlFinder->findOneByData([
7172
UrlRewrite::TARGET_PATH => $oldRewrite->getTargetPath(),
7273
UrlRewrite::STORE_ID => $targetStore->getId(),
7374
]);
74-
if (null === $currentRewrites || empty($currentRewrites)) {
75-
/** @var \Magento\Framework\App\Response\Http $response */
76-
$targetUrl = $targetStore->getBaseUrl();
77-
return $targetUrl;
78-
}
79-
foreach ($currentRewrites as $rewrite) {
80-
$targetUrl = $targetStore->getBaseUrl() . $rewrite->getRequestPath();
75+
if ($currentRewrite) {
76+
$targetUrl .= $currentRewrite->getRequestPath();
8177
}
8278
}
83-
8479
return $targetUrl;
8580
}
8681
}

0 commit comments

Comments
 (0)