June 2005
Intermediate
720 pages
20h 6m
English
Once you have created a product catalog, as I have now, the actual shopping cart itself can be surprisingly simple. The method I’ve chosen to use in this example is to record the product IDs, prices, and quantities in a session. Knowing these three things will allow the scripts to calculate totals and do everything else required.
These next two examples will provide all the necessary functionality for the shopping cart. The first script, add_cart.php, will add items to the shopping cart. The second, view_cart.php, will both display the contents of the cart and allow the customer to update it.
The add_cart.php script will take one argument—the ID of the print being purchased—and will use this to update the cart. ...
Read now
Unlock full access