Mage_Adminhtml_Block_Dashboard_Totals Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Dashboard_Totals:

Mage_Adminhtml_Block_Dashboard_Bar Mage_Adminhtml_Block_Dashboard_Abstract Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Protected Member Functions

 _construct ()
 _prepareLayout ()


Detailed Description

Definition at line 35 of file Totals.php.


Member Function Documentation

_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

Returns:
Mage_Core_Block_Abstract

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     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:22:49 2009 for Magento by  doxygen 1.5.8