Building a Shopping Cart

Now that a storefront has been constructed with Add To Cart links for each product, it’s time to build the actual shopping cart. This section creates two versions of a ColdFusion template called StoreCart.cfm.

If the StoreCart.cfm template is visited without any URL parameters, it displays the items in the cart and gives the user the opportunity to either change the quantity of each item or check out, as shown in Figure 22.2. If a MerchID parameter is passed in the URL, that item is added to the user’s cart before the cart is actually displayed. You will notice that the Add To Cart links generated by the <cf_MerchDisplay> Custom Tag (refer to Listing 22.1) do exactly that.

Figure 22.2. From the Shopping Cart page, users ...

Get Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started 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.