Chapter 5: Building a Shopping Cart
116
You may be looking at the code and wondering how all of this is going to work. After all, right now, if a
user makes a change to the form fields on the left, nothing changes. That ’ s where the next task comes in.
Also, you may note that the Shopping Cart display has a few items missing, such as a working checkout
button or a row that indicates shipping. As these are rules not yet provided by the client, they can be
addressed in the next two chapters, which are focused on building out the administrative panels.
Adding the View Cart Link to the Navigation
Once a web site visitor gets to the Shopping Cart page, he may or may not check out immediately.
He may make changes to his Shopping Cart line items and then go back to perusing the site. Any
changes made on the Shopping Cart page will have to be tracked in the session.
The way you ’ re going to handle this problem is very simple. You ’ re going to add an Update button to
the Shopping Cart interface, then use it to call a custom Scriptaculous Ajax function that will interact
with a new controller function you ’ re going to write. Therefore, you ’ ll need to install the Scriptaculous
framework, which includes Prototype, as it isn ’ t included with CodeIgniter.
You can download the Scriptaculous libraries from http://script.aculo.us/.
Figure 5 - 4