要将运输信息添加到销售订单网格中,您必须覆盖 Mage_Adminhtml_Block_Sales_Order_Grid 类。为此创建您自己的模块。=> 在块部分的 config.xml 中
粘贴下面的 xml 代码
<globals>
<block>
<adminhtml>
<rewrite>
<sales_order_grid>Yourpackage_Yourmodule_Block_Sales_Order_Grid</sales_order_grid>
</rewrite>
</adminhtml>
</block>
<globals>
现在定义一个类 Yourpackage_Yourmodule_Block_Sales_Order_Grid 并将其放入 package_name/module_name/Block/Sales/Order/Grid.php
class Yourpackage_Yourmodule_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
{
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->
joinLeft('sales_flat_order', 'main_table.entity_id=sales_flat_order.entity_id', array("shipping_desc"=>"shipping_description"));
$this->setCollection($collection);
return $this;
}
protected function _prepareColumns()
{
$this->addColumnAfter('shipping_desc', array(
'header'=> Mage::helper('sales')->__('Shipping Descr #'),
'width' => '80px',
'type' => 'text',
'index' => 'shipping_desc',
),"real_order_id");
return parent::_prepareColumns();
}
}