Skip to content

Commit

Permalink
MAGETWO-36369: [GitHub] Unable to save product per website wise #1245
Browse files Browse the repository at this point in the history
  • Loading branch information
Maksym Aposov committed Jun 8, 2015
1 parent 1e055fb commit 5a8e393
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,9 @@ public function getUrlPath($product, $category = null)
*/
protected function _prepareProductDefaultUrlKey(\Magento\Catalog\Model\Product $product)
{
$storedProduct = $this->productRepository->getById($product->getId(), false, Store::DEFAULT_STORE_ID);
$storedProduct = $this->productRepository->getById($product->getId(), false, Store::DEFAULT_STORE_ID, true);
$storedUrlKey = $storedProduct->getUrlKey();
$result = null;
if ($storedUrlKey !== false) {
$result = $storedUrlKey;
} else {
$result = $product->formatUrlKey($storedProduct->getName());
}
return $result;
return $storedUrlKey ?: $product->formatUrlKey($storedProduct->getName());
}

/**
Expand Down

0 comments on commit 5a8e393

Please sign in to comment.