Professional CodeIgniter

(singke) #1

Chapter 5: Building a Shopping Cart


125



  1. 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 views. DONE.

  2. Create special controller functions for running the search and adding items to a shopping
    cart cookie. DONE.

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

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


It ’ s time to meet with Claudia. You ’ re sure that she ’ ll have lots of feedback.

Meeting with Claudia


You meet with Claudia at her store. Her employees are quietly taking care of customers as you step
Claudia through what you ’ ve built. You let her know from the very beginning that what she needs to
concentrate on is functionality, and not look and feel, but even though she agreed to this, she still winces
at every page.

“ What ’ s wrong? ” you ask her, concerned that perhaps what you ’ ve built isn ’ t passing muster.

“ Well, I can see how we have just about everything we put on the backlog, ” she says, “ But the entire
thing looks a bit amateurish. It needs polish. ”

“ Exactly what I was saying about functionality versus look and feel, ” you explain. “ Think of web - site
development as building a house. You always put in the foundation first, then the frame and electrical
and plumbing, then the drywall and flooring. Later on we can worry about picking out the nice stuff,
like the furniture and paint colors. ”

Claudia laughs. “ I guess I want all the nice stuff now! ”

“ Well, you ’ re in luck, because we ’ re just about ready for all the nice things. We just need to go through
the site and make an inventory of what needs changing. ”

Claudia looks a bit skeptical. “ This is the easy part, ” you reassure her. “ With CodeIgniter ’ s help, I ’ ve
built a fully functional eCommerce site in just a few days. ”

“ Well, I don ’ t see any place where I can add products myself, ” Claudia says, arching an eyebrow.

“ OK, fully functional as far as the web - site visitor is concerned. I ’ ll build the administrative panels in the
next go - around. ”

“ OK, well, I ’ ve been taking notes. Can I share those with you? ” Claudia asks, and you tell her to share.
Free download pdf