Mage_Adminhtml_Block_Dashboard_Sales Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Dashboard_Sales:

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 Sales.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 Sales.php.

00038     {
00039         parent::_construct();
00040         $this->setTemplate('dashboard/salebar.phtml');
00041 
00042 
00043     }

_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 45 of file Sales.php.

00046     {
00047         $isFilter = $this->getRequest()->getParam('store') || $this->getRequest()->getParam('website') || $this->getRequest()->getParam('group');
00048 
00049         $collection = Mage::getResourceModel('reports/order_collection')
00050             ->calculateSales($isFilter);
00051 
00052         if ($this->getRequest()->getParam('store')) {
00053             $collection->addAttributeToFilter('store_id', $this->getRequest()->getParam('store'));
00054         } else if ($this->getRequest()->getParam('website')){
00055             $storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
00056             $collection->addAttributeToFilter('store_id', array('in' => $storeIds));
00057         } else if ($this->getRequest()->getParam('group')){
00058             $storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
00059             $collection->addAttributeToFilter('store_id', array('in' => $storeIds));
00060         }
00061 
00062         $collection->load();
00063         $collectionArray = $collection->toArray();
00064         $sales = array_pop($collectionArray);
00065 
00066         $this->addTotal($this->__('Lifetime Sales'), $sales['lifetime']);
00067         $this->addTotal($this->__('Average Orders'), $sales['average']);
00068     }


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