Skip to content

Commit a1bb56e

Browse files
ENGCOM-2806: [Backport] Fixed review list ajax if product not exist redirect to 404 page #13102 #17632
- Merge Pull Request #17632 from mage2pratik/magento2:2.1-develop-PR-port-15369 - Merged commits: 1. 81c0320 2. c729a3b 3. 53ba0ac 4. 01a7e20
2 parents bc213c6 + 01a7e20 commit a1bb56e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

app/code/Magento/Review/Controller/Product/ListAjax.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,16 @@ class ListAjax extends ProductController
1414
/**
1515
* Show list of product's reviews
1616
*
17-
* @return \Magento\Framework\View\Result\Layout
17+
* @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface|\Magento\Framework\View\Result\Layout
1818
*/
1919
public function execute()
2020
{
2121
if (!$this->initProduct()) {
22-
throw new LocalizedException(__('Cannot initialize product'));
23-
} else {
24-
/** @var \Magento\Framework\View\Result\Layout $resultLayout */
25-
$resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
22+
/** @var \Magento\Framework\Controller\Result\Forward $resultForward */
23+
$resultForward = $this->resultFactory->create(ResultFactory::TYPE_FORWARD);
24+
return $resultForward->forward('noroute');
2625
}
2726

28-
return $resultLayout;
27+
return $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
2928
}
3029
}

0 commit comments

Comments
 (0)