32 \
Magento\Review\Model\RatingFactory $ratingFactory,
35 $this->_ratingFactory = $ratingFactory;
36 parent::__construct($context,
$data);
44 $entityId = $this->_request->getParam(
'id');
45 if (intval($entityId) <= 0) {
49 $reviewsCount = $this->_ratingFactory->create()->getTotalReviews($entityId,
true);
50 if ($reviewsCount == 0) {
51 #return __('Be the first to review this product'); 53 return parent::_toHtml();
56 $ratingCollection = $this->_ratingFactory->create()->getResourceCollection()->addEntityFilter(
58 )->setPositionOrder()->setStoreFilter(
59 $this->_storeManager->getStore()->getId()
60 )->addRatingPerStoreName(
61 $this->_storeManager->getStore()->getId()
65 $ratingCollection->addEntitySummaryToItem($entityId, $this->_storeManager->getStore()->getId());
69 return parent::_toHtml();
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Review\Model\RatingFactory $ratingFactory, array $data=[])
assign($key, $value=null)