


zen_cart implements the method of generating orders before payment
This article mainly introduces the method of zen_cart to generate orders before payment. It analyzes in detail the specific steps and related implementation techniques of zen_cart to generate orders before payment in the form of examples. Friends in need can refer to this article
The example describes how zen_cart implements the method of generating orders before payment. Share it with everyone for your reference, the details are as follows:
In addition to paypal, customers can place orders by entering the index.php?main_page=checkout_confirmation page through other payment methods.
But!! Paypal It is a bit different. It can only place an order after returning from its official website [paypal.com] and entering the checkout_process page.
But accidents often happen: for example, the network is not smooth. Another example is the customer's failure. Be careful to close the page before returning.
Then, our website backend will not be able to see what product the customer bought (although you can see who bought it in the paypal backend, but there is really no way to know who bought it. What did you buy?) This is a very depressing thing.
The principle of paypal’s anti-leakage order is to place an order on the checkout_confirmation.php page!!!
The method is: copy the code
at the last part of this file
##The code is as follows:
echo TITLE_CONTINUE_CHECKOUT_PROCEDURE . '<br />' . TEXT_CONTINUE_CHECKOUT_PROCEDURE;
// create the order record 防漏单 if ($_SESSION['payment'] == 'paypal') { $insert_id = $order->create($order_totals, 2); $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_CREATE'); $payment_modules->after_order_create($insert_id); $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_PAYMENT_MODULES_AFTER_ORDER_CREATE'); // store the product info to the order $order->create_add_products($insert_id); $_SESSION['order_number_created'] = $insert_id;
if($_SESSION['payment']!='paypal'){ /*// create the order record $insert_id = $order->create($order_totals, 2); $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_CREATE'); $payment_modules->after_order_create($insert_id); $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_PAYMENT_MODULES_AFTER_ORDER_CREATE'); // store the product info to the order $order->create_add_products($insert_id); $_SESSION['order_number_created'] = $insert_id; $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_CREATE_ADD_PRODUCTS'); //send email notifications $order->send_order_email($insert_id, 2); $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL');*/ }
// create the order record 防漏单 if ($_SESSION['payment'] == 'paypal' and !isset($_SESSION['order_number_created'])) { $insert_id = $order->create($order_totals, 2); $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_CREATE'); $payment_modules->after_order_create($insert_id); $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_PAYMENT_MODULES_AFTER_ORDER_CREATE'); // store the product info to the order $order->create_add_products($insert_id); $_SESSION['order_number_created'] = $insert_id; }
unset($_SESSION['order_number_created']);
$_SESSION['order_number_created']
#The order is no longer generated.
If the customer returns to modify the shopping cart, $_SESSION['order_number_created'] will be cleared when the checkout_payment is reached again.
In fact, it is generated The order code can be written in the function confirmation() of modules/payment/paypal.php.
The code is as follows:
function confirmation() { if(!isset($_SESSION['order_number_created'])) { global $order,$order_total_modules,$order_totals,$zco_notifier,$insert_id; $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_BEGIN'); // if the customer is not logged on, redirect them to the time out page if (!$_SESSION['customer_id']) { zen_redirect(zen_href_link(FILENAME_TIME_OUT)); } else { // validate customer if (zen_get_customer_validate_session($_SESSION['customer_id']) == false) { $_SESSION['navigation']->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_SHIPPING)); zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL')); } } if(isset($mycartID)&&$mycartID == $_SESSION['cart']->cartID) { return array('title' => MODULE_PAYMENT_PAYPAL_TEXT_DESCRIPTION); } $mycartID = $_SESSION['cart']->cartID; $order = new order; // prevent 0-entry orders from being generated/spoofed if (sizeof($order->products) < 1) { zen_redirect(zen_href_link(FILENAME_SHOPPING_CART)); } $order_total_modules = new order_total; $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_BEFORE_ORDER_TOTALS_PRE_CONFIRMATION_CHECK'); //$order_totals = $order_total_modules->pre_confirmation_check(); $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_BEFORE_ORDER_TOTALS_PROCESS'); $order_totals = $order_total_modules->process(); $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_TOTALS_PROCESS'); if (!isset($_SESSION['payment']) && !$credit_covers) { zen_redirect(zen_href_link(FILENAME_DEFAULT)); } // load the before_process // load the before_process function from the payment modules //$zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_PAYMENT_MODULES_BEFOREPROCESS'); // create the order record $insert_id = $order->create($order_totals, 2); require(DIR_WS_LANGUAGES.'english/email_extras.php'); require(DIR_WS_LANGUAGES.'english/checkout_process.php'); // store the product info to the order $order->create_add_products($insert_id); $_SESSION['order_number_created'] = $insert_id; $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_CREATE_ADD_PRODUCTS'); $order->send_order_email($insert_id, 2); if (is_array($order_total_modules->modules)) { reset($order_total_modules->modules); while (list(, $value) = each($order_total_modules->modules)) { $class = substr($value, 0, strrpos($value, '.')); if (!isset($GLOBALS[$class])) continue; $GLOBALS[$class]->output=null; } } } else return false; }
The above is the entire content of this article, I hope it will be helpful to everyone’s study, For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
Development of PHP version of UnionPay payment interface##
The above is the detailed content of zen_cart implements the method of generating orders before payment. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Baidu Map APP has now become the preferred travel navigation software for many users, so some of the functions here are comprehensive and can be selected and operated for free to solve some of the problems that you may encounter in daily travel. You can all check some of your own travel routes and plan some of your own travel plans. After checking the corresponding routes, you can choose appropriate travel methods according to your own needs. So whether you choose some public transportation, Cycling, walking or taking a taxi can all satisfy your needs. There are corresponding navigation routes that can successfully lead you to a certain place. Then everyone will feel more convenient if they choose to take a taxi. There are many drivers They are all able to take orders online, and taxi-hailing has become super

uniapp is a cross-platform application development framework that can develop small programs, Apps and H5 at the same time. In uniapp applications, payment and order management are very common needs. This article will introduce how to implement payment functions and order management in the uniapp application, and give specific code examples. 1. Implementing the payment function The payment function is the key to realizing online transactions, and it usually requires integrating the SDK of a third-party payment platform. The following are the specific steps to implement the payment function in uniapp: Register and obtain a third-party payment platform

With the increasing popularity of online transactions, payment methods are gradually diversifying, among which PayPal is very popular as a widely used payment method. If you want to use PayPal to process transactions on your website or application, then you can use PHP and PayPal API to complete the payment process easily. PayPalAPI is a set of programming interfaces for interacting with PayPal. Through the API, you can receive notifications from PayPal, query the latest transaction information, and initiate payments.

Payment methods for taking buses in Wuhan: 1. For cash payment, you need to prepare sufficient change in advance and put the money directly into the coin slot; 2. Swipe the Wuhan Tong card. The full name of Wuhan Tong is Wuhan City Card, which is an integrated circuit Card, also known as chip card; 3. Alipay electronic bus card, first get a Wuhan electronic bus card in Alipay, and then directly scan the QR code to deduct the money when getting on the bus; 4. WeChat bus code payment , open the WeChat "Ride Code" applet, activate the Wuhan "Ride Code", and you can directly scan the QR code to deduct payment and get on the bus.

To establish the order payment table of the grocery shopping system in MySQL, specific code examples are required. With the development of the Internet, shopping has become more and more convenient. In the shopping process, order payment is an important part of the shopping process. The grocery shopping system not only needs to have an order generation function, but also must have a complete payment process, because only successful payment can be regarded as completing a transaction. This article will describe how to create an order payment table for the grocery shopping system in MySQL and provide specific code examples. 1. Design of order payment table. The order payment table in the grocery shopping system stores orders.

In the fast-paced modern life, Meituan Takeaway is deeply loved by consumers for its convenient services and rich choices. Among them, the ultra-fast payment function brings great convenience to users. Payment can be completed with one click, eliminating tedious input steps. However, many users don't like paying directly without confirmation, so they want to turn off this feature. So how to turn off the fast payment of Meituan Waimai? In the following, the editor of this website will bring you a detailed step-by-step setup tutorial, I hope it can help you! 1. Click the "Meituan Takeout" shortcut icon on the mobile phone desktop. 2. Log in to the Meituan takeout app on your mobile phone and click "My" in the lower right corner. 3. In the My interface, click "Enter Wallet". 4. On the Meituan Wallet interface, click the "Settings" icon in the upper right corner

PayNow payment is an electronic transfer service. Users can directly initiate real-time SGD transfers to the payee through the mobile phone number, ID card/FIN number, UEN number or PayNow QR code specified by the payee without the need for the other party. Bank account information.

1. First open the [Meituan] APP, click the [My] button in the bottom navigation bar. 2. Then click the [My Wallet] function button and click the [Cash Voucher] button. 3. Then in the top function bar, click the [Instant Deduction] button, and click the switch button to turn on [Default Deduction during Payment] to successfully turn it on.
