Mage_Adminhtml_Block_Dashboard_Tab_Customers_Newest Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Dashboard_Tab_Customers_Newest:

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

00039     {
00040         parent::__construct();
00041         $this->setId('customersNewestGrid');
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 Newest.php.

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

_prepareColumns (  )  [protected]

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 71 of file Newest.php.

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

getRowUrl ( row  ) 

Definition at line 114 of file Newest.php.

00115     {
00116         return $this->getUrl('*/customer/edit', array('id'=>$row->getId()));
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