예제 #1
0
파일: Grid.php 프로젝트: aiesh/magento2
 /**
  * @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
파일: Newest.php 프로젝트: aiesh/magento2
 /**
  * {@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', array('in' => $storeIds));
     } elseif ($this->getParam('group')) {
         $storeIds = $this->_storeManager->getGroup($this->getParam('group'))->getStoreIds();
         $collection->addAttributeToFilter('store_id', array('in' => $storeIds));
     }
     $collection->addOrdersStatistics($storeFilter)->orderByCustomerRegistration();
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }