We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6e534ad commit 50d8546Copy full SHA for 50d8546
app/code/Magento/Catalog/Model/Product/Url.php
@@ -162,11 +162,8 @@ public function getUrl(\Magento\Catalog\Model\Product $product, $params = [])
162
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
163
);
164
165
- if ($categoryId) {
166
- $filterData[UrlRewrite::METADATA]['category_id'] = $categoryId;
167
- } elseif (!$useCategories) {
168
- $filterData[UrlRewrite::METADATA]['category_id'] = '';
169
- }
+ $filterData[UrlRewrite::METADATA]['category_id']
+ = $categoryId && $useCategories ? $categoryId : '';
170
171
$rewrite = $this->urlFinder->findOneByData($filterData);
172
0 commit comments