Exemplo n.º 1
0
 /**
  * Return collection of reviews
  *
  * @return array|\Magento\Review\Model\Resource\Review\Product\Collection
  */
 public function getReviews()
 {
     if (!($customerId = $this->currentCustomer->getCustomerId())) {
         return [];
     }
     if (!$this->_collection) {
         $this->_collection = $this->_collectionFactory->create();
         $this->_collection->addStoreFilter($this->_storeManager->getStore()->getId())->addCustomerFilter($customerId)->setDateOrder()->setPageSize(5)->load()->addReviewSummary();
     }
     return $this->_collection;
 }
Exemplo n.º 2
0
 /**
  * Initialize review collection
  *
  * @return $this
  */
 protected function _initCollection()
 {
     $this->_collection = $this->_collectionFactory->create();
     $this->_collection->addStoreFilter($this->_storeManager->getStore()->getId())->addCustomerFilter($this->currentCustomer->getCustomerId())->setDateOrder();
     return $this;
 }