From 24b6da9d33b97eb140454a87801fdbad314c46fb Mon Sep 17 00:00:00 2001 From: Andrii Date: Sat, 13 Apr 2019 18:13:00 +0300 Subject: [PATCH] #13227 Wrong product url (with category path) was fixed. --- app/code/Magento/Catalog/Model/Product/Url.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Url.php b/app/code/Magento/Catalog/Model/Product/Url.php index f3ac9f55d1aea..a8efe891165f6 100644 --- a/app/code/Magento/Catalog/Model/Product/Url.php +++ b/app/code/Magento/Catalog/Model/Product/Url.php @@ -162,9 +162,9 @@ public function getUrl(\Magento\Catalog\Model\Product $product, $params = []) \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); - if ($categoryId) { + if ($useCategories && $categoryId) { $filterData[UrlRewrite::METADATA]['category_id'] = $categoryId; - } elseif (!$useCategories) { + } else { $filterData[UrlRewrite::METADATA]['category_id'] = ''; }