Skip to content

Commit

Permalink
Merge pull request #2743 from romainruaud/fix_virtual-category-router
Browse files Browse the repository at this point in the history
Fix #2628 : Only allow the router to match if we are under the subtre…
  • Loading branch information
romainruaud authored Oct 14, 2022
2 parents 1ab6c15 + 2b598ec commit f8d5b47
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ public function match(RequestInterface $request): ?ActionInterface
['router' => $this, 'condition' => $condition]
);

if ($appliedRoot && $appliedRoot->getId()) {
$this->virtualCategoryRoot->setAppliedRootCategory($appliedRoot);
if (!$appliedRoot || !$appliedRoot->getId()) {
return null;
}

$this->virtualCategoryRoot->setAppliedRootCategory($appliedRoot);

$productRewrite = $this->getProductRewrite($identifier);
if ($productRewrite) {
$request->setAlias(UrlInterface::REWRITE_REQUEST_PATH_ALIAS, $productRewrite->getRequestPath());
Expand Down

0 comments on commit f8d5b47

Please sign in to comment.