Skip to content

Commit

Permalink
Fixed review list ajax if product not exist redirect to 404 page
Browse files Browse the repository at this point in the history
  • Loading branch information
ananth-iyer authored and nmalevanec committed Aug 21, 2018
1 parent 05a7954 commit 3f0168c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions app/code/Magento/Review/Controller/Product/ListAjax.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Review\Controller\Product;

use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\App\ResponseInterface;
use Magento\Framework\Controller\ResultInterface;
use Magento\Framework\View\Result\Layout;
use Magento\Review\Controller\Product as ProductController;
use Magento\Framework\Controller\ResultFactory;

Expand All @@ -14,17 +17,16 @@ class ListAjax extends ProductController
/**
* Show list of product's reviews
*
* @return \Magento\Framework\View\Result\Layout
* @return ResponseInterface|ResultInterface|Layout
*/
public function execute()
{
if (!$this->initProduct()) {
throw new LocalizedException(__("The product can't be initialized."));
} else {
/** @var \Magento\Framework\View\Result\Layout $resultLayout */
$resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
/** @var \Magento\Framework\Controller\Result\Forward $resultForward */
$resultForward = $this->resultFactory->create(ResultFactory::TYPE_FORWARD);
return $resultForward->forward('noroute');
}

return $resultLayout;
return $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
}
}

0 comments on commit 3f0168c

Please sign in to comment.