I'm trying to add a new columns to Magento's sales order grid. I tried following the instructions located here: http://www.atwix.com/magento/customize-orders-grid/
This method is working when i use it in my installed magento in localhost but didn't work for the magento hosted in another server (even for deleting a column nothing changed in that grid).
Also when i install an extension to customise my order grid it didn't work (The grid didn't even display but work normal in my localhost version)
Is there an explanation for this or another method to edit my order grid ?
I hope my question is clear and thank you for your help.
This is the main functions (_prepareCollection and _prepareCollection) in /app/code/local/Mage/Adminhtml/Block/Sales/Order/Grid.php:
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->join('cd_sales_flat_order', 'main_table.entity_id = cd_sales_flat_order.entity_id',array('shipping_description'));
$collection->getSelect()->join('cd_sales_flat_order_address', 'main_table.entity_id = cd_sales_flat_order_address.parent_id',array('postcode'));
$this->setCollection($collection);
return parent::_prepareCollection();
}
protected function _prepareColumns()
{
$this->addColumn('shipping_method', array(
'header' => Mage::helper('sales')->__('Shipping Method'),
'index' => 'shipping_description',
));
$this->addColumn('postcode', array(
'header' => Mage::helper('sales')->__('Postcode'),
'index' => 'postcode',
));
$this->addColumn('real_order_id', array(
'header'=> Mage::helper('sales')->__('Order #'),
'width' => '80px',
'type' => 'text',
'index' => 'increment_id',
));
if (!Mage::app()->isSingleStoreMode()) {
$this->addColumn('store_id', array(
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
'index' => 'store_id',
'type' => 'store',
'store_view'=> true,
'display_deleted' => true,
));
}
$this->addColumn('created_at', array(
'header' => Mage::helper('sales')->__('Purchased On'),
'index' => 'created_at',
'type' => 'datetime',
'width' => '100px',
));
$this->addColumn('billing_name', array(
'header' => Mage::helper('sales')->__('Bill to Name'),
'index' => 'billing_name',
));
$this->addColumn('base_grand_total', array(
'header' => Mage::helper('sales')->__('G.T. (Base)'),
'index' => 'base_grand_total',
'type' => 'currency',
'currency' => 'base_currency_code',
));
$this->addColumn('grand_total', array(
'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
'index' => 'grand_total',
'type' => 'currency',
'currency' => 'order_currency_code',
));
$this->addColumn('status', array(
'header' => Mage::helper('sales')->__('Status'),
'index' => 'status',
'type' => 'options',
'width' => '70px',
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
));
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
$this->addColumn('action',
array(
'header' => Mage::helper('sales')->__('Action'),
'width' => '50px',
'type' => 'action',
'getter' => 'getId',
'actions' => array(
array(
'caption' => Mage::helper('sales')->__('View'),
'url' => array('base'=>'*/sales_order/view'),
'field' => 'order_id',
'data-column' => 'action',
)
),
'filter' => false,
'sortable' => false,
'index' => 'stores',
'is_system' => true,
));
}
$this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
$this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
return parent::_prepareColumns();
}