Server-Side Web Programming with Active Server Pages
Lab 12 - Shopping Cart Pages

 
In this lab you will create a several deliverables. Explore the sample site http://www.valtara.com/csc123/shop/ to see examples. Again you will be building on your previous labs. There will be an automatic 6 point deduction if any of your pages do not use Hungarian notation or are missing TITLE or META description elements. Don't forget to review the SHOP database page for details about the database.

This is the big lab, all the major functionality of a web shopping experience is here. It is worth lots of points. Revised: 09/06/2002

Deliverables:

  1. General
    • All should respond gracefully to adverse circumstances, giving the end user a smooth and problem free existence, even if they do something unwise.
    • All pages (with the noted exceptions) should check to see if a valid user is logged in using the functions/pages in the previous lab.
    • All pages must be consistent in style and correctly use includes and other class requirements.
    • Data validation shall be performed as deemed prudent (see rule above).
  2. Product.asp
    • You must retrofit your product page to allow users to add this item to their cart.
    • Your page must allowing ordering one of each item. It is optional to allow ordering quantities greater than 1 of a single product. It is also optional to allow ordering directly from the search page results.
    • Users may elect to order items not in stock. 
    •  
  3. Orders.asp 
    • This page must display previous orders as well as the current shopping cart.
    • All orders must clearly display the order number.
    • The orders are summarized as lines with hyperlinks to link to a detailed view.
    • Once clicked on the order detail should be displayed using the sub below.
    • Users should be able to delete products or quantities only from the current order (the example site has a nice sample of how this could be done).
    • See example 
  4. Default.asp. Your home page should be modified to show the current shopping cart. You may use the provided example sub ShowCart() in the provided source

    You may elect to show the cart using the same sub in other pages if desired.
  5. Engine.asp 
    *New* we have decided to give you the code for Engine.Asp
    • Processes ADD and DEL requests to add or remove items from the users shopping cart
      1. For ADD requests
        • You should check to see if there is a SALE record that represents an 'open' cart. 
        • A sale record is a shopping cart if it belongs to the current customer and pending <> 0
        • If no sale record exists, one should be created using the rules above, in addition, the data pertaining to the customer should be copied from the customer record to this new record.
        • Once a valid SALEID exists, either from being there already or from being newly created, a new SaleDetail record can be created. 
          (Hint: use InsertWithIdentiy() function to get the ID of the newly created sale record)
        • The relevant data is copied from the PRODUCT table into the new SaleDetail record. For now fill the SalePrice field with the price field from the Product table.
        • The page should then return to some logical place e.g. the referrer. 
      2. For DEL requests
        • The existence of that product in the cart should be verified and if so the quantity should be determined.
        • If the quantity is one, the record should be deleted from SaleDetail.
        • If the quantity is greater then one, the quantity should be decremented by one and the record updated.
        • The page should then return to some logical place, e.g. the referrer. 
  6. A Sub ShowOrderDetail()
    • This routine will be reused on the next assignment as well and so should be part of an include.
    • You should show a summary of the information from the SALE table. The order and presentation is up to you.
    • You should use a constant tax rate of 0.08 (8%), this should be stored with each SALE record.
    • You should charge 'shipping and handling' on a per order or per item basis. The rate should be a constant. You must display your shipping rate and methodology on the page. 
    • Again, you will only allow items to be deleted if this order is the current open shopping cart.
    • You must first update the indicated fields in the database (Hint: this may take several passes) and then display the calculated fields on your page. 
      Formulas:
      1. Date Shipped: 1-5 Business days after order (you will calculate this on the next assignment, for now, it should remain NULL.
      2. Extension: (Not Stored but calculated in the SQL statement) = Unit Price * Quantity
      3. Sales Tax: Extension * Sales Tax Rate (Constant) (Stored in database)
      4. Line Total: Extension + Sales Tax (Stored in database)
      5. Total number of items: Sum of all the Quantity fields (Calculated, not stored)
      6. Total sales tax: Sum of all sales tax calculations (Calculated, not stored)
      7. Sub Total: Sum of Sales Tax + Sum of Line Totals
      8. Shipping and Handling: (Following what ever formula you pick), this should be stored with each SALE record.
      9. Grand Total: Sub Total + Shipping and Handling
    • You should supply a link back to Customer.Asp to change their information and in that page you should update the cart record belonging to that person to include the new information. There are 9 fields: Names, Address Fields, Credit Card Fields, etc that must be updated in the sale record.

This lab is worth 30 points and due on December 3rd.  When you have completed the lab, send an email to Chris Allen indicating you are done and providing the external URL to your pages.


Valtara Digital Design  http://www.valtara.com/csc123/   
Copyright 1999, 2001, Valtara Digital Design, Blitzkrieg Software