<%=rsproduct("SKU")%>
<%=rsproduct("Name")%>
<%
counter = 1
for j = 1 to session("numoptions")
if Request.Cookies("Product")("Option" & j & "_" & i) <> "" then
Response.Write(" Option: ")
exit for
end if
next
do while counter <= session("numoptions")
aroptions = split(Request.Cookies("Product")("Option" & counter & "_" & i),"^", -1, 0)
if ubound(aroptions) >=1 then
Response.Write(aroptions(0))
end if
if len(Request.Cookies("Product")("Option" & counter + 1 & "_" & i)) > 2 and len(Request.Cookies("Product")("Option" & counter & "_" & i)) > 2 then
Response.Write(", ")
end if
counter = counter + 1
loop
'Check to see if any Product Level discounts apply
if rsProduct("Discounts") > "" or len(rsProduct("Discounts")) > 1 then
ardiscounts = split(rsProduct("Discounts"),",")
if ubound(ardiscounts) <= 0 then
discount_ID = cint(arDiscounts(0))
set rsDiscount = server.CreateObject("ADODB.RECORDSET")
rsDiscount.CursorLocation = adUseClient
set rsDiscount = conn.execute("stor_Discounts_select_ID " & discount_ID)
do while not rsDiscount.eof
if cdbl(iqntProd) < rsDiscount("MinOrder") then
TotalDiscount = totalDiscount - request.Cookies("Product")("Discount" & i)
response.Cookies("Product")("Discount" & i) = 0
end if
if (rsDiscount("Type3") = 0 and rsDiscount("Type1") = 1 and rsDiscount("Type5") = 0) then
'Single item product-level discount available to all users
Response.Write("Special: " & rsDiscount("Display"))
totalDiscount = totalDiscount + get_Discount(discount_ID, cdbl(iQntProd), strID, i)
end if
if (rsDiscount("Type3") = 0 and rsDiscount("Type1") = 1 and rsDiscount("Type5") = 1) then
'Single item product-level discount available to selected users
arusers = split(rsDiscount("Users"),",")
if ubound(arusers) = 0 then
if cint(session("User_ID")) = cint(arusers(0)) then
Response.Write("Special: " & rsDiscount("Display"))
end if
else
if ubound(arusers) > 0 then
for a = lbound(arusers) to ubound(arusers)
if cint(session("User_ID")) = cint(arusers(a)) then
Response.Write("Special: " & rsDiscount("Display"))
exit for
end if
next
end if
end if
end if
rsdiscount.movenext
loop
rsDiscount.Close
set rsDiscount = nothing
else 'Multiple Discounts for a single product
for p = lbound(ardiscounts) to ubound(ardiscounts)
strDiscounts = strDiscounts & arDiscounts(p) & ","
next
strDiscounts = left(strDiscounts, len(strDiscounts) - 1)
set rsDiscounts = server.CreateObject("ADODB.RECORDSET")
set rsDiscounts = conn.execute("stor_Discounts_select_in '" & strDiscounts & "'")
iCount = 0
do while not rsDiscounts.EOF
discount_ID = rsDiscounts("discount_ID")
set rsDiscount = server.CreateObject("ADODB.RECORDSET")
rsDiscount.CursorLocation = adUseClient
set rsDiscount = conn.execute("stor_Discounts_select_ID " & discount_ID)
if not rsDiscount.EOF then
if iCount = 0 then
if rsDiscount("Type4") = 0 then
if cdbl(iqntProd) < rsDiscount("MinOrder") then
TotalDiscount = totalDiscount - request.Cookies("Product")("Discount" & i)
response.Cookies("Product")("Discount" & i) = 0
end if
elseif rsDiscount("Type") = 1 then
if cdbl(iQntProd) * rsProduct("retail_price") < rsDiscount("MinOrder") then
TotalDiscount = totalDiscount - request.Cookies("Product")("Discount" & i)
response.Cookies("Product")("Discount" & i) = 0
end if
end if
end if
totalDiscount = totalDiscount + get_Discount(discount_ID, cdbl(iQntProd), strID, i)
if (rsDiscount("Type3") = 0 and rsDiscount("Type1") = 1 and rsDiscount("Type5") = 0) then
'Single item product-level discount available to all users
Response.Write("Special: " & rsDiscount("Display"))
end if
if (rsDiscount("Type3") = 0 and rsDiscount("Type1") = 1 and rsDiscount("Type5") = 1) then
'Single item product-level discount available to selected users
arusers = split(rsDiscount("Users"),",")
if ubound(arusers) = 0 then
if cint(session("User_ID")) = cint(arusers(0)) then
Response.Write("Special: " & rsDiscount("Display"))
end if
else
if ubound(arusers) > 0 then
for a = lbound(arusers) to ubound(arusers)
if cint(session("User_ID")) = cint(arusers(a)) then
Response.Write("Special: " & rsDiscount("Display"))
exit for
end if
next
end if
end if
end if
end if
rsDiscount.Close
set rsDiscount = nothing
iCount = iCount + 1
rsDiscounts.MoveNext
loop
rsDiscounts.Close
set rsDiscounts = nothing
end if
end if
%>
onchange="recalculateOrder();" ID="Text1">
<%
counter = 1
dim temp, strtemp2, count2
price = rsproduct("retail_price")
for count2 = 1 to session("numoptions")
if Request.Cookies("Product")("Option" & count2 & "_" & i) > "" then
do while counter <= session("numoptions")
aroption = split(Request.Cookies("Product")("Option" & counter & "_" & i),"^", -1, 0)
if ubound(aroption) >= 1 then
if left(aroption(1),4) = "plus" then
temp = replace(aroption(1), "plus", "")
price = price + cdbl(temp)
elseif left(aroption(1),2) = "No" then
price = price + 0
else
price = cdbl(aroption(1))
end if
end if
counter = counter + 1
loop
end if
next
subtotal = subtotal + price*iQntprod
Response.Cookies("subtotal") = subtotal
Response.Cookies("Order")("PriceAfterOptions" & i) = price
%>
<%=formatcurrency(price)%>
<%=formatcurrency(price*iQntprod)%>
<%end if
rsproduct.Close%>
<%next
Set rsproduct = Nothing%>