%@LANGUAGE="VBSCRIPT"%><%UC_OrderIdSessionVar = "ORDERnum"If Session(UC_OrderIdSessionVar)="" Then ' Get a unique OrderID number and save to session. UC_tableName = "ORDERnum" UC_fieldName = "ORDERnum" UC_sql = "select " & UC_fieldName & " from " & UC_tableName tmp = "ADODB.Recordset" set UC_rsId = Server.CreateObject(tmp) UC_rsId.ActiveConnection = "dsn=upland;" UC_rsId.Source = UC_sql UC_rsId.CursorType = 0 ' adOpenForwardOnly UC_rsId.CursorLocation = 2 ' adUseServer UC_rsId.LockType = 2 ' adLockPessimistic UC_rsId.Open Session(UC_OrderIdSessionVar) = UC_rsId.Fields(UC_fieldName).value UC_rsId.Fields(UC_fieldName).value = Session(UC_OrderIdSessionVar) + 1 UC_rsId.Update UC_rsId.Close set UC_rsId = NothingEnd If%> <%UC_CartColNames=Array("ProductID","Quantity","Name","Price","dates","Total")UC_ComputedCols=Array("","","","","","Price")set UCCart1=VBConstuctCart("UCCart",0,UC_CartColNames,UC_ComputedCols)UCCart1__i=0%> <%set hunts = Server.CreateObject("ADODB.Recordset")hunts.ActiveConnection = "dsn=upland;"hunts.Source = "SELECT * FROM products"hunts.CursorType = 0hunts.CursorLocation = 2hunts.LockType = 3hunts.Openhunts_numRows = 0%><%Dim Repeat1__numRowsRepeat1__numRows = -1Dim Repeat1__indexRepeat1__index = 0hunts_numRows = hunts_numRows + Repeat1__numRows%><%' *** Add item to UC Shopping cartset UC_rs=huntsUC_uniqueCol="ProductID"UC_AddLink=""If (Request.QueryString = "") Then UC_AddLink = Request.ServerVariables("URL") & "?UC_AddId="Else UC_AddLink = Request.ServerVariables("URL") & "?" & Request.QueryString & "&UC_AddId="End IfUC_AddId = CStr(Request("UC_AddId"))If (UC_AddId <> "") Then UC_redirectPage = "cart.asp" If (NOT (UC_rs is Nothing)) Then ' Position recordset to correct location If (UC_rs.Fields.Item(UC_uniqueCol).Value <> UC_AddId) Then ' reset the cursor to the beginning If (UC_rs.CursorType > 0) Then If (Not UC_rs.BOF) Then UC_rs.MoveFirst Else UC_rs.Close UC_rs.Open End If Do While (Not UC_rs.EOF) If (Cstr(UC_rs.Fields.Item(UC_uniqueCol).Value) = UC_AddId) Then Exit Do End If UC_rs.MoveNext Loop End If End If UC_BindingTypes=Array("RS","LITERAL","RS","RS","RS","NONE") UC_BindingValues=Array("ProductID","1","Name","Price","dates","") UCCart1.AddItem UC_rs,UC_BindingTypes,UC_BindingValues,"increment" ' always redirect to remove the "UC_AddId" query param. if (UC_redirectPage = "") Then UC_redirectPage = CStr(Request.ServerVariables("URL")) If (InStr(1, UC_redirectPage, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then newQS = "?" For Each Item In Request.QueryString If (Item <> "UC_AddId") Then If (Len(newQS) > 1) Then newQS = newQS & "&" newQS = newQS & Item & "=" & Server.URLencode(Request.QueryString(Item)) End If Next if (Len(newQS) > 1) Then UC_redirectPage = UC_redirectPage & newQS End If Response.Redirect(UC_redirectPage)End If%>
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||