Rumah > php教程 > PHP开发 > zen cart实现订单中增加paypal中预留电话的方法

zen cart实现订单中增加paypal中预留电话的方法

高洛峰
Lepaskan: 2017-01-05 11:38:31
asal
1718 orang telah melayarinya

本文实例讲述了zen cart实现订单中增加paypal中预留电话的方法。分享给大家供大家参考,具体如下:

在PayPal的IPN返回值中联系电话是 contact_phone, 前提是你帐户设定了买家在付款时预留电话,如果没有要求的话,该值默认是不会返回的。

但在zen cart的PAYPAL的支付插件里是不获取这个信息的,需要手动修改PAYPAL的程序。下面我们就修改:

一、在 paypal 表中增加 contact_phone 字段

ALTER TABLE `paypal` ADD `contact_phone` VARCHAR( 50 ) NULL COMMENT '电话'
Salin selepas log masuk

二、修改 paypal_functions.php 文件里的 ipn_create_order_array 函数

此文件在./includes/modules/payment/paypal目录下

//增加
'contact_phone' => $_POST['contact_phone'],
Salin selepas log masuk

修改后如下

/**
 * 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;
}
Salin selepas log masuk

三、为了在后台管理的订单内容里能看到contact_phone需要修改 paypal_admin_notification.php 文件

此文件在./includes/modules/payment/paypal目录下

增加下面内容:

$output .= &#39;<tr><td class="main">Contact Phone:</td>&#39;;
$output .= &#39;<td class="main">&#39;.$ipn->fields[&#39;contact_phone&#39;].&#39;</td></tr>&#39;;
Salin selepas log masuk

希望本文所述对大家基于zend框架的PHP程序设计有所帮助。

更多zen cart实现订单中增加paypal中预留电话的方法相关文章请关注PHP中文网!

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Cadangan popular
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan