Hi I am new at this, and am trying to cusomize a sales cart
application for my web.
The boxed application allows you to select either discounts per item
or whole order discounts. All of my products would fit into the whole
order discount category, but I have one that is not elligeble for a
discount at all!
The whole order discount is setup to start when order total is equal
or over $600 and the discount ammount is a fixed amount of $60. The
item that is not elligeble for a discount costs $1215. How can I
modify the code to put an exclusion criteria for that item when
calculating the whole order discount?
Here is the code on the page:
<%@ LANGUAGE="VBScript.Encode" %>
<!--#include virtual="/cgi-bin/GetOrder.asp"-->
<!--#include virtual="/cgi-bin/codepage.asp"-->
<!--#include virtual="/cgi-bin/ADOVBS.inc"-->
<!--#include virtual="/cgi-bin/IASUtil.asp"-->
<%
coupon = FGETVar("coupon","","s")
'READ STUFF From Database
Dim objSimpleAdo, rstRS, SQLStmt
SQLStmt = "SELECT * From item "
SQLStmt = SQLStmt & "WHERE [Orderid] =" & Order & "; "
Set SimpleAdo = New CSimpleAdo
SimpleAdo.setConnectionString = Session("ConnectionString")
Set RS = SimpleAdo.getRecordSet(SQLStmt)
'Do stuff with the record set
'Initialize variables for this application
thedate = Cstr(Date) 'get the date
thetime = Cstr(Time) 'get the time
subtotal = 0 'the subtotal for a row of items
subweight = 0 'the subweight for a row of items
subsize = 0 'the subsize for a row of items
subquantity = 0 'the subquantity for a row of items
subship = 0 'the subshipping for a row of items
subhand = 0 'the subhandling for a row of items
%>
<%
'Calculate the individual totals for a row
subweight = subweight + (RS("Quantity") * RS("Weight"))
subsize = subsize + (RS("Quantity") * RS("Size"))
subtotal = (RS("Quantity") * RS("Price"))
subquantity = subquantity + RS("Quantity")
subship = subship + (RS("Quantity") * RS("ExtraShip"))
subhand = subhand + (RS("Quantity") * RS("ExtraHand"))
total = MyCurrency (CCur(subtotal))
grandtotal = grandtotal + subtotal
%>
'Do item discount
If RS("Price") <> 0 Then
If RS("Price")/RS("RawPrice") <> 1 Then
itemdiscount = 100-(RS("Price")/RS("RawPrice") * 100)
strdisplay = "<font color=#BB0000> (" & Round(itemdiscount,2) & "%
off)</font>"
Response.write(strdisplay)
End If
End If
'Here is where I think the code should be modified. I tried several
ways but it does not work
<%'do whole order discount here Original
'Dim discountarray(1)
Set DiscountObj = New CDiscountObj
'If RS("Price") = 1215 Then
'discountarray = DiscountObj.wholeDiscount (subtotal + 60)
'Else
discountarray = DiscountObj.wholeDiscount (grandtotal)
'End If
'discountarray(1) = DiscountObj.wholeDiscount (grandtotal)
'discountarray(2) = "HELOOOOOOOOOOOO"
Set DiscountObj = Nothing
'Next do COUPON DISCOUNTS
If Session("ChkCoupons") > 0 then
'Dim discountarray(0)
'If RS("Price") = 1215 Then
'discountarray = 0
'Else
Set DiscountObj = New CDiscountObj
discountarray = DiscountObj.couponDiscount (discountarray,coupon)
Set DiscountObj = Nothing
'End If
End If
%>
<%
If discountarray(0) = 1 Then
If RS("Price") = 1215 Then
Response.write("<font color=#BB0000>(Total was " & MyCurrency
(CCur(discountarray(1))) & " Discounts do not apply to webinars)</
font>")
Else
Response.write("<font color=#BB0000>(Total was " & MyCurrency
(CCur(discountarray(1))) & " Discount of $60.00 Applied)</font>")
Response.write (MyCurrency (CCur(RS("Price"))))
End IF
End If
%>
Any help would be appreciated!
PS. I omited the HTML tables that display the results.