我想在订单中添加另外一个字段,即客户订购的数量 - >装运部分。有人可以帮我解决这个问题。
此致 Vishavdeep Goyal
答案 0 :(得分:0)
我不知道您希望如何选择"客户订购的数量" from,但下面的示例显示了如何在Shipment网格中显示total_qty_ordered字段sales_flat_order表:
1)将文件app / code / core / Mage / Adminhtml / Block / Sales / Shipment / Grid.php复制到app / code / local / Mage / Adminhtml / Block / Sales / Shipment / Grid.php
2)修改_prepareCollection()方法
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->joinLeft(array('order' => Mage::getSingleton('core/resource')->getTableName('sales_flat_order')), 'main_table.entity_id = order.entity_id', 'total_qty_ordered');
$this->setCollection($collection);
return parent::_prepareCollection();
}
2)修改_prepareColumns()方法和以下代码
$this->addColumn('total_qty_ordered', array(
'header' => Mage::helper('sales')->__('Total Qty Ordered'),
'index' => 'total_qty_ordered',
'type' => 'number',
));