9. Building a Shopping Cart

In the previous chapter, an online catalog of products was developed, complete with buttons for adding items to the customer’s shopping cart. Now it’s time to implement the cart itself. A good shopping cart shows customers exactly what they have in their basket and provides ways to remove items, update the quantities, and check out. For this website, there’s also a “wish-list” feature, allowing the customer to save cart items for later.

The bulk of this chapter will focus on writing the shopping cart and wish-list features. First, though, new stored procedures are required. The chapter ends with various ways to factor in shipping.

Defining the Procedures

Because this site uses an MVC approach, the chapter begins by ...

Get Effortless E-Commerce with PHP and MySQL, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.