我們有一個包含交貨日期的表格,我想將其添加到sales/order/grid中的adminhtml中。 我遇到的問題是左連接示例不爲我工作,我沒有選擇。在magento中創建自定義集合
Mage/Adminhtml/Block/Sales/Order/Grid.php
方法IM現在正試圖爲創造_prepareCollection())自定義查詢
$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_read');
$query = 'SELECT * FROM mage_sales_flat_order_grid
left join mage_aw_deliverydate_delivery
on mage_sales_flat_order_grid.entity_id =
mage_aw_deliverydate_delivery.order_id';
$collection = $readConnection->fetchAll($query);
//$collection = Mage::getResourceModel($this->_getCollectionClass());
//$this->setCollection($collection);
return parent::_prepareCollection();
然後我_prepareColumns添加此列碼(
$this->addColumn('delivery_date', array(
'header' => 'delivery_date',
'index' => 'delivery_date',
'type' => 'datetime',
'width' => '100px',
));
當我查看後臺中的訂單網格時,我甚至沒有看到新的列。
任何幫助表示讚賞!
? –
我如何做到這一點
– SinisterGlitch請檢查答案 –