15 class Newest extends \Magento\Backend\Block\Dashboard\Grid
30 \
Magento\Backend\Helper\Data $backendHelper,
34 $this->_collectionFactory = $collectionFactory;
35 parent::__construct($context, $backendHelper,
$data);
44 $this->setId(
'customersNewestGrid');
52 $collection = $this->_collectionFactory->create()->addCustomerName();
59 $storeIds = $this->_storeManager->getWebsite($this->
getParam(
'website'))->getStoreIds();
60 $collection->addAttributeToFilter(
'store_id', [
'in' => $storeIds]);
62 $storeIds = $this->_storeManager->getGroup($this->
getParam(
'group'))->getStoreIds();
63 $collection->addAttributeToFilter(
'store_id', [
'in' => $storeIds]);
66 $collection->addOrdersStatistics($storeFilter)->orderByCustomerRegistration();
70 return parent::_prepareCollection();
78 $this->
addColumn(
'name', [
'header' =>
__(
'Customer'),
'sortable' =>
false,
'index' =>
'name']);
83 'header' =>
__(
'Orders'),
85 'index' =>
'orders_count',
87 'header_css_class' =>
'col-orders',
88 'column_css_class' =>
'col-orders' 92 $baseCurrencyCode = (string)$this->_storeManager->getStore(
93 (
int)$this->getParam(
'store')
94 )->getBaseCurrencyCode();
99 'header' =>
__(
'Average'),
101 'type' =>
'currency',
102 'currency_code' => $baseCurrencyCode,
103 'index' =>
'orders_avg_amount',
104 'renderer' => \
Magento\Reports\Block\Adminhtml\
Grid\Column\Renderer\Currency::class,
105 'header_css_class' =>
'col-avg',
106 'column_css_class' =>
'col-avg' 113 'header' =>
__(
'Total'),
115 'type' =>
'currency',
116 'currency_code' => $baseCurrencyCode,
117 'index' =>
'orders_sum_amount',
118 'renderer' => \
Magento\Reports\Block\Adminhtml\
Grid\Column\Renderer\Currency::class,
119 'header_css_class' =>
'col-total',
120 'column_css_class' =>
'col-total' 127 return parent::_prepareColumns();
135 return $this->
getUrl(
'customer/index/edit', [
'id' =>
$row->getId()]);
elseif(isset( $params[ 'redirect_parent']))
getUrl($route='', $params=[])
__construct(\Magento\Backend\Block\Template\Context $context, \Magento\Backend\Helper\Data $backendHelper, \Magento\Reports\Model\ResourceModel\Customer\CollectionFactory $collectionFactory, array $data=[])