search
Homephp教程PHP开发Zen cart implements the method of adding a reserved phone number in paypal to the order

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 '电话'

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'],

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;
}

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;;

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!

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools