Chapter 4: Creating the Main Web Site
104
What about the Shopping Cart?
You ’ ve created a great deal of functionality in just a few hours. You have a working home page, category
and subcategory pages, product detail pages, and a rudimentary search engine. You have specialized
model functions to retrieve the data that you need, including navigation, featured products, and related
products. Your main view, called template , is smart enough to load all the other subviews it needs and
can accept a dynamically set view name from the controller.
What ’ s left? Well, there isn ’ t a real shopping cart on the site. There ’ s no way for the site visitor to add a
product to the shopping cart or to view the contents of that shopping cart. In Chapter 5 , you create this
shopping cart system using CodeIgniter sessions and the help of a new model that is dedicated to
the shopping cart data in those sessions.
At this point in the project, you deserve a break. You ’ ve completed more with CodeIgniter in just a few
hours than most other PHP developers could complete in several weeks. Your code is minimal, easy to
understand, and easy to update. It ’ s time to look at the sprint backlog to see what kind of progress
you ’ ve made.
Revisiting the Sprint Backlog
At the end of Chapter 2 , you created an initial sprint backlog. As you look over it now, you realize that
you ’ ve made progress on more than half the items on that list.
Here ’ s the list again:
- Install and configure CodeIgniter on a development server. DONE.
- Create the initial tables for products and categories. DONE.
- Build a model for products, with functions for listing all products by category, listing product
details for any given product, and listing other products that belong to the same group as a
product. DONE. - Build a model for categories, with functions for listing all categories as a tree, listing
subcategories for a category, and listing category details. The products model already contains a
function that allows you to list all products in a category. DONE. - Create a controller for all visible pages, with functions for the home page, About Us, Contact Us,
Search Results, Product Detail, Shopping Cart, and Category view. 80 percent DONE (need
shopping cart). - Create special controller functions for running the search and adding items to a Shopping Cart
cookie. 50 percent DONE. - Create other Shopping Cart functions that allow you to display everything in a Shopping Cart,
recalculate prices with Ajax, and delete line items from a Shopping Cart. - Create all the views needed to display web pages. This will more than likely involve a master
template with includes as needed to minimize your work later on.
Chapter 5 is where you dig into the Shopping Cart details. For now, take a well - deserved break!