Skip to content

Commit 5a8e393

Browse files
author
Maksym Aposov
committed
MAGETWO-36369: [GitHub] Unable to save product per website wise #1245
1 parent 1e055fb commit 5a8e393

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

app/code/Magento/CatalogUrlRewrite/Model/ProductUrlPathGenerator.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,9 @@ public function getUrlPath($product, $category = null)
7777
*/
7878
protected function _prepareProductDefaultUrlKey(\Magento\Catalog\Model\Product $product)
7979
{
80-
$storedProduct = $this->productRepository->getById($product->getId(), false, Store::DEFAULT_STORE_ID);
80+
$storedProduct = $this->productRepository->getById($product->getId(), false, Store::DEFAULT_STORE_ID, true);
8181
$storedUrlKey = $storedProduct->getUrlKey();
82-
$result = null;
83-
if ($storedUrlKey !== false) {
84-
$result = $storedUrlKey;
85-
} else {
86-
$result = $product->formatUrlKey($storedProduct->getName());
87-
}
88-
return $result;
82+
return $storedUrlKey ?: $product->formatUrlKey($storedProduct->getName());
8983
}
9084

9185
/**

0 commit comments

Comments
 (0)