Magento 订单后台增加支付接口来源列

在后台订单列表上增加支付方式,让客服工作更轻松,一眼就看出是哪个支付接口的了

1.3.2.4以前的版本,是修改app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php

protected function _prepareCollection()
{
$tablePre= (string)Mage::getConfig()->getTablePrefix();
//TODO: add full name logic
$res = Mage::getResourceModel(“sales/order_payment”);
$paymentWhere = array(“entity_type_id” => $res->getTypeId());
$attributes =$res->loadAllAttributes()->getAttributesByCode();
foreach ($attributes as $attrCode=>$attr) {
if ($attr->getAttributeCode()==”method”){
$attId = $attr->getAttributeId();
}
}
$paymentMethodWhere = “{{table}}.attribute_id = ‘$attId’”;
         $collection = Mage::getResourceModel(‘sales/order_collection’)
->addAttributeToSelect(‘*’)
->joinAttribute(‘billing_firstname’, ‘order_address/firstname’, ‘billing_address_id’, null, ‘left’)
->joinAttribute(‘billing_lastname’, ‘order_address/lastname’, ‘billing_address_id’, null, ‘left’)
->joinAttribute(‘shipping_firstname’, ‘order_address/firstname’, ‘shipping_address_id’, null, ‘left’)
->joinAttribute(‘shipping_lastname’, ‘order_address/lastname’, ‘shipping_address_id’, null, ‘left’)
  ->joinTable($tablePre . ‘sales_order_entity’, ‘parent_id=entity_id’, array( ‘quote_payment_id_for_join’ => ‘entity_id’ ) , $paymentWhere, ‘left’ )
->joinTable($tablePre.’sales_order_entity_varchar’, ‘entity_id=quote_payment_id_for_join’, array( ‘payment’ => ‘value’ ) , $paymentMethodWhere, ‘left’ )
            ->addExpressionAttributeToSelect(‘billing_name’,
‘CONCAT({{billing_firstname}}, ” “, {{billing_lastname}})’,
array(‘billing_firstname’, ‘billing_lastname’))
->addExpressionAttributeToSelect(‘shipping_name’,
‘CONCAT({{shipping_firstname}}, ” “, {{shipping_lastname}})’,
array(‘shipping_firstname’, ‘shipping_lastname’));
$this->setCollection($collection);
return parent::_prepareCollection();
}

然后增加列:
protected function _prepareColumns()
{
$this->addColumn(‘real_order_id’, array(
‘header’=> Mage::helper(‘sales’)->__(‘Order #’),
‘width’ => ’80px’,
‘type’  => ‘text’,
‘index’ => ‘increment_id’,
));
    $this->addColumn(‘payment’, array(
‘header’ => Mage::helper(‘sales’)->__(‘Payment’),
‘index’ => ‘payment’,
‘sortable’  => false,
));

1.4.2.0 1.5.1.0是修改app\code\core\Mage\Adminhtml\Block\Sales\Order\Grid.php

protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
  $collection->getSelect()->joinLeft(array(‘payments’ => $collection->getTable(‘sales/order_payment’)),
‘payments.parent_id = main_table.entity_id’,
‘method’
);
$this->setCollection($collection);
return parent::_prepareCollection();
}
protected function _prepareColumns()
{
$this->addColumn(‘real_order_id’, array(
‘header’=> Mage::helper(‘sales’)->__(‘Order #’),
‘width’ => ’80px’,
‘type’  => ‘text’,
‘index’ => ‘increment_id’,
));
if (!Mage::app()->isSingleStoreMode()) {
$this->addColumn(‘store_id’, array(
‘header’    => Mage::helper(‘sales’)->__(‘Purchased From (Store)’),
‘index’     => ‘store_id’,
‘type’      => ‘store’,
‘store_view’=> true,
‘display_deleted’ => true,
));
}
$this->addColumn(‘created_at’, array(
‘header’ => Mage::helper(‘sales’)->__(‘Purchased On’),
‘index’ => ‘created_at’,
‘type’ => ‘datetime’,
‘width’ => ’100px’,
));
  $this->addColumn(‘payments’, array(
‘header’ => Mage::helper(‘sales’)->__(‘payments’),
‘index’ => ‘method’,
));


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值