Shopping Cart at Angel Court
<%
set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open ConString
if cstr(Session("orderID")) = "" then
Response.Write "
"
Response.Write "
Your Cart Is Empty
"
Response.Write "
If you previously added items to your order, "
Response.Write "your session may have timed out.
Please review your order for accuracy. To remove an item, set the quantity to zero and press Update Order button.
<% If Session("ValidatedWholesaleUser") = FALSE Then %>
<% else %>
<% End If %>
<%
end if
Conn.Close
set Conn = Nothing
%>
<%
Public Sub VerifyCoupon()
Dim sSql, oRsCoupon, nAmount
sSql = "SELECT * FROM tblCoupon c, orders o WHERE c.couponCode=o.couponCode AND orderID=" & Session("orderID")
Set oRsCoupon = Server.CreateObject("ADODB.Recordset")
With oRsCoupon
.ActiveConnection = ConString
.Source = sSql
.CursorLocation = 2
.CursorType = 0
.LockType = 1
.Open()
End With
If oRsCoupon.EOF Then Exit Sub
If CDbl(intTotal) < CDbl(oRsCoupon("couponCondition")) Then
Response.Write("
Coupon will activate at " & FormatCurrency(oRsCoupon("couponCondition")) & ".
")
Exit Sub
End If
If oRsCoupon("couponType") = "amount" Then
intTotal = CDbl(intTotal) - CDbl(oRsCoupon("couponAmount"))
nAmount = "-" & FormatCurrency(oRsCoupon("couponAmount"))
Else
intTotal = CDbl(intTotal) - CDbl(oRsCoupon("couponAmount"))/100 * CDbl(intTotal)
nAmount = oRsCoupon("couponAmount") & "% Off"
End if
Response.Write("
Coupon (" & oRsCoupon("couponName") & ")
")
Response.Write("
" & nAmount & "
")
oRsCoupon.Close()
Set oRsCoupon = Nothing
End Sub
%>