Saving the cart to the database

Before your customers are ready to proceed to payment, you need to take their details for payment, delivery, and your own records, and then move their cart that is in the session table to a specific table that will store orders.

Once the order has been saved and the customer details are supplied, a unique order code is generated and stored in orders.order_fulfilment_code. This can be used by a payment provider (for example, PayPal, GoCardless, Stripe, and so on) to keep track of the payment processing through their system and back into yours.

How to do it...

  1. First, create the following tables in your database:
    CREATE TABLE IF NOT EXISTS `customer` ( `cust_id` int(11) NOT NULL AUTO_INCREMENT, `cust_first_name` varchar(125) ...

Get CodeIgniter 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.