ECSHOP2.72 前台调用 定单号,及收货人,快递号

本文介绍了一个关于发票查询函数的改进方案,通过修改SQL查询语句增加了收货人、收货省份及城市的显示功能。

原来的index_get_invoice_query函数调用时没有调用收货人和收货的省及城市,稍微做一下改进就可以实现在首页订单调用中显示收货人及收货的地区

把index.php中的

/**
* 调用发货单查询
*
* @access private
* @return array
*/
function index_get_invoice_query()
{
$sql = 'SELECT o.order_sn, o.invoice_no, s.shipping_code FROM ' . $GLOBALS['ecs']->table('order_info') . ' AS o' .
' LEFT JOIN ' . $GLOBALS['ecs']->table('shipping') . ' AS s ON s.shipping_id = o.shipping_id' .
" WHERE invoice_no > '' AND shipping_status = " . SS_SHIPPED .
' ORDER BY shipping_time DESC LIMIT 10';
$all = $GLOBALS['db']->getAll($sql);

foreach ($all AS $key => $row)
{
$plugin = ROOT_PATH . 'includes/modules/shipping/' . $row['shipping_code'] . '.php';

if (file_exists($plugin))
{
include_once($plugin);

$shipping = new $row['shipping_code'];
$all[$key]['invoice_no'] = $shipping->query((string)$row['invoice_no']);
}
}

clearstatcache();

return $all;
}

改成:

/**
* 调用发货单查询
*
* @access private
* @return array
*/
function index_get_invoice_query()
{
$sql = 'SELECT o.order_sn, o.consignee, o.invoice_no, s.shipping_code,r1.region_name  as provice-name,r2.region_name as city_name FROM ' . $GLOBALS['ecs']->table('order_info') . ' AS o' .
' LEFT JOIN ' . $GLOBALS['ecs']->table('shipping') . ' AS s ON s.shipping_id = o.shipping_id' .
' LEFT JOIN ' . $GLOBALS['ecs']->table('region') . ' AS r1 ON r1.region_id = o.province' .
' LEFT JOIN ' . $GLOBALS['ecs']->table('region') . ' AS r2 ON r2.region_id = o.city' .
" WHERE invoice_no > '' AND shipping_status = " . SS_SHIPPED .
' ORDER BY shipping_time DESC LIMIT 10';
$all = $GLOBALS['db']->getAll($sql);

foreach ($all AS $key => $row)
{
$plugin = ROOT_PATH . 'includes/modules/shipping/' . $row['shipping_code'] . '.php';

if (file_exists($plugin))
{
include_once($plugin);

$shipping = new $row['shipping_code'];
$all[$key]['invoice_no'] = $shipping->query((string)$row['invoice_no']);
}
}

clearstatcache();

return $all;
}

这样就可以在invoice_list.lbi中增加显示收货人及收货地址

转载于:https://www.cnblogs.com/wangblognet/archive/2012/12/12/2814831.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值