예제 #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;
 }
예제 #2
0
파일: View.php 프로젝트: aiesh/magento2
 /**
  * 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();
 }
예제 #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());
 }