PHP

Ordering and Shipping

We complete our description of the shopping components of the winestore by outlining the ordering and shipping modules in this tutorial. The ordering module manages the conversion of the shopping cart discussed in tutorial 11 to an order.

The module manages the most complex database interactions in the winestore and includes locking to address concurrency problems. The shipping module consists of two receipts: an email receipt that shows how the PHP mail( ) function is used in practice and an HTML receipt that is similar to the customer receipt in tutorial 10.

This tutorial is the third of four that outline the complete winestore application. As in the previous two tutorials, we emphasize that the scripts aren't a production system but an illustration of web database application practice. We encourage use of the scripts for any purpose and suggest that the best method to understand the scripts is to view, edit, and use them while reading the tutorial. We also emphasize that the descriptions in this tutorial are outlines and that a full understanding of the scripts requires reading and using the code.

The scripts discussed in this tutorial perform the following functions:

Finalize orders
Convert a shopping cart in the items and orders tables to an order and manage the sale of wine through the inventory table
Email receipts
Send a confirmation email to the user
HTML order receipts
Complete the ordering process with an HTML receipt that avoids the reload problem