Mage_Adminhtml_Block_Dashboard_Tab_Customers_Most Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Dashboard_Tab_Customers_Most:

Mage_Adminhtml_Block_Dashboard_Grid Mage_Adminhtml_Block_Widget_Grid Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 getRowUrl ($row)

Protected Member Functions

 _prepareCollection ()
 _prepareColumns ()


Detailed Description

Definition at line 35 of file Most.php.


Constructor & Destructor Documentation

__construct (  ) 

Setting default for every grid on dashboard

Reimplemented from Mage_Adminhtml_Block_Dashboard_Grid.

Definition at line 38 of file Most.php.

00039     {
00040         parent::__construct();
00041         $this->setId('customersMostGrid');
00042     }


Member Function Documentation

_prepareCollection (  )  [protected]

Prepare grid collection object

Returns:
this

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 44 of file Most.php.

00045     {
00046         $collection = Mage::getResourceModel('reports/order_collection');
00047         /* @var $collection Mage_Reports_Model_Mysql4_Order_Collection */
00048         $collection
00049             ->groupByCustomer()
00050             ->addOrdersCount()
00051             ->joinCustomerName();
00052 
00053         $storeFilter = 0;
00054         if ($this->getParam('store')) {
00055             $collection->addAttributeToFilter('store_id', $this->getParam('store'));
00056             $storeFilter = 1;
00057         } else if ($this->getParam('website')){
00058             $storeIds = Mage::app()->getWebsite($this->getParam('website'))->getStoreIds();
00059             $collection->addAttributeToFilter('store_id', array('in' => $storeIds));
00060         } else if ($this->getParam('group')){
00061             $storeIds = Mage::app()->getGroup($this->getParam('group'))->getStoreIds();
00062             $collection->addAttributeToFilter('store_id', array('in' => $storeIds));
00063         }
00064 
00065         $collection->addSumAvgTotals($storeFilter)
00066             ->orderByTotalAmount();
00067 
00068         $this->setCollection($collection);
00069 
00070         return parent::_prepareCollection();
00071     }

_prepareColumns (  )  [protected]

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 73 of file Most.php.

00074     {
00075         $this->addColumn('name', array(
00076             'header'    => $this->__('Customer Name'),
00077             'sortable'  => false,
00078             'index'     => 'name'
00079         ));
00080 
00081         $this->addColumn('orders_count', array(
00082             'header'    => $this->__('Number of Orders'),
00083             'sortable'  => false,
00084             'index'     => 'orders_count',
00085             'type'      => 'number'
00086         ));
00087 
00088         $baseCurrencyCode = (string) Mage::app()->getStore((int)$this->getParam('store'))->getBaseCurrencyCode();
00089 
00090         $this->addColumn('orders_avg_amount', array(
00091             'header'    => $this->__('Average Order Amount'),
00092             'align'     => 'right',
00093             'sortable'  => false,
00094             'type'      => 'currency',
00095             'currency_code'  => $baseCurrencyCode,
00096             'index'     => 'orders_avg_amount'
00097         ));
00098 
00099         $this->addColumn('orders_sum_amount', array(
00100             'header'    => $this->__('Total Order Amount'),
00101             'align'     => 'right',
00102             'sortable'  => false,
00103             'type'      => 'currency',
00104             'currency_code'  => $baseCurrencyCode,
00105             'index'     => 'orders_sum_amount'
00106         ));
00107 
00108         $this->setFilterVisibility(false);
00109         $this->setPagerVisibility(false);
00110 
00111         return parent::_prepareColumns();
00112     }

getRowUrl ( row  ) 

Definition at line 114 of file Most.php.

00115     {
00116         return $this->getUrl('*/customer/edit', array('id'=>$row->getCustomerId()));
00117     }


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