Protected Member Functions | |
_construct () | |
_prepareLayout () |
Definition at line 35 of file Totals.php.
_construct | ( | ) | [protected] |
Internal constructor, that is called from real constructor
Please override this one instead of overriding real __construct constructor
Please override this one instead of overriding real __construct constructor
Reimplemented from Mage_Adminhtml_Block_Dashboard_Bar.
Definition at line 37 of file Totals.php.
00038 { 00039 parent::_construct(); 00040 00041 $this->setTemplate('dashboard/totalbar.phtml'); 00042 }
_prepareLayout | ( | ) | [protected] |
Preparing global layout
You can redefine this method in child classes for changin layout
Reimplemented from Mage_Adminhtml_Block_Dashboard_Abstract.
Definition at line 44 of file Totals.php.
00045 { 00046 $isFilter = $this->getRequest()->getParam('store') || $this->getRequest()->getParam('website') || $this->getRequest()->getParam('group'); 00047 00048 $collection = Mage::getResourceModel('reports/order_collection') 00049 ->calculateTotals($isFilter); 00050 00051 if ($this->getRequest()->getParam('store')) { 00052 $collection->addAttributeToFilter('store_id', $this->getRequest()->getParam('store')); 00053 } else if ($this->getRequest()->getParam('website')){ 00054 $storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds(); 00055 $collection->addAttributeToFilter('store_id', array('in' => $storeIds)); 00056 } else if ($this->getRequest()->getParam('group')){ 00057 $storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds(); 00058 $collection->addAttributeToFilter('store_id', array('in' => $storeIds)); 00059 } 00060 00061 $collection->load(); 00062 $collectionArray = $collection->toArray(); 00063 $totals = array_pop($collectionArray); 00064 00065 $this->addTotal($this->__('Revenue'), $totals['revenue']); 00066 $this->addTotal($this->__('Tax'), $totals['tax']); 00067 $this->addTotal($this->__('Shipping'), $totals['shipping']); 00068 $this->addTotal($this->__('Quantity'), $totals['quantity']*1, true); 00069 }