The Checkout Process for Zen Cart
The total flow of Zen Cart Checkout process is:
1. shopping_cart
2. checkout_shipping
3. checkout_payment
4. checkout_confirmation
5. checkout_process
6. checkout_success
shopping_cart
1. Validate Cart for checkout
2. Display the shopping_cart page
checkout_shipping
1. if there is nothing in the customers cart, redirect them to the shopping cart page
2. if the customer is not logged on, redirect them to the login page
3. Validate Cart for checkout
4. Check if the required stock is available.
5. verify the selected shipping address. if no shipping destination address was selected, use the customers own address as default
6. register a random ID in the session to check throughout the checkout procedure against alterations in the shopping cart contents
7. if the order contains only virtual products, forward the customer to the billing page as a shipping address is not needed
8. load all enabled shipping modules
9. process the selected shipping method and redirect to checkout_payment
10. get all available shipping quotes
11. if no shipping method has been selected, automatically select the cheapest method. if the modules status was changed when none were available, to save on implementing a javascript force-selection method, also automatically select the cheapest shipping method if more than one module is now enabled
12. Display the checkout_shipping page
checkout_payment
1. if there is nothing in the customers cart, redirect them to the shopping cart page
2. if the customer is not logged on, redirect them to the login page
3. if no shipping method has been selected, redirect the customer to the shipping method selection page
4. avoid hack attempts during the checkout procedure by checking the internal cartID
5. Check if the required stock is available.
6. get coupon code
7. if no billing destination address was selected, use the customers own address as default
8. load all enabled payment modules
9. Load the selected shipping module(needed to calculate tax correctly)
10. Display the checkout_payment page
checkout_confirmation
1. if there is nothing in the customers cart, redirect them to the shopping cart page
2. if the customer is not logged on, redirect them to the login page
3. avoid hack attempts during the checkout procedure by checking the internal cartID
4. if no shipping method has been selected, redirect the customer to the shipping method selection page
5. load the selected payment module
6. load the selected shipping module
7. Check if the required stock is available
8. update customers_referral with $_SESSION['gv_id']
9. if shipping-edit button should be overridden, do so
10. deal with billing address edit button
11. Display the checkout_confirmation page
checkout_process
1. invoke the checkout_process module
1.1 if the customer is not logged on, redirect them to the time out page
1.2 load selected payment module
1.3 load the selected shipping module
1.4 prevent 0-entry orders from being generated/spoofed
1.5 load the before_process function from the payment modules
1.6 create the order record
1.7 store the product info to the order
1.8 send email notifications
1.9 Calculate order amount for display purposes on checkout-success page as well as adword campaigns etc. Takes the product subtotal and subtracts all credits from it
2. load the after_process function from the payment modules
3. unregister session variables used during checkout
4. redirect to checkout_success page