JavaScript EditorFreeware javascript editor     Javascript code


Main Page

Previous Page
Next Page

Chapter 9: E-Commerce Store

In this chapter we'll implement a working e-commerce store for TheBeerHouse, to enable users to shop for mugs, T-shirts, and other gadgets for beer-fanatics. This again gives us the opportunity to implement a good DAL and BLL that wraps and abstracts the database objects, a rich user interface that heavily leverages some new ASP.NET 2.0 controls such as Wizard, MultiView, and the GridView and DetailsView we've already used in other chapters. We'll also drill down into e-commerce-specific design and coding issues as we implement a persistent shopping cart, and we'll integrate a third-party payment processor service to support real-time credit card transactions. At the end of the chapter you'll have a complete e-commerce module that you can easily adapt to suit your own needs.

Problem

Let's assume the site's owner wants you to implement some features to help him turn the site into a profit-making enterprise. There are a number of ways to do this: Some sites gain revenue from renting advertising space (boxes and banners), some sell subscription-based access to their special content (articles, support forums, downloads, etc.), and some set up an e-commerce store for selling goods online. This chapter covers the design and implementation of an e-commerce store — this option was chosen for our demo web site because it's a good example of non-trivial design and coding, and it gives you a chance to examine some additional ASP.NET 2.0 technology in a real-world scenario. In addition, it is much more common for small sites to sell products, rather than ads and articles, unless they are extremely popular and active (ad revenue is small until your hit and click-through counts get pretty high). Building an e-commerce store from scratch is one of the most difficult jobs for a web developer, and it requires a good design up-front. It's not just a matter of building the site to handle the catalog, the orders, and the payments; a complete business analysis is required. You must identify your audience (potential customers), your competitors, a marketing strategy to promote your site, marketing offers to convince people to shop on your site rather than somewhere else, and plan for offers and other incentives to turn an occasional buyer into a repeat buyer. You also need to arrange a supplier for products that you can sell (in case the site's owner is not producing them herself), which involves the order management and shipping functions, and some consideration of local laws (licenses, tax collection, etc.). All of this could require a considerable amount of time, energy, and money, unless the site owner is already running some kind of physical store that they merely want to extend. In our case, we assume our sample site will be used by pubs that already have the business knowledge needed to answer the marketing-related questions, and we'll focus on the technical side of this project (a reasonable assumption because we are software developers and not marketing specialists).

For our sample project, let's say that the owner of TheBeerHouse wants to add an electronic store to the site — to sell beer glasses, T-shirts, key chains, and other gift items for beer enthusiasts. She needs the capability to create an online catalog that lists products divided into categories, one that provides a detailed and appealing description for each product, has pictures of products, and allows users to add them to an electronic shopping cart and pay for them online using a credit card (with a possible option of letting users phone in their orders in case they don't want to divulge their credit card information online). The owner needs the capability to run special promotions by setting up discounts for certain products, and to offer multiple shipping options at different prices. All this must be easily maintainable by the store keeper herself, without routine technical assistance, so we must also provide a very complete and intuitive administrative user interface. Finally, she also needs some kind of order reporting page that retrieves and lists the latest orders, the orders with a specific status (completed orders, orders that were confirmed but not yet processed, etc.) or orders for a specific customer. It should also enable her to change the order status, the shipment date, and the shipment tracking information, and, of course, see all order details, such as the customer's full address and contact information. In the next section you'll find a detailed list of requirements and features to be implemented.


Previous Page
Next Page


JavaScript EditorFreeware javascript editor     Javascript code