Skip to content

Commit ed8bfb3

Browse files
ENGCOM-2858: [Forwardport] Fixed review list ajax if product not exist redirect to 404 page #17721
- Merge Pull Request #17721 from nmalevanec/magento2:2.3-develop-PR-port-15369 - Merged commits: 1. 3f0168c
2 parents 5084541 + 3f0168c commit ed8bfb3

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Review\Controller\Product;
78

8-
use Magento\Framework\Exception\LocalizedException;
9+
use Magento\Framework\App\ResponseInterface;
10+
use Magento\Framework\Controller\ResultInterface;
11+
use Magento\Framework\View\Result\Layout;
912
use Magento\Review\Controller\Product as ProductController;
1013
use Magento\Framework\Controller\ResultFactory;
1114

@@ -14,17 +17,16 @@ class ListAjax extends ProductController
1417
/**
1518
* Show list of product's reviews
1619
*
17-
* @return \Magento\Framework\View\Result\Layout
20+
* @return ResponseInterface|ResultInterface|Layout
1821
*/
1922
public function execute()
2023
{
2124
if (!$this->initProduct()) {
22-
throw new LocalizedException(__("The product can't be initialized."));
23-
} else {
24-
/** @var \Magento\Framework\View\Result\Layout $resultLayout */
25-
$resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
25+
/** @var \Magento\Framework\Controller\Result\Forward $resultForward */
26+
$resultForward = $this->resultFactory->create(ResultFactory::TYPE_FORWARD);
27+
return $resultForward->forward('noroute');
2628
}
2729

28-
return $resultLayout;
30+
return $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
2931
}
3032
}

0 commit comments

Comments
 (0)