Home > php教程 > PHP开发 > body text

Zen cart implements the method of adding a reserved phone number in paypal to the order

高洛峰
Release: 2017-01-05 11:38:31
Original
1621 people have browsed it

The example of this article describes the method of zen cart adding a reserved phone number in paypal to the order. Share it with everyone for your reference. The details are as follows:

The contact number in the IPN return value of PayPal is contact_phone. The premise is that your account has set the buyer to reserve a phone number when paying. If there is no requirement, the Values ​​are not returned by default.

But this information is not obtained in the PAYPAL payment plug-in of zen cart. You need to manually modify the PAYPAL program. Next we will modify:

1. Add the contact_phone field in the paypal table

ALTER TABLE `paypal` ADD `contact_phone` VARCHAR( 50 ) NULL COMMENT '电话'
Copy after login

2. Modify the ipn_create_order_array function in the paypal_functions.php file

This file is in the ./includes/modules/payment/paypal directory

//增加
'contact_phone' => $_POST['contact_phone'],
Copy after login

After modification, it is as follows

/**
 * 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;
}
Copy after login

3. In order to see contact_phone in the order content of the background management, you need to modify the paypal_admin_notification.php file

This file is in the ./includes/modules/payment/paypal directory Add the following content under

:

$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;;
Copy after login

I hope this article will be helpful to everyone’s PHP program design based on the zend framework.

For more related articles on zen cart’s method of adding a reserved phone number in paypal to the order, please pay attention to the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!