Public Member Functions | |
__construct () | |
getRowUrl ($row) | |
Protected Member Functions | |
_prepareCollection () | |
_prepareColumns () |
Definition at line 35 of file Grid.php.
__construct | ( | ) |
Setting default for every grid on dashboard
Reimplemented from Mage_Adminhtml_Block_Dashboard_Grid.
Definition at line 38 of file Grid.php.
00039 { 00040 parent::__construct(); 00041 $this->setId('lastOrdersGrid'); 00042 }
_prepareCollection | ( | ) | [protected] |
Prepare grid collection object
Reimplemented from Mage_Adminhtml_Block_Widget_Grid.
Definition at line 44 of file Grid.php.
00045 { 00046 //TODO: add full name logic 00047 $collection = Mage::getResourceModel('reports/order_collection') 00048 ->addItemCountExpr() 00049 ->addExpressionAttributeToSelect('customer', 00050 "IFNULL(CONCAT({{customer_firstname}},' ',{{customer_lastname}}), '{$this->__('Guest')}')", 00051 array('customer_firstname','customer_lastname') 00052 ) 00053 ->setOrder('created_at'); 00054 00055 if($this->getParam('store') || $this->getParam('website') || $this->getParam('group')) { 00056 if ($this->getParam('store')) { 00057 $collection->addAttributeToFilter('store_id', $this->getParam('store')); 00058 } else if ($this->getParam('website')){ 00059 $storeIds = Mage::app()->getWebsite($this->getParam('website'))->getStoreIds(); 00060 $collection->addAttributeToFilter('store_id', array('in' => $storeIds)); 00061 } else if ($this->getParam('group')){ 00062 $storeIds = Mage::app()->getGroup($this->getParam('group'))->getStoreIds(); 00063 $collection->addAttributeToFilter('store_id', array('in' => $storeIds)); 00064 } 00065 00066 $collection->addExpressionAttributeToSelect('revenue', 00067 '({{base_grand_total}})', 00068 array('base_grand_total')); 00069 } else { 00070 $collection->addExpressionAttributeToSelect('revenue', 00071 '({{base_grand_total}}/{{store_to_base_rate}})', 00072 array('base_grand_total', 'store_to_base_rate')); 00073 } 00074 00075 $this->setCollection($collection); 00076 00077 return parent::_prepareCollection(); 00078 }
_prepareColumns | ( | ) | [protected] |
Reimplemented from Mage_Adminhtml_Block_Widget_Grid.
Definition at line 80 of file Grid.php.
00081 { 00082 $this->addColumn('customer', array( 00083 'header' => $this->__('Customer'), 00084 'sortable' => false, 00085 'index' => 'customer' 00086 )); 00087 00088 $this->addColumn('items', array( 00089 'header' => $this->__('Items'), 00090 'align' => 'right', 00091 'sortable' => false, 00092 'index' => 'items_count' 00093 )); 00094 00095 $baseCurrencyCode = Mage::app()->getStore((int)$this->getParam('store'))->getBaseCurrencyCode(); 00096 00097 $this->addColumn('total', array( 00098 'header' => $this->__('Grand Total'), 00099 'align' => 'right', 00100 'sortable' => false, 00101 'type' => 'currency', 00102 'currency_code' => $baseCurrencyCode, 00103 'index' => 'revenue' 00104 )); 00105 00106 $this->setFilterVisibility(false); 00107 $this->setPagerVisibility(false); 00108 00109 return parent::_prepareColumns(); 00110 }
getRowUrl | ( | $ | row | ) |