2014-10-05 76 views
0

我一直堅持向發貨網格的銷售訂單網格添加列。 問題是:DB中的「已購買」名稱爲「created_at」,「發貨日期」也有名稱「created_at」,因此當我從「sales_flat_shipment_grid」加入「created_at」時,我會看到僅在發貨日期購買日期。在_prepareCollection ()如何添加列日期已發貨到銷售訂單網格magento

$collection->getSelect()->joinLeft(array('sfsg'=>'sales_flat_shipment_grid'),'sfsg.order_increment_id=main_table.increment_id',array('sfsg.created_at')); 

和_prepareColumns()

$this->addColumn('created_at', array(
      'header' => Mage::helper('sales')->__('Date Shipped'), 
      'index'  => 'created_at', 
      'type'  => 'datetime', 
      'filter_index'=>'sfsg.created_at', 

     )); 

能否請你幫我這個: 我使用這個代碼?

回答

0

的努力,我發現在我的情況下,答案是幾個小時之後 在_prepareCollection()添加

$collection->getSelect()->joinLeft(array('sfsg'=>$resource->getTableName('sales_flat_shipment_grid')),'sfsg.order_increment_id=main_table.increment_id',array(

'shiped'=>新Zend_Db_Expr(「GROUP_CONCAT(sfsg.created_at分離機」| 「)'), ));

和_prepareColums()

$this->addColumn('shiped', array(
     'header' => Mage::helper('sales')->__('Date Shipped'), 
     'index'  => 'shiped', 
     'type'  => 'datetime', 
     'filter_index'=>'sfsg.created_at', 
      ));