%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Set objCart=new Cart
%>
J'AMORI - Checkout
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers="1"
MM_authFailedURL="http://www.jamori.com/login.asp?log=false"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (false Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Session("mm_Username") <> "") Then
Recordset1__MMColParam = Session("mm_Username")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_msjamori_STRING
Recordset1.Source = "SELECT * FROM customers WHERE Username = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
'calculate discount based on who logged in
'If Not Recordset1.eof Then
' if it is not empty then do this
'If Recordset1("how") = "Grande Dame" Then
'objCart.Discount = (objCart.SubTotal) * 0.25
' else objCart.Discount = (objCart.SubTotal) * 0.3
'End If
'End If
%>
<%
Dim Orders
Dim Orders_numRows
Set Orders = Server.CreateObject("ADODB.Recordset")
Orders.ActiveConnection = MM_msjamori_STRING
Orders.Source = "SELECT * FROM Orders"
Orders.CursorType = 0
Orders.CursorLocation = 2
Orders.LockType = 1
Orders.Open()
Orders_numRows = 0
%>
<%
Dim Orderdetails
Dim Orderdetails_numRows
Set Orderdetails = Server.CreateObject("ADODB.Recordset")
Orderdetails.ActiveConnection = MM_msjamori_STRING
Orderdetails.Source = "SELECT * FROM OrderDetails"
Orderdetails.CursorType = 0
Orderdetails.CursorLocation = 2
Orderdetails.LockType = 1
Orderdetails.Open()
Orderdetails_numRows = 0
%>
<%
'
'Add customised shipping criteria to cart
if objCart.TotalWeight > 0 then
objCart.Shipping=objCart.TotalWeight
else objCart.Shipping = 0
end if
%>
<%
'
'Insert record into Orders recordset when form is submitted
'and store the unique OrderID
'
CC_OrderAction=Request.ServerVariables("SCRIPT_NAME")
if Request("CC_OrderInsert") <> "" then
objCart.OrdersTable="dbo.Orders"
objCart.OrdersConnectionString=MM_msjamori_STRING
objCart.OrderKey="OrderID"
objCart.InsertOrder
Session("OrderID")=objCart.OrderID
end if
%>
<%
'
'**Save cart to OrderDetails table in Database**
'
if Request("CC_OrderInsert") <> "" then
objCart.OrderDetailsTable="dbo.OrderDetails"
objCart.OrderDetailsConnectionString=MM_msjamori_STRING
objCart.Bindingvalues=("InventoryID,Quantity,Designer,Price,,,Colour,,Size,ProductID,Member,,Sale,Cost")
objCart.Bindingcolumns=("ProductID,Quantity,Name,Price,Weight,Key,Colour,Thumbnail,Size,Style,Member,Soldfor,Sale,Cost")
objCart.OrderIdColumn="OrderID"
objCart.InsertOrderDetails
end if
%>
<%
'
'Redirect if cart is empty
'
if objCart.isCartEmpty then response.redirect "http://www.jamori.com/cartempty.asp"
%>
<%
'
'Redirect after submitting Cart info to Database
'
if Request("CC_OrderInsert") <> "" then
Response.Redirect "http://www.jamori.com/myordermail.asp"
end if
'
'Add sales tax from value in recordset
'
if not Recordset1.eof then
if Recordset1("Shippingstate") = "MO" then objCart.SalesTax=((objCart.SubTotal)-(objCart.Discount)) * 0.0785
else if Recordset1("Shippingstate") = "" then
if Recordset1("Billingstate")="mo" then objCart.SalesTax=((objCart.SubTotal)-(objCart.Discount)) * 0.0785
else objCart.SalesTax=0
end if
end if
%>