在线建站培训
您的位置: 魔客吧 cms教程 ecshop教程 查看内容

给支付宝接口增加收货地址等参数,跳转到支付页不需再次填写地址 ...

2017-6-22 08:04 | 发布者: moke | 栏目:ecshop教程

适用范围:适用于中介担保支付(2.7版本)

官方的支付宝接口里没有挂地址,收货人,邮编等参数,从而到了支付页面还要填写一遍地址,收货人,比较的麻烦

增加地址,收货人参数后就不再重复劳动了。

修改以下地方:

1.flow.php

找到

[代码]php代码:

/* 插入支付日志 */$order['log_id'] = insert_pay_log($new_order_id, $order['order_amount'], PAY_ORDER);

在其后加入:

[代码]php代码:

/* 取得收货区域(国家/省份/城市等)*/$order['buyer_region'] = get_buyer_region($new_order_id);

在flow.php文件底部加入如下函数:

[代码]php代码:

/*** 取得收货地址区域名  2009-11-10* @param $order_id 订单号* @return string*/function get_buyer_region($order_id){    /* 取得区域名 */    $sql = "SELECT concat(IFNULL(c.region_name, ''),IFNULL(p.region_name, ''), " .                    " IFNULL(t.region_name, ''), IFNULL(d.region_name, '')) AS region " .                "FROM " . $GLOBALS['ecs']->table('order_info') . " AS o " .                    "LEFT JOIN " . $GLOBALS['ecs']->table('region') . " AS c ON o.country = c.region_id " .                    "LEFT JOIN " . $GLOBALS['ecs']->table('region') . " AS p ON o.province = p.region_id " .                    "LEFT JOIN " . $GLOBALS['ecs']->table('region') . " AS t ON o.city = t.region_id " .                    "LEFT JOIN " . $GLOBALS['ecs']->table('region') . " AS d ON o.district = d.region_id " .                "WHERE o.order_id = '$order_id'";    return $GLOBALS['db']->getOne($sql);}

2.includesmodulespaymentalipy.php

找到

[代码]php代码:

'seller_email'      => $payment['alipay_account'],

在其后增加如下配置:

[代码]php代码:

/* 收货人,地址信息*/'receive_name'         => $order['consignee'],'receive_address'    => $order['buyer_region'].$order['address'],'receive_zip'    => $order['zipcode'],

ps:地址是urldecode过的

官方原版的支付宝地址如下:

https://www.alipay.com/cooperate/gateway.do?_input_charset=utf-8&agent=C4335319945672464113&logistics_fee=0&logistics_payment=BUYER_PAY&logistics_type=EXPRESS¬ify_url=http://127.0.0.1/ecshop/respond.php?code=alipay&out_trade_no=200911105213010&partner=2088002692045431&payment_type=1&price=16.00&quantity=1&return_url=http://127.0.0.1/ecshop/[email protected]&service=trade_create_by_buyer&subject=2009111052130&sign=8894ebd13e248d043f90a6e0c41b6a68&sign_type=MD5

支付宝的地址就变成如下:

https://www.alipay.com/cooperate/gateway.do?_input_charset=utf-8&agent=C4335319945672464113&logistics_fee=0&logistics_payment=BUYER_PAY&logistics_type=EXPRESS¬ify_url=http://127.0.0.1/ecshop/respond.php?code=alipay&out_trade_no=200911105213010&partner=2088002692045431&payment_type=1&price=16.00&quantity=1&receive_address=中国广东深圳南山区竹子林1050号&receive_name=侯琳琳&receive_zip=8126743&return_url=http://127.0.0.1/ecshop/[email protected]&service=trade_create_by_buyer&subject=2009111052130&sign=8894ebd13e248d043f90a6e0c41b6a68&sign_type=MD5



魔客吧温馨提示:如果你想搭建一个电子商务商城网站,那么到魔客吧的 ecshop模板堂 频道看看吧,这里有很多的商城模板哦!

最新分享资源

最新评论

验证码 换一个