示例#1
0
 /**
  * @return \Magento\Backend\Block\Widget\Grid
  */
 protected function _prepareCollection()
 {
     //TODO: add full name logic
     $collection = $this->_customersFactory->create()->addAttributeToSelect('firstname')->addAttributeToSelect('lastname');
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 protected function _prepareCollection()
 {
     $collection = $this->_collectionFactory->create()->addCustomerName();
     $storeFilter = 0;
     if ($this->getParam('store')) {
         $collection->addAttributeToFilter('store_id', $this->getParam('store'));
         $storeFilter = 1;
     } elseif ($this->getParam('website')) {
         $storeIds = $this->_storeManager->getWebsite($this->getParam('website'))->getStoreIds();
         $collection->addAttributeToFilter('store_id', ['in' => $storeIds]);
     } elseif ($this->getParam('group')) {
         $storeIds = $this->_storeManager->getGroup($this->getParam('group'))->getStoreIds();
         $collection->addAttributeToFilter('store_id', ['in' => $storeIds]);
     }
     $collection->addOrdersStatistics($storeFilter)->orderByCustomerRegistration();
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }