O'Reilly logo

CodeIgniter 2 Cookbook by Rob Foster

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required