Specifications
We can work out the total of an order from a user’s shopping cart session variable. We will
record the final order details in the database, and get rid of the session variable at that time.
Administration Interface
In addition to all this, we will build an administrator interface that will let us add, delete, and
edit books and categories from the database.
One common edit that we might make is to alter the price of an item (for example, for a spe-
cial offer or sale). This means that when we store a customer’s order, we should also store the
price she paid for an item. It would make for an accounting nightmare if the only records we
had were what items each customer ordered, and what the current price of each is. This also
means that if the customer has to return or exchange the item, we will give her the right
amount of credit.
We are not going to build a fulfillment and order tracking interface for this example. You can
add one onto this base system to suit your needs.
Solution Overview
Let’s put all the pieces together.
There are two basic views of the system: the user view and the administrator view. After con-
sidering the functionality required, we came up with two system flow designs, one for each
view. These are shown in Figure 25.1 and Figure 25.2, respectively.
Building Practical PHP and MySQL Projects
P
ART V
542
View Cart Checkout
Get
Payment
Details
Process
Payment
Category
List
Category
Book List
Book
Details
EXIT
ENTER
Add book to cart
FIGURE 25.1
The user view of the Book-O-Rama system lets users browse books by category, view book details, add books to their
cart, and purchase them.
31 7842 CH25 3/6/01 3:38 PM Page 542










