One very common motivation behind writing web applications comes from companies or individuals who are looking to sell a product online. Although a number of prepackaged solutions exist for various aspects of ecommerce systems, such as shopping carts, it is very much worth the effort to look at putting together an entire system from scratch, noting the important considerations that should be made, particularly those relating to security.
For the final major sample, we implement an online store that sells posters (see Figure 33-1). Users can browse through the inventory of prints for sale, adding them to their cart as they want. They can view the contents of their cart at any time (see Figure 33-2), and then check out, going through a sequence of steps to fill in their billing, shipping, and payment information.
Figure 33-1. An online store selling posters of photographs.
Figure 33-2. Looking at the contents of the shopping cart.
We will implement everything in this system except the actual payment processing, because this last step varies from one payment processing facility to another. We discuss some options for this later in this chapter.