From 81c0320faf3fc5df6dee1227d22651604ade8b57 Mon Sep 17 00:00:00 2001 From: Ananth Date: Sat, 19 May 2018 15:51:43 +0530 Subject: [PATCH 1/4] Fixed review list ajax if product not exist redirect to 404 page #13102 --- app/code/Magento/Review/Controller/Product/ListAjax.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Review/Controller/Product/ListAjax.php b/app/code/Magento/Review/Controller/Product/ListAjax.php index 32d608704c241..9992b250c53f9 100644 --- a/app/code/Magento/Review/Controller/Product/ListAjax.php +++ b/app/code/Magento/Review/Controller/Product/ListAjax.php @@ -14,12 +14,15 @@ class ListAjax extends ProductController /** * Show list of product's reviews * - * @return \Magento\Framework\View\Result\Layout + * @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface|\Magento\Framework\View\Result\Layout */ public function execute() { if (!$this->initProduct()) { - throw new LocalizedException(__('Cannot initialize product')); + /** @var \Magento\Framework\Controller\Result\Forward $resultForward */ + $resultForward = $this->resultFactory->create(ResultFactory::TYPE_FORWARD); + $resultForward->forward('noroute'); + return $resultForward; } else { /** @var \Magento\Framework\View\Result\Layout $resultLayout */ $resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT); From c729a3bb2bec3a505c4ab523ad04897b0519be2c Mon Sep 17 00:00:00 2001 From: Ananth Iyer Date: Mon, 21 May 2018 10:32:32 +0530 Subject: [PATCH 2/4] Fixed review list ajax if product not exist redirect to 404 page #13102 #2 From 53ba0ac25195a7474971e6ab03257386a9113977 Mon Sep 17 00:00:00 2001 From: Lars Roettig Date: Thu, 12 Jul 2018 13:47:14 +0200 Subject: [PATCH 3/4] Code Style Fix --- .../Magento/Review/Controller/Product/ListAjax.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Review/Controller/Product/ListAjax.php b/app/code/Magento/Review/Controller/Product/ListAjax.php index 9992b250c53f9..058f9c577a2aa 100644 --- a/app/code/Magento/Review/Controller/Product/ListAjax.php +++ b/app/code/Magento/Review/Controller/Product/ListAjax.php @@ -18,16 +18,12 @@ class ListAjax extends ProductController */ public function execute() { - if (!$this->initProduct()) { + if (!$this->initProduct()) { /** @var \Magento\Framework\Controller\Result\Forward $resultForward */ $resultForward = $this->resultFactory->create(ResultFactory::TYPE_FORWARD); - $resultForward->forward('noroute'); - return $resultForward; - } else { - /** @var \Magento\Framework\View\Result\Layout $resultLayout */ - $resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT); + return $resultForward->forward('noroute'); } - return $resultLayout; + return $this->resultFactory->create(ResultFactory::TYPE_LAYOUT); } } From 01a7e20deea3e72a27b8784278eb5eb5ba6bc1fb Mon Sep 17 00:00:00 2001 From: Stanislav Idolov Date: Thu, 9 Aug 2018 19:25:03 +0300 Subject: [PATCH 4/4] Fixed code style issue --- app/code/Magento/Review/Controller/Product/ListAjax.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Review/Controller/Product/ListAjax.php b/app/code/Magento/Review/Controller/Product/ListAjax.php index 058f9c577a2aa..d6aa26f72c577 100644 --- a/app/code/Magento/Review/Controller/Product/ListAjax.php +++ b/app/code/Magento/Review/Controller/Product/ListAjax.php @@ -18,7 +18,7 @@ class ListAjax extends ProductController */ public function execute() { - if (!$this->initProduct()) { + if (!$this->initProduct()) { /** @var \Magento\Framework\Controller\Result\Forward $resultForward */ $resultForward = $this->resultFactory->create(ResultFactory::TYPE_FORWARD); return $resultForward->forward('noroute');