Skip to content

Commit cc829c7

Browse files
author
Yaroslav Voronoy
committed
MDVA-189: Dashboard: Nothing is displayed if Use Aggregated Data setting is turned on
1 parent d6f6f70 commit cc829c7

File tree

1 file changed

+20
-7
lines changed
  • app/code/Magento/Backend/Helper/Dashboard

1 file changed

+20
-7
lines changed

app/code/Magento/Backend/Helper/Dashboard/Order.php

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Backend\Helper\Dashboard;
77

8+
use Magento\Framework\App\ObjectManager;
9+
810
/**
911
* Adminhtml dashboard helper for orders
1012
*/
@@ -23,15 +25,12 @@ class Order extends \Magento\Backend\Helper\Dashboard\AbstractDashboard
2325
/**
2426
* @param \Magento\Framework\App\Helper\Context $context
2527
* @param \Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection
26-
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
2728
*/
2829
public function __construct(
2930
\Magento\Framework\App\Helper\Context $context,
30-
\Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection,
31-
\Magento\Store\Model\StoreManagerInterface $storeManager
31+
\Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection
3232
) {
3333
$this->_orderCollection = $orderCollection;
34-
$this->_storeManager = $storeManager;
3534
parent::__construct(
3635
$context
3736
);
@@ -49,17 +48,31 @@ protected function _initCollection()
4948
if ($this->getParam('store')) {
5049
$this->_collection->addFieldToFilter('store_id', $this->getParam('store'));
5150
} elseif ($this->getParam('website')) {
52-
$storeIds = $this->_storeManager->getWebsite($this->getParam('website'))->getStoreIds();
51+
$storeIds = $this->getStoreManager()->getWebsite($this->getParam('website'))->getStoreIds();
5352
$this->_collection->addFieldToFilter('store_id', ['in' => implode(',', $storeIds)]);
5453
} elseif ($this->getParam('group')) {
55-
$storeIds = $this->_storeManager->getGroup($this->getParam('group'))->getStoreIds();
54+
$storeIds = $this->getStoreManager()->getGroup($this->getParam('group'))->getStoreIds();
5655
$this->_collection->addFieldToFilter('store_id', ['in' => implode(',', $storeIds)]);
5756
} elseif (!$this->_collection->isLive()) {
5857
$this->_collection->addFieldToFilter(
5958
'store_id',
60-
['eq' => $this->_storeManager->getStore(\Magento\Store\Model\Store::ADMIN_CODE)->getId()]
59+
['eq' => $this->getStoreManager()->getStore(\Magento\Store\Model\Store::ADMIN_CODE)->getId()]
6160
);
6261
}
6362
$this->_collection->load();
6463
}
64+
65+
/**
66+
* Get Store Manager
67+
*
68+
* @return \Magento\Store\Model\StoreManagerInterface
69+
*/
70+
public function getStoreManager()
71+
{
72+
if (!$this->_storeManager) {
73+
$this->_storeManager = ObjectManager::getInstance()->get('Magento\Store\Model\StoreManager');
74+
}
75+
76+
return $this->_storeManager;
77+
}
6578
}

0 commit comments

Comments
 (0)