本文實例講述了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_orderdarray 函式
//增加 '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; }
三、為了在後台管理的訂單內容中可以看到concontactone/contpal ment/ paypal目錄下
增加下面內容:
$output .= '<tr><td class="main">Contact Phone:</td>'; $output .= '<td class="main">'.$ipn->fields['contact_phone'].'</td></tr>';
希望本文所述對大家基於zend框架的PHP程式設計有所幫助。
更多zen cart實現訂單中增加paypal中預留電話的方法相關文章請關注PHP中文網!