Chapter 8. The JavaScript Shopping Cart

Application FeaturesJavaScript Techniques
• Versatile Client-Side Shopping Cart• Managing Multiple Windows and Document Content
• User-Friendly Interface Makes Shopping Easy• Maintaining Client State with Objects
• No Server-Side Processing Required (Until Check-out)• Adding Object Properties
• Program Monitors All Selections and Keeps a Running Total• Reusing a JavaScript Database
• Database Enables Accurate Product Searching• Number Rounding and String Conversion

If there is a single-most diverse and robust JavaScript application in this book, it is the one described here. With Shopping Bag, you need only the graphics and product details to quickly and easily add an online shopping cart to your site. You don’t need to create extra files to display your products. Shopping Bag takes care of that on the fly. No need for a server to calculate tax and totals. Shopping Bag accurately computes them on the fly as well. Adding and removing products from a user’s shopping bag takes only a click or two. Unlike server-based shopping bags, there’s no waiting.

Shopping Bag Walk-Through

Something really easy and intuitive for the online consumer usually means some extra elbow grease for the programmer. Not to disappoint you, this is the case here. The fun and functionality you get in return, however, make the effort well worth it. The description of Shopping Bag’s functionality and code are based ...

Get JavaScript Application Cookbook 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.