<%@ 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") %> View Shopping Cart

" border=1> <% iQnty = Request.Cookies("Quantity") if iQnty="" then iQnty = 0 if iQnty > 0 then dim fShippingTotal, fTaxTotal Set rsproduct = Server.CreateObject("ADODB.Recordset") rsproduct.CursorType = adOpenStatic rsproduct.LockType = adLockOptimistic fSumTotal = 0 TotalDiscount = 0 fShippingTotal = 0 fTaxTotal = 0 For i = 1 to iQnty strID = Request.Cookies("Product")("P" & i) iQntProd = Request.Cookies("Product")("Q" & i) if iQntprod = "" then iQntprod = 1 strSql = "stor_get_more_info " & strID 'Response.Write(strsql) & "
" Set rsproduct = Conn.Execute(strSql) if (Err<>0) then Set rsproduct = Nothing Conn.Close Set Conn = Nothing else fSubTotal = CDbl(rsproduct("retail_price")) * CInt(iQntprod) fSumTotal = fSumTotal + fSubTotal if rsProduct("Shipping") then fShippingTotal = fShippingTotal + rsProduct("retail_price") * CInt(iQntprod) if rsProduct("Tax") then fTaxTotal = fTaxTotal + rsProduct("retail_price") * CInt(iQntprod) %> <%end if rsproduct.Close%> <%next Set rsproduct = Nothing%> <%else 'iQnty=0%> <% response.Cookies("TotalDiscount") = totalDiscount subtotal = subtotal - totalDiscount Response.Cookies("subtotal") = subtotal end if%>
" colSpan=6>Shopping Cart
Item No. Item to Purchase Qty. Price after Options Ext. Price Remove
<%=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_Discount_select_ID " & discount_ID) do while not rsDiscount.eof if cdbl(iqntProd) < rsDiscount("MinOrder") then response.Cookies("Product")("Discount" & i) = 0 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_Discount_select_ID " & discount_ID) if not rsDiscount.EOF then if iCount = 0 then if rsDiscount("Type4") = 0 then if cdbl(iqntProd) < rsDiscount("MinOrder") then response.Cookies("Product")("Discount" & i) = 0 elseif rsDiscount("Type") = 1 then if cdbl(iQntProd) * rsProduct("retail_price") < rsDiscount("MinOrder") then response.Cookies("Product")("Discount" & i) = 0 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 if request.Cookies("Product")("Size" & i) > "" then response.Write("
Size: " & request.Cookies("Product")("Size" & i)) end if %>
> <% 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("ShippingTotal") = fShippingTotal response.Cookies("TaxTotal") = fTaxTotal Response.Cookies("Order")("PriceAfterOptions" & i) = price %> <%=formatcurrency(price)%> <%=formatcurrency(price*iQntprod)%>


Currently, there are no records in the Shopping Cart.

<%end if %> <% if totalDiscount > 0 then %>
Total Discount: <%=formatcurrency(totalDiscount)%>  
Subtotal: <%=formatcurrency(subtotal)%>  

 

<% conn.close set conn = nothing %>