Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-review
Controller
Product
View.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Review\Controller\Product
;
7
8
use
Magento\Review\Controller\Product
as
ProductController
;
9
use
Magento\Framework\Controller\ResultFactory
;
10
use
Magento\Review\Model\Review
;
11
12
class
View
extends
ProductController
13
{
21
protected
function
loadReview($reviewId)
22
{
23
if
(!$reviewId) {
24
return
false
;
25
}
27
$review
= $this->reviewFactory->create()->load($reviewId);
28
if
(!
$review
->getId()
29
|| !
$review
->isApproved()
30
|| !
$review
->isAvailableOnStore($this->storeManager->getStore())
31
) {
32
return
false
;
33
}
34
$this->coreRegistry->register(
'current_review'
,
$review
);
35
return
$review
;
36
}
37
43
public
function
execute
()
44
{
45
$review
= $this->loadReview((
int
)$this->
getRequest
()->getParam(
'id'
));
47
$resultForward = $this->resultFactory->create(ResultFactory::TYPE_FORWARD);
48
if
(!
$review
) {
49
$resultForward->forward(
'noroute'
);
50
return
$resultForward;
51
}
52
53
$product
= $this->
loadProduct
(
$review
->getEntityPkValue());
54
if
(!
$product
) {
55
$resultForward->forward(
'noroute'
);
56
return
$resultForward;
57
}
59
$resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
60
return
$resultPage;
61
}
62
}
Magento\Review\Controller\Product\loadProduct
loadProduct($productId)
Definition:
Product.php:214
Magento\Framework\Controller\ResultFactory
Definition:
ResultFactory.php:17
Magento\Framework\App\Action\AbstractAction\getRequest
getRequest()
Definition:
AbstractAction.php:60
Magento\Framework\App\ActionInterface\execute
execute()
Magento\Review\Controller\Product\View
Definition:
View.php:12
Magento\Review\Controller\Product
Definition:
ListAction.php:6
$review
$review
Definition:
customer_review.php:14
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
Magento\Review\Model\Review
Definition:
Status.php:13