2: The shopping cart:
To process the customer orders, I would require the following tables in the main database so that the while shopping, these tables help keep track of individual customer details, order details, cart details etc. Therefore I have created tables for Users, Carts and Orders as in the diagram below;
When a customer clicks on the Add to Cart button on a product page, cart.asp page is brought up which will then do either of two things, one if a customer has already registered, he or she can log in, thereby displaying addcart.asp page; otherwise, registration page will be displayed.
In the cart.asp page, I have included two files;
“aovbs.inc” contains all the constants for the ActiveX Data Objects and storefuncs.asp page has all the common functions and subroutines used in the shopping experience and evaluating all sorts of forms.
The following codes are used to retrieve productID and username and password.
..<,%,,
' Get Product ID
productID = TRIM( Request( "pid" ) )
' Get Login Information username = TRIM( Request( "username" ) )
password = TRIM( Request( "password" ) )
register = TRIM( Request( "register" ) )
error = TRIM( Request( "error" ) )
Following codes are used to add new customer registration information to the database as well as to log in registered customers, by checking username and passwords. If the log in is successful, addcart.asp is displayed and otherwise, register.asp page is displayed to register a new customer. The functions which checks username and passwords is included in another page called storefunc.asp.
‘ Check For New Registration
IF register <> “” AND error = “” THEN
addUser
END IF
‘ Get User ID
userID = checkpassword( username, password, Con )
IF userID > 0 THEN
..%>