I have overridden the Mage_Adminhtml_Block_Sales_Order_Grid
to add additionl 3 columns as follows.
- Customer Email
- Payment Type
- Products ordered
My extended grid class is as follows.
<?php
class Wowmall_ExtendedGrid_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
{
protected function _getCollectionClass()
{
return 'sales/order_grid_collection';
}
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()
->joinLeft('sales_flat_order_payment', 'main_table.entity_id = sales_flat_order_payment.parent_id','method')
->join('customer_entity', 'main_table.customer_id = customer_entity.entity_id','email')
->join('sales_flat_order_item', 'main_table.entity_id = sales_flat_order_item.order_id','name')->distinct(true);
$collection->getSelect()->group('main_table.entity_id');
$this->setCollection($collection);
return $this;
}
protected function _prepareColumns()
{
// rest code...
$this->addColumn('email', array(
'header' => Mage::helper('sales')->__('Customer Email'),
'index' => 'email',
'type' => 'text',
));
$this->addColumn('method', array(
'header' => Mage::helper('sales')->__('Payment Type'),
'index' => 'method',
'type' => 'options',
'options' => array('verisign' => 'Credit Card', 'checkmo' => 'Check', 'purchaseorder' => 'Purchase Order'),
));
$this->addColumn('name', array(
'header' => Mage::helper('sales')->__('Product(s) Ordered'),
'index' => 'name',
'type' => 'text',
));
// rest code...
But the pagination is not working. All the records are loading in a single page. Please any suggestions?