
The table has columns, for product description, price, quantity, total, and the picture.
Then the fields were set, it includes hidden fields, like for the quantity field, as well ordertotal.
It was developed according to the process shown on the UltraEasy Shopping Cart hosted at http://cctmdev2.londonmet.ac.uk/WebthangTutorials/shop_cart/uecart_12.asp
Code used was provided by the webpage hosted above. Changes were made at necessary parts to equip with the webpage.
Shopping cart shown below.

Creating the image field as well as the delete option, not provided in the UltraEasy Shopping Cart
First additional CONST needs to be declared
CONST CARTPICTURE = 4
Then it is called from the product details page by
picture = TRIM(Request("picture"))
Added to the shopping cart by
localCart(CARTPICTURE, i) = picture
Finally putting the img field with the code provdied,
( localCart(CARTPICTURE, i))%>
In the img tag it's written item from 'add item to cart' so it containts the field from VB script.
Creating the delete optionFor the delete checkbox code was taken from the textbook, in the checkbox field name this is put.
localCart(CARTPID, i )
In the update quantity part of the VB Script, this code is inserted,
deleteProduct = TRIM( Request("pd" & localCart(CARTPID, i)))
Since the input name was given with pd, it is calling for the name in the trim request,
This is set at :
IF newQ = "" or newQ = "0" or deleteProduct <> "" THEN
localCart( CARTPID, i ) = ""
So either quanity field is blank, or zero, or the deleteproduct is checked it removes the record from the shopping cart which is "".
Showing the Total for each product
Total value of each product was not shown on the shopping cart, only the toal value of all products, so to show the customer the total value of each product, this code is put :
productTotal = ( localCart( CARTPPRICE, i ) * localCart( CARTPQUANTITY, i ) )
This is put right above the order total calculation, then the 'productTotal' is put in the column where the total of each product is shown.
No comments:
Post a Comment