/** * @return array */ public function getCountTotals() { if (!$this->getTotals()) { $filterData = $this->getFilterData(); $totalsCollection = $this->_resourceFactory->create($this->getResourceCollectionName())->setPeriod($filterData->getData('period_type'))->setDateRange($filterData->getData('from', null), $filterData->getData('to', null))->addStoreFilter($this->_getStoreIds())->setAggregatedColumns($this->_getAggregatedColumns())->isTotals(true); $this->_addOrderStatusFilter($totalsCollection, $filterData); if (count($totalsCollection->getItems()) < 1 || !$filterData->getData('from')) { $this->setTotals(new \Magento\Framework\Object()); $this->setCountTotals(false); } else { foreach ($totalsCollection->getItems() as $item) { $this->setTotals($item); break; } } } return parent::getCountTotals(); }