出荷情報を販売注文グリッドに追加するには、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();
}
}