Specifications

Building Practical PHP and MySQL Projects
P
ART V
540
In this chapter, you will learn how to build a basic shopping cart. We will add this on top of the
Book-O-Rama database that we implemented in Part II, Using MySQL.We will also explore
another optionsetting up and using an existing Open Source PHP shopping cart.
In case you have not heard it before, the term shopping cart (sometimes also called a shopping
basket) is used to describe a specific online shopping mechanism. As you browse an online cat-
alog, you can add items to your shopping cart. When youve finished browsing, you check out
of the online storethat is, purchase the items in your cart.
In order to implement the shopping cart, we will implement the following functionality:
A database of the products we want to sell online
An online catalog of products, listed by category
A shopping cart to track the items a user wants to buy
A checkout script that processes payment and shipping details
An administration interface
The Problem
You will probably remember the Book-O-Rama database we developed in Part II. In this
project, we will get Book-O-Ramas online store up and going. The requirements for this sys-
tem are
We will need to find a way of connecting the database to a users browser. Users should
be able to browse items by category.
Users should also be able to select items from the catalog for later purchase. We will
need to be able to track which items they have selected.
When they have finished shopping, we will need to be able to total up their order, take
their delivery details, and process their payment.
We should also build an administrator interface to Book-O-Ramas site so that the
administrator can add and edit books and categories on the site.
Solution Components
Lets look at the solutions to meeting each of the requirements listed previously.
Building an Online Catalog
We already have a database for the Book-O-Rama catalog. However, it will probably need
some alterations and additions for this application. One of these will be to add categories of
books, as stated in the requirements.
31 7842 CH25 3/6/01 3:38 PM Page 540