本文实例讲述了zen cart实现订单中增加paypal中预留电话的方法。分享给大家供大家参考,具体如下:
在paypal的ipn返回值中联系电话是 contact_phone, 前提是你帐户设定了买家在付款时预留电话,如果没有要求的话,该值默认是不会返回的。
但在zen cart的paypal的支付插件里是不获取这个信息的,需要手动修改paypal的程序。下面我们就修改:
一、在 paypal 表中增加 contact_phone 字段
alter table `paypal` add `contact_phone` varchar( 50 ) null comment '电话'
二、修改 paypal_functions.php 文件里的 ipn_create_order_array 函数
此文件在./includes/modules/payment/paypal目录下
//增加 'contact_phone' => $_post['contact_phone'],
修改后如下
/**
* create order record from ipn data
*/
function ipn_create_order_array($new_order_id, $txn_type) {
$sql_data_array = array('order_id' => $new_order_id,
'txn_type' => $txn_type,
'module_name' => 'paypal (ipn-handler)',
'module_mode' => 'ipn',
'reason_code' => $_post['reason_code'],
'payment_type' => $_post['payment_type'],
'payment_status' => $_post['payment_status'],
'pending_reason' => $_post['pending_reason'],
'invoice' => $_post['invoice'],
'mc_currency' => $_post['mc_currency'],
'first_name' => $_post['first_name'],
'last_name' => $_post['last_name'],
'payer_business_name' => $_post['payer_business_name'],
'contact_phone' => $_post['contact_phone'],
'address_name' => $_post['address_name'],
'address_street' => $_post['address_street'],
'address_city' => $_post['address_city'],
'address_state' => $_post['address_state'],
'address_zip' => $_post['address_zip'],
'address_country' => $_post['address_country'],
'address_status' => $_post['address_status'],
'payer_email' => $_post['payer_email'],
'payer_id' => $_post['payer_id'],
'payer_status' => $_post['payer_status'],
'payment_date' => datetime_to_sql_format($_post['payment_date']),
'business' => $_post['business'],
'receiver_email' => $_post['receiver_email'],
'receiver_id' => $_post['receiver_id'],
'txn_id' => $_post['txn_id'],
'parent_txn_id' => $_post['parent_txn_id'],
'num_cart_items' => $_post['num_cart_items'],
'mc_gross' => $_post['mc_gross'],
'mc_fee' => $_post['mc_fee'],
'settle_amount' => $_post['settle_amount'],
'settle_currency' => $_post['settle_currency'],
'exchange_rate' => $_post['exchange_rate'],
'notify_version' => $_post['notify_version'],
'verify_sign' => $_post['verify_sign'],
'date_added' => 'now()',
'memo' => $_post['memo']
);
return $sql_data_array;
}
三、为了在后台管理的订单内容里能看到contact_phone需要修改 paypal_admin_notification.php 文件
此文件在./includes/modules/payment/paypal目录下
增加下面内容:
$output .= '<tr><td class="main">contact phone:</td>'; $output .= '<td class="main">'.$ipn->fields['contact_phone'].'</td></tr>';
更多关于zend framework相关内容感兴趣的读者可查看本站专题:《zend framework框架入门教程》、《thinkphp入门教程》、《thinkphp常用方法总结》、《smarty模板入门基础教程》及《php模板技术总结》。
希望本文所述对大家基于zend框架的php程序设计有所帮助。
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!