Skip to content

Commit 0ff6732

Browse files
author
Ihor Kh
committed
#35371: Product page gives error because of url rewrites
- fixed preparing url path of category
1 parent 89b4e2e commit 0ff6732

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/code/Magento/CatalogUrlRewrite/Model/Storage/DynamicStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ private function findProductRewriteByRequestPath(array $data): ?array
170170
}
171171
$categorySuffix = $this->getCategoryUrlSuffix($data[UrlRewrite::STORE_ID]);
172172
$productResource = $this->productFactory->create();
173-
$categoryPath = str_replace('/' . $productUrl, '', $requestPath);
173+
$categoryPath = substr($requestPath, 0, -1 * strlen('/' . $productUrl));
174174
if ($productFromDb[UrlRewrite::REDIRECT_TYPE]) {
175175
$productUrl = $productFromDb[UrlRewrite::TARGET_PATH];
176176
}

0 commit comments

Comments
 (0)