_orderCollection = $orderCollection; parent::__construct($context); } /** * The getter function to get the new StoreManager dependency * * @return \Magento\Store\Model\StoreManagerInterface * * @deprecated */ private function getStoreManager() { if ($this->_storeManager === null) { $this->_storeManager = ObjectManager::getInstance()->get('Magento\Store\Model\StoreManagerInterface'); } return $this->_storeManager; } /** * @return void */ protected function _initCollection() { $isFilter = $this->getParam('store') || $this->getParam('website') || $this->getParam('group'); $this->_collection = $this->_orderCollection->prepareSummary($this->getParam('period'), 0, 0, $isFilter); if ($this->getParam('store')) { $this->_collection->addFieldToFilter('store_id', $this->getParam('store')); } elseif ($this->getParam('website')) { $storeIds = $this->getStoreManager()->getWebsite($this->getParam('website'))->getStoreIds(); $this->_collection->addFieldToFilter('store_id', ['in' => implode(',', $storeIds)]); } elseif ($this->getParam('group')) { $storeIds = $this->getStoreManager()->getGroup($this->getParam('group'))->getStoreIds(); $this->_collection->addFieldToFilter('store_id', ['in' => implode(',', $storeIds)]); } elseif (!$this->_collection->isLive()) { $this->_collection->addFieldToFilter( 'store_id', ['eq' => $this->getStoreManager()->getStore(\Magento\Store\Model\Store::ADMIN_CODE)->getId()] ); } $this->_collection->load(); } }