1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34: class Mage_Adminhtml_Helper_Dashboard_Order extends Mage_Adminhtml_Helper_Dashboard_Abstract
35: {
36:
37: protected function _initCollection()
38: {
39: $isFilter = $this->getParam('store') || $this->getParam('website') || $this->getParam('group');
40:
41: $this->_collection = Mage::getResourceSingleton('reports/order_collection')
42: ->prepareSummary($this->getParam('period'), 0, 0, $isFilter);
43:
44: if ($this->getParam('store')) {
45: $this->_collection->addFieldToFilter('store_id', $this->getParam('store'));
46: } else if ($this->getParam('website')){
47: $storeIds = Mage::app()->getWebsite($this->getParam('website'))->getStoreIds();
48: $this->_collection->addFieldToFilter('store_id', array('in' => implode(',', $storeIds)));
49: } else if ($this->getParam('group')){
50: $storeIds = Mage::app()->getGroup($this->getParam('group'))->getStoreIds();
51: $this->_collection->addFieldToFilter('store_id', array('in' => implode(',', $storeIds)));
52: } elseif (!$this->_collection->isLive()) {
53: $this->_collection->addFieldToFilter('store_id',
54: array('eq' => Mage::app()->getStore(Mage_Core_Model_Store::ADMIN_CODE)->getId())
55: );
56: }
57:
58:
59:
60: $this->_collection->load();
61: }
62:
63: }
64: