Hello,
I am trying to implement a sales cart application that uses VBScript
and writes the data to an Access database. This is a prepackage
software that I am trying to customize for my needs.
THe problem I am having is with a function that captures the country
where the order is coming from and selects from the database the
appropriate shipping costs. The default is the US. I am trying to avoid
having to enter a specific shipping cost for every country (I offer 4)
and would like to be able to use an If statement that would basically
say something like:
If country <> US then charge the shipping for country = OUS
I never used VBScript, .asp and Access together and am not getting much
help from tech support.
Any suggestion would be appreciated. Here is the code:
<%
order = Session("orderid")
checkstatus = "checked"
If IsEmpty(Session("computeship")) Or Session("computeship") = "" or
Session("computeship") = " " Then
computeship = 1
Else
computeship = Session("computeship")
End If
computemethod = FGetVar("computemethod",1,"n")
country = FGetVar("country","US","s")
'maria's code starts here
If country <> US then
country = FGerVar("country","AU","s")
End If
'READ STUFF to Database
Dim SimpleAdo, rstRS, SQLStmt
SQLStmt = "SELECT * FROM [order] "
SQLStmt = SQLStmt & "WHERE orderid=" & order & ";"
Set SimpleAdo = New CSimpleAdo
SimpleAdo.setConnectionString = Session("ConnectionString")
Set RS = SimpleAdo.getRecordSet(SQLStmt)
If CheckRS(RS) Then
subtotal = RS("subtotal")
subhand = RS("subhand")
subship = RS("subship")
End If
Set SimpleAdo = Nothing
Set RS = Nothing
'initialize variables
shipx = 0 'initial counter specifying what radio button was selected
dim theshipping(50,3) 'holds shipping information
dim shipdescription(50) 'holds shipping descriptions
dim shipcost(50) 'holds shipping costs
i = 0 'loop counter
'Determine if Free shipping applies
If CDbl(subtotal) > CDbl(Session("TxtFreeShipping")) Then
computemethod = 6
End If
'shipping based on Look-up tables
'read database variables into an array to save shipping variables
tablebased = True
'READ STUFF from Database
SQLStmt = "SELECT * From [x-Shipping] "
SQLStmt = SQLStmt & "WHERE Destination = '" & country & "' "
SQLStmt = SQLStmt & "and LowW<" & computeship & " and HighW>=" &
computeship & " "
SQLStmt = SQLStmt & "ORDER BY Cost; "
Set SimpleAdo = New CSimpleAdo
SimpleAdo.setConnectionString = Session("ConnectionString")
Set RS = SimpleAdo.getRecordSet(SQLStmt)
do until RS.eof
theshipping(i,1) = RS("Type")
theshipping(i,2) = RS("Service")
theshipping(i,3) = RS("Cost")
shipdescription(i) = RS("Description")
shipcost(i) = MyCurrency(theshipping(i,3))
i=i+1
RS.MoveNext
Loop
Set SimpleAdo = Nothing
Set RS = Nothing
End Select
subweight = computeship
j = i 'save # of rows
i = 0 'loop counter
%>