Example #1
0
 /**
  * Add rate votes
  *
  * @return $this
  */
 public function addRateVotes()
 {
     foreach ($this->getItems() as $item) {
         $votesCollection = $this->_voteFactory->create()->getResourceCollection()->setReviewFilter($item->getId())->setStoreFilter($this->_storeManager->getStore()->getId())->addRatingInfo($this->_storeManager->getStore()->getId())->load();
         $item->setRatingVotes($votesCollection);
     }
     return $this;
 }
Example #2
0
 /**
  * Get review rating collection
  *
  * @return VoteCollection
  */
 public function getRating()
 {
     if (!$this->getRatingCollection()) {
         $ratingCollection = $this->_voteFactory->create()->getResourceCollection()->setReviewFilter($this->getReviewId())->addRatingInfo($this->_storeManager->getStore()->getId())->setStoreFilter($this->_storeManager->getStore()->getId())->load();
         $this->setRatingCollection($ratingCollection->getSize() ? $ratingCollection : false);
     }
     return $this->getRatingCollection();
 }
Example #3
0
 /**
  * Aggregate options
  *
  * @param \Magento\Review\Model\Rating\Option $option
  * @return void
  */
 public function aggregate($option)
 {
     $vote = $this->_ratingOptionVoteF->create()->load($option->getVoteId());
     $this->aggregateEntityByRatingId($vote->getRatingId(), $vote->getEntityPkValue());
 }