Microsoft .NET Server Solutions for the Enterprise
Web Site Support for Shopping Baskets
The implementation of a shopping basket Web page is largely a matter of Web site programming that is beyond the scope of Commerce Server itself, although the Retail Solution Site available on the Commerce Server Web site, and the .NET Retail Sample Site available in the Commerce Server 2002 SDK, provide working versions of such pages.
The Commerce Server 2000 Retail Solution Site contains several pages that correspond directly to the support for shopping baskets:
- _basket.asp. This page is used to render the basket page, displaying a table as described above.
- _additem.asp. This page performs the processing associated with adding a product to the shopping basket when the user clicks the "Add to Basket" button on the product display page product.asp. This page ends by re-directing to either the basket page or returning to the product page, depending on how the site is configured.
- _delitem.asp. This page performs the processing associated with removing a product from the shopping basket, and ends by re-directing back to the basket page.
- _delall.asp. This page performs the processing associated with removing all products from the shopping basket, and ends by re-directing back to the basket page.
- _editqty.asp. This page performs the processing associated with changing the quantity of a product in the shopping basket, and ends by re-directing back to the basket page.
These pages call Commerce Server objects to load and save shopping baskets from and to the Transactions resource or database. In addition, the page basket.asp uses a Commerce Server pipeline to perform some error checking on the contents of the basket. See the next section, "Object Support for Shopping Baskets" for more information.
The ASP.NET-based International Retail Site, included in the Commerce Server 2002 SDK, defines both controls and classes that implement shopping basket/cart functionality for use within the Web site. This includes the control Cart, which is used to render the products currently in the cart. The Cart control and all of the other transaction controls are implemented in a pair of files of the same name, with HTML for the control defined in a .ascx file and the code for the control defined in a .ascx.vb file. Each control inherits from the class of the same name.
The namespace Microsoft.CommerceServer.Site.Transactions defines the classes corresponding to the transaction controls, as well as an additional supporting class. These classes access the Commerce Server shopping cart objects through the Commerce Server Base Class Library (BCL) namespace Microsoft.CommerceServer.Runtime.Orders, which defines more than a dozen classes including the class Basket that directly supports the notion of a shopping basket.
Previous Next |