【问题标题】:How to add column Date Shipped to Sales Order Grid magento如何将列发货日期添加到销售订单网格 magento
【发布时间】:2014-10-05 17:34:53
【问题描述】:

我无法从发货网格向销售订单网格添加列。 问题是:DB 中的“Purchased On”名称为“created_at”,“Date Shipped”也名称为“created_at”,所以当我从“sales_flat_shipment_grid”加入“created_at”时,我看到仅在日期上购买,名称为发货日期。 我正在使用这段代码: 在 _prepareCollection() 中

$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',

       ));

你能帮我解决这个问题吗?

【问题讨论】:

    标签: magento


    【解决方案1】:

    经过几个小时的尝试,我找到了答案: 在 _prepareCollection() 中添加

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

    'shiped' => new Zend_Db_Expr('group_concat(sfsg.created_at SEPARATOR " | ")'), ));

    在 _prepareColums() 中

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-07
      相关资源
      最近更新 更多