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