【ecshop教程】ECSHOP后台订单列表显示收货人真实IP地理位置

各位ECSHOP网店系统用户大家好,欢迎来到ecshop教程图文教程,今天为大家详细解说一下ECSHOP后台订单列表显示收货人真实IP地理位置  

ECSHOP教程网ECSHOP视频教程也再不断的完善与跟进,期待大家的关注!希望在ECSHOP的道路上,ECSHOP教程网与您一路同行!


效果如图:



开发前,请先阅读本站文章《ECSHOP最新IP库版本升级补丁》,按照该文章的步骤做好准备工作,升级ECSHOP自带的陈旧的IP库。

安装指南

第一步:将安装文件覆盖到网站根目录(覆盖前注意备份)。下载安装文件:《db_119.zip》

第二步:输入”站点路径/db_119.php”,如”http://www.ecshop119.com/db_119.php”一键完成安装,安装完成后,请立即删除db_119.php。


第三步:编辑/admin/order.php,添加查询IP


大概在:5041行

/* 查询 */
$sql = "SELECT o.order_id, o.order_sn, o.add_time, o.order_status, o.shipping_status, o.order_amount, o.money_paid, o.ip_address," .
"o.pay_status, o.consignee, o.address, o.email, o.tel, o.extension_code, o.extension_id, " .
"(" . order_amount_field('o.') . ") AS total_fee, " .
"IFNULL(u.user_name, '" .$GLOBALS['_LANG']['anonymous']. "') AS buyer ".
" FROM " . $GLOBALS['ecs']->table('order_info') . " AS o " .
" LEFT JOIN " .$GLOBALS['ecs']->table('users'). " AS u ON u.user_id=o.user_id ". $where .



继续添加大概在5065行:


/* 格式话数据 */

foreach ($row AS $key => $value)

{

$row[$key]['formated_order_amount'] = price_format($value['order_amount']);

$row[$key]['formated_money_paid'] = price_format($value['money_paid']);

$row[$key]['formated_total_fee'] = price_format($value['total_fee']);

$row[$key]['short_order_time'] = local_date('m-d H:i', $value['add_time']);

$ip_area = ecs_geoip($row[$key]['ip_address']); //获取IP对应的地理位置

empty($row[$key]['ip_address']) ? '' : $row[$key]['ip_address'] .= ' [ ' . $ip_area . ' ]';

if ($value['order_status'] == OS_INVALID || $value['order_status'] == OS_CANCELED)




第四步:编辑/admin/templates/order_list.htm,添加显示IP


大概32行左右:

    <th><a href="javascript:listTable.sort('add_time', 'DESC'); ">{$lang.order_time}</a>{$sort_order_time}</th>
    <th><a href="javascript:listTable.sort('consignee', 'DESC'); ">{$lang.consignee}</a>{$sort_consignee}</th>
        <th><a href="javascript:listTable.sort('ip_address', 'DESC'); ">{$lang.ip_address}</a>{$sort_ip_address}</th>
    <th><a href="javascript:listTable.sort('total_fee', 'DESC'); ">{$lang.total_fee}</a>{$sort_total_fee}</th>

    <th><a href="javascript:listTable.sort('order_amount', 'DESC'); ">{$lang.order_amount}</a>{$sort_order_amount}</th>


大概45-46行左右:

<td align="left" valign="top" nowrap="nowrap">{$order.ip_address}</td> 


如图:


第五步:编辑/admin/languages/zh_cn/order.php,添加语言项


$_LANG['ip_address'] = 'IP地址';



第六步:编辑/flow.php,添加获取IP并插入数据库


$order = array(
'ip_address'      => real_ip(),
'shipping_id'     => intval($_POST['shipping']),
'pay_id'          => intval($_POST['payment']),


如图:





大功告成,赶快下个新的订单看看效果吧!


版权声明:本文来源于互联网,如有侵权,请联系下方邮箱,一个工作日删除!