1. rewrite the grid block file
<global>
<blocks>
<adminhtml>
<rewrite>
<sales_order_grid>Raveinfosys_Deleteorder_Block_Adminhtml_Sales_Order_Grid</sales_order_grid>
</rewrite>
2. edit _prepareCollection function to left join ·sales_flat_order· table
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->joinLeft(array('b'=>'sales_flat_order'),'b.entity_id = main_table.entity_id',array('shipping_description'));
$this->setCollection($collection);
return parent::_prepareCollection();
}
3.add a 'shipping_description' column to _prepareColumns()function
$this->addColumn('shipping_description', array(
'header' => Mage::helper('sales')->__('Shipping Method'),
'index' => 'shipping_description'
));

本文详细阐述了如何重构电商订单网格文件,包括重写gridblockfile,编辑prepareCollection函数以左连接销售扁平订单表,并在prepareColumns中添加物流描述列,以提升订单管理效率。
1万+

被折叠的 条评论
为什么被折叠?



