<%
Dim sAction
sAction = CStr(Request("action"))
Select Case sAction
%>
<% Case "delivery"
thissesh = Request.Cookies("BR")
IF thissesh = "" THEN
adoConn.Close
Set adoConn = Nothing
Response.Status = "302 Object moved"
Response.Redirect "error.asp?error=1"
END IF
sqlString = "SELECT * FROM Cart WHERE c_userID = '" & thissesh & "'"
SET rsCheck = adoConn.Execute( sqlString )
IF rsCheck.EOF THEN
Response.Write ""
Response.Write "| "
Response.Write " Your basket appears to be empty. Please use your browsers back button to continue shopping. "
Response.Write " | "
ELSE
sqlString = "SELECT * FROM Deliveryz2 ORDER BY dname ASC"
SET RS = adoConn.Execute( sqlString )
%>
Delivery Details |
Please select your delivery area |
| |
|
| |
<% RS.Close
Set RS = Nothing
END IF
rsCheck.CLose
Set rsCheck = Nothing
%>
<% Case "delivery2"
deliveryarea = Request("dArea")
thissesh = Request.Cookies("BR")
IF thissesh = "" THEN
adoConn.Close
Set adoConn = Nothing
Response.Status = "302 Object moved"
Response.Redirect "error.asp?error=1"
END IF
sqlString = "SELECT * FROM Deliveryz2 WHERE dname = '" & deliveryarea & "'"
SET rsDel = adoConn.Execute( sqlString )
' Get the shopping cart
sqlString = "SELECT c_id, c_prodID, c_pp, prod_ID, c_pq, c_wt FROM Cart, Productz WHERE c_userID = '" & thissesh & "' AND c_prodID = prod_ID ORDER BY prod_name ASC"
SET RS = adoConn.Execute( sqlString )
count = 0
thistot = 0
RS.MoveFirst
Do While Not RS.EOF
subtot = FormatNumber(RS.Fields("c_pp")) * RS.Fields("c_pq")
subwt = Cdbl(RS.Fields("c_wt")) * RS.Fields("c_pq")
thistot = thistot + subtot
totwt = totwt + subwt
subtot = 0
count = count + 1
RS.MoveNext
Loop
IF totwt = 0 OR totwt = "" THEN
delcharge = ""
END IF
IF totwt <= rsDel.Fields("wt1") THEN
delcharge = rsDel.Fields("p1")
END IF
IF totwt > rsDel.Fields("wt1") AND totwt <= rsDel.Fields("wt2") THEN
delcharge = rsDel.Fields("p2")
END IF
IF totwt > rsDel.Fields("wt2") AND totwt <= rsDel.Fields("wt3") THEN
delcharge = rsDel.Fields("p3")
END IF
IF totwt > rsDel.Fields("wt3") AND totwt <= rsDel.Fields("wt4") THEN
delcharge = rsDel.Fields("p4")
END IF
IF totwt > rsDel.Fields("wt4") AND totwt <= rsDel.Fields("wt5") THEN
delcharge = rsDel.Fields("p5")
END IF
IF totwt > rsDel.Fields("wt5") AND totwt <= rsDel.Fields("wt6") THEN
delcharge = rsDel.Fields("p6")
END IF
IF totwt > rsDel.Fields("wt6") AND totwt <= rsDel.Fields("wt7") THEN
delcharge = rsDel.Fields("p7")
END IF
IF totwt > rsDel.Fields("wt7") AND totwt <= rsDel.Fields("wt8") THEN
delcharge = rsDel.Fields("p8")
END IF
IF totwt > rsDel.Fields("wt8") AND totwt <= rsDel.Fields("wt9") THEN
delcharge = rsDel.Fields("p9")
END IF
IF totwt > rsDel.Fields("wt9") AND totwt <= rsDel.Fields("wt10") THEN
delcharge = rsDel.Fields("p10")
END IF
IF totwt > rsDel.Fields("wt10") AND totwt <= rsDel.Fields("wt11") THEN
delcharge = rsDel.Fields("p11")
END IF
IF totwt > rsDel.Fields("wt11") AND totwt <= rsDel.Fields("wt12") THEN
delcharge = rsDel.Fields("p12")
END IF
IF totwt > rsDel.Fields("wt12") AND totwt <= rsDel.Fields("wt13") THEN
delcharge = rsDel.Fields("p13")
END IF
IF totwt > rsDel.Fields("wt13") AND totwt <= rsDel.Fields("wt14") THEN
delcharge = rsDel.Fields("p14")
END IF
IF totwt > rsDel.Fields("wt14") AND totwt <= rsDel.Fields("wt15") THEN
delcharge = rsDel.Fields("p15")
END IF
IF totwt > rsDel.Fields("wt15") AND totwt <= rsDel.Fields("wt16") THEN
delcharge = rsDel.Fields("p16")
END IF
IF totwt > rsDel.Fields("wt16") AND totwt <= rsDel.Fields("wt17") THEN
delcharge = rsDel.Fields("p17")
END IF
IF totwt > rsDel.Fields("wt17") THEN
delcharge = rsDel.Fields("p18")
END IF
thistot2 = thistot + delcharge
vatsum = (thistot2 / 100) * vatrate
vatsum = Round(vatsum, 2)
rsDel.Close
Set rsDel = Nothing
RS.Close
Set RS = Nothing
IF count <1 THEN
response.write ""
response.write "Your basket is currently empty! | "
ELSE
adoConn.Close
Set adoConn = Nothing
Response.Status = "302 Object moved"
Response.Redirect "checkout.asp?action=checkout1&delcharge=" & delcharge & "&thistot=" & thistot & "&totwt=" & totwt & "&vatsum=" & vatsum
END IF
%>
<%
Case "checkout1"
Dim Sdatum3, thissesh, count, thistot, delcharge, thiscalc
Sdatum3 = NOW
delcharge = Request("delcharge")
thistot = Request("thistot")
totwt = Request("totwt")
vatsum = Request("vatsum")
%>
<% IF Request("errormessage") = "yes" THEN %>
ERROR
You must complete your delivery details in order for your
order to be processed!
Required fields include; delivery name, delivery address and email.
|
<% END IF %>
Payment
We are pleased to accept credit and debit card payments via Paypal,
and cheques or postal orders, made payable to "<%=clientChqNm%>".
You can choose your preferred method of payment below.
Delivery Details
Your order will be sent to the following address. Please enter
your address and delivery information and click Confirm Order
to continue.
<% Case Else ' menu
adoConn.Close
Set adoConn = Nothing
Response.Status = "302 Object moved"
Response.Redirect "checkout.asp?action=delivery"
%>
<%
End Select
%> |