<% Option Explicit Response.Buffer = True Dim strReferer, adsreferer strReferer = Request.ServerVariables("HTTP_REFERER") If instr(1,strReferer, "shopcart.asp") = 0 then session("adsreferer") = strReferer adsreferer = session("adsreferer") if adsreferer = "" then adsreferer = "../index.html" Dim strConnectionString strConnectionString = Application("ADS_ConnectionString") %> <% Dim strAction, strGuid Dim globintSubTotal globintSubTotal = 0 strGUID = inituser() If strGUID= "" then strGUID = 0 strAction = UCase(Left(Request("action"),3)) Select Case strAction Case "ADD" Response.Clear() Response.Redirect (adsReferer) Case "DEL" Call Remove_all(strGUID) Case "PRO" Response.Clear() Response.Redirect ("checkout.asp") Case "UPD" Call Update_cart(strGUID) Case "REM" call remove_item(Request.QueryString("id")) End Select %> AF Pharma
AF Pharma
Search  

Quote Request

<% If NOT ShoppingCart (strGUID) then %> There are no products in your quote.

 Go back to previous page
Click here to add products to your quote

 

 

<% end If %>

 
       
<% ' ------------- FUNCTIONS ------------------ function update_count(intCartID, qty ) Dim uconn Dim sqltext sqltext = "UPDATE Shopping_Cart SET Quantity = " & qty & ",DT_added=#"& now() & "# "&_ "WHERE (custGUID = '" & strGUID & "' " &_ "AND CartID = " & intCartID & ");" set uconn = Server.CreateObject("ADODB.Command") uconn.ActiveConnection = strConnectionString uconn.CommandType = 1 uconn.CommandText = sqltext uconn.Execute ,,&H00000080 set uconn = nothing end function sub update_cart(strGUID) Dim rs, New_Qty, Old_Qty, intCartID Dim sqlText, arrCart dim intTop, intLoop sqlText = "Select cartID, ProductID, Quantity from Shopping_Cart " &_ "WHERE custGUID = '" & strGUID & "' ORDER BY CartID" Set rs = Server.CreateObject("ADODB.Recordset") rs.Open sqlText,strConnectionString,0,1 if rs.EOF then rs.close set rs = nothing exit sub end if arrCart = rs.GetRows() rs.Close set rs = nothing intTop = uBound(arrCart,2) for intLoop = 0 to intTop intCartID=arrCart(0,intLoop) New_Qty=Request.Form("row" & intLoop) Old_Qty=arrCart(2,intLoop) If New_Qty <> "" Then If isNumeric(New_Qty) then New_Qty = Cint(New_Qty) Else New_Qty = Old_Qty End If Else New_Qty = 0 End If If Old_Qty <> New_Qty Then If New_Qty = 0 then Call remove_item(intCartID) Else Call update_count (intCartID, New_Qty) End If End If Next End sub sub remove_item(intCartID) Dim dconn Dim sqlText sqltext = "DELETE from Shopping_Cart " &_ "WHERE custGUID = '" & session("custGUID") & "' " &_ "AND CartID = " & intCartID set dconn = Server.CreateObject("ADODB.Command") dconn.ActiveConnection = strConnectionString dconn.CommandType = 1 dconn.CommandText = sqltext dconn.Execute ,,&H00000080 set dconn = nothing end sub function ShoppingCart ( strGUID ) Dim rs_shopCart, intTop, IntLoop, arrCount, strSQL, arrCart Dim introw, strColor, intQuantity, intTotal, strDBShip, strCost dim blnIM, blnIA Set rs_shopcart = Server.CreateObject("ADODB.Recordset") strSQL = "SELECT products.PartNo, products.Description, products.Price, Products.page, Products.ShipMethod, Shopping_Cart.CartID, Shopping_Cart.ProductID, Shopping_Cart.Quantity "&_ "FROM products INNER JOIN Shopping_Cart ON products.PartNo = Shopping_Cart.ProductID "&_ "WHERE (((Shopping_Cart.custGUID)='"& strGUID &"')) "&_ "ORDER BY Shopping_Cart.cartID;" rs_shopcart.Open strSQL, strConnectionString, 0, 1 If rs_shopcart.EOF Then rs_shopcart.Close() set rs_shopCart=nothing ShoppingCart = false exit function Else arrCart=rs_shopcart.GetRows() rs_shopcart.Close() set rs_shopCart=nothing ShoppingCart = True %> To change the quantity, edit the number in the Qty field and click "Update".
To delete an item, click on the
Remove Item
<% introw = 0 strColor = "#f6f1ed" intTop=uBound(arrCart,2) For intLoop = 0 to intTop intQuantity = arrCart (7,intLoop) intTotal = intTotal + intQuantity If strColor = "#f6f1ed" then strColor="#FFFFFF" Else strColor = "#f6f1ed" End If %> <% intRow = intRow + 1 Next %>
   Product #  Description
 Qty (kg)  
Remove Item
  <% =arrCart(0,intLoop) %> <% =arrCart(1,intLoop) %>
       

<% End If End Function %>