%@ Language=VBScript %> <% Option Explicit %> <% Response.Buffer = true %> <% function get_Discount(discount_ID, iQntProd, Product_ID, i) dim rsTemp, rsPrice, fAmount, iMin, iMax, fDiscount, temp, strtemp2, count2, aroption set rsTemp = server.CreateObject("ADODB.RECORDSET") rsTemp.CursorLocation = adUseClient set rsTemp = conn.execute("stor_Discounts_select_ID " & discount_ID) set rsPrice = conn.execute("stor_Product_select_retail_ID " & Product_ID) iMin = rsTemp("MinOrder") iMax = rsTemp("MaxOrder") fAmount = rsTemp("Amount") 'Discount based on number of items if rsTemp("Type4") = 0 then if (cint(iQntProd) >= iMin and iQntProd <= iMax) then 'Single item discount based on number of items purchased if rsTemp("Type1") = 1 and rsTemp("Type5") = 0 then 'Dollar or Percentage discount if rsTemp("Dollars") then fDiscount = fAmount response.Cookies("Product")("Discount" & i) = fDiscount else counter = 1 price = rsPrice("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) else price = cdbl(aroption(1)) end if end if counter = counter + 1 loop end if next fDiscount = fAmount * 0.01 * price * iQntProd response.Cookies("Product")("Discount" & i) = fDiscount end if end if else fDIscount = 0 end if 'Discount based on amount spent elseif rsTemp("Type4") = 1 then dim fProdAmt fProdAmt = iQntProd * rsPrice("Retail_Price") if ( fProdAmt >= iMin and fProdAmt <= iMax) then if rsTemp("Type1") = 1 and rsTemp("Type5") = 0 then 'Dollar or Percentage discount if rsTemp("Dollars") then fDiscount = fAmount response.Cookies("Product")("Discount" & i) = fDiscount else counter = 1 price = rsPrice("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) else price = cdbl(aroption(1)) end if end if counter = counter + 1 loop end if next fDiscount = fAmount * 0.01 * fProdAmt response.Cookies("Product")("Discount" & i) = fDiscount end if end if else fDiscount = 0 end if end if rsTemp.Close set rsTemp = nothing set rsPrice = nothing get_Discount = fDiscount end function function clean_shop_cart() Dim dExpire dExpire = "January 1, 1980" Response.Cookies("Product").Expires = dExpire Response.Cookies("Quantity").Expires = dExpire end function 'call clean_shop_cart Dim strSql,rsproduct, counter, aroption, price, aroptions, subtotal, totalDiscount Dim strID, iQnty, i, j, k, iQntProd, dExpire, key, iRights Dim fSubTotal, fSumTotal, iCol, sCol, sSize dim ardiscounts, rsDiscount, discount_ID, arusers, a, p 'on error resume next dim rsHeader set rsHeader = conn.execute("stor_Settings_select") session("strHeaderColor") = rsHeader("TableHeaderColor") %>
|
|