Skip to content

Commit 50d8546

Browse files
committed
Adds fixes for issue #13227
1 parent 6e534ad commit 50d8546

File tree

1 file changed

+2
-5
lines changed
  • app/code/Magento/Catalog/Model/Product

1 file changed

+2
-5
lines changed

app/code/Magento/Catalog/Model/Product/Url.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,8 @@ public function getUrl(\Magento\Catalog\Model\Product $product, $params = [])
162162
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
163163
);
164164

165-
if ($categoryId) {
166-
$filterData[UrlRewrite::METADATA]['category_id'] = $categoryId;
167-
} elseif (!$useCategories) {
168-
$filterData[UrlRewrite::METADATA]['category_id'] = '';
169-
}
165+
$filterData[UrlRewrite::METADATA]['category_id']
166+
= $categoryId && $useCategories ? $categoryId : '';
170167

171168
$rewrite = $this->urlFinder->findOneByData($filterData);
172169

0 commit comments

Comments
 (0)