Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 81c0320

Browse files
ananth-iyermage2pratik
authored andcommitted
Fixed review list ajax if product not exist redirect to 404 page #13102
1 parent 964f7b0 commit 81c0320

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@ 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'));
22+
/** @var \Magento\Framework\Controller\Result\Forward $resultForward */
23+
$resultForward = $this->resultFactory->create(ResultFactory::TYPE_FORWARD);
24+
$resultForward->forward('noroute');
25+
return $resultForward;
2326
} else {
2427
/** @var \Magento\Framework\View\Result\Layout $resultLayout */
2528
$resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);

0 commit comments

Comments
 (0)