Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Location
    Los Angeles, CA
    Posts
    5
    Plugin Contributions
    1

    Default Question about checkout_process.php and $_SESSION['order_number_created']

    I have a question about the creation of customer orders. It seems that checkout_process.php calls $order->create(); to create the order. My question is: Is the order created solely through checkout_process.php or is it ever created through a payment module or another module?

    I'm asking because I see no other way of capturing the order_id other than using an observer and listening for NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_CREATE_ADD_PRODUCTS then using $_SESSION['order_number_created'] which is only supplied in checkout_process.php.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Question about checkout_process.php and $_SESSION['order_number_created']

    Quote Originally Posted by xianFF0000 View Post
    My question is: Is the order created solely through checkout_process.php or is it ever created through a payment module or another module?
    In v1.3.x, some payment modules such as "PayPal IPN" and "NoChex APC" do insert order records on their own independent from checkout_process.php.
    Quote Originally Posted by xianFF0000 View Post
    I'm asking because I see no other way of capturing the order_id ...
    For what purpose are you trying to capture the order_id?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Sep 2004
    Location
    Western Massachusetts
    Posts
    2,945
    Plugin Contributions
    5

    Default Re: Question about checkout_process.php and $_SESSION['order_number_created']

    An order can be created without going through the checkout_process module - this can happen in some circumstances such as delayed response from Paypal IPN, when the cart will create the order as a result of the IPN data post. However, the notifier NOTIFY_ORDER_AFTER_ORDER_CREATE_ADD_PRODUCTS is still issued, directly by the function create_add_products in the orders.php class file.
    Although not generally used at the moment, the notify function does have the capability to include a parameter array in the notification.
    You could modify the notify event in the function create_add_products to include the order number as a parameter, and use that in your observer function. To do that , change this line in includes/classes/order.php:
    PHP Code:
        $zco_notifier->notify('NOTIFY_ORDER_AFTER_ORDER_CREATE_ADD_PRODUCTS'); 
    to this:
    PHP Code:
        $zco_notifier->notify('NOTIFY_ORDER_AFTER_ORDER_CREATE_ADD_PRODUCTS'$zf_insert_id); 
    Neville
    An assumption is what you arrive at when you get tired of thinking...

  4. #4
    Join Date
    Mar 2009
    Location
    Los Angeles, CA
    Posts
    5
    Plugin Contributions
    1

    Default Re: Question about checkout_process.php and $_SESSION['order_number_created']

    Thank you both.

    What I'm using it for:
    I have an order_total module that uses an API to calculate the fee. That API has 2 methods, getQuote, getConfirmation.... so the order_total module "process()" uses the API getQuote to calculate the fee.

    I was struggling with a way to call the API getConfirmation after a completed order. The API creates a tracking number for the customer that appears on the invoice but you need to call getConfirmation so the 3rd party system knows the fee was successfully processed.

    So yeah this is helpful stuff, thanks again.

 

 

Similar Threads

  1. v153 Sharing PHP variables ($_SESSION question)
    By flyvholm in forum General Questions
    Replies: 5
    Last Post: 4 Nov 2014, 06:15 PM
  2. Replies: 12
    Last Post: 16 Jun 2014, 05:55 AM
  3. Having problem with order.php and checkout_process.php with OLD Zen Cart v1.2.3
    By wolfbane01 in forum Managing Customers and Orders
    Replies: 0
    Last Post: 28 Jul 2010, 01:56 AM
  4. Understanding checkout flow regarding paypal, checkout_process.php and before_process
    By s_p_ike in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 1 Sep 2009, 12:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg