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

Creating a basic cart

In this section, we will be creating the basic files necessary to run a cart. Later in the chapter, we will be adding greater functionality to it, but first let's prepare. We will be creating the following four files:

  • path/to/codeigniter/application/controllers/shop.php: This controller will handle any customer interaction between the views and the model, such as handling any forms and controlling the customer's journey through the cart.
  • path/to/codeigniter/application/models/shop_model.php: This model will handle any database interaction between the controller and the database. It will contain functions to fetch products and, product categories, and later in the chapter, to save the cart to the database.
  • path/to/codeigniter/application/views/shop/display_cart.php ...

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