<%@ LANGUAGE = "VBScript" %> <% '----------------------------------------------------------- ' ASPilot.com - Gateway ' ------------------------------ ' Copyright © 2004 Spliethof Inc ' ' This file lists all the customer account interface for the ' shopping cart. PilotInitialize GetCurrentCustomer MarkCurrentCustomerActive mode = EStr(Request.QueryString("mode")) If Not IsNumeric(mypage) Then mypage = 1 ElseIf mypage = "" Then mypage = 1 Else mypage = Int(mypage) End If '----------------------------------------------------------- ' GetItemGroupsRS ' --------------- ' Returns a recordset with all groups assigned to an ' inventory item. '----------------------------------------------------------- Function GetItemGroupsRS(ByVal lngItemID) Dim strSQL lngItemID = ELng(lngItemID) strSQL = "SELECT GroupID, Name, Descrip FROM tblGroups WHERE GroupID IN (SELECT GroupID FROM tblInventoryGroups WHERE ItemID "& CSQLEq(lngItemID) &") ORDER BY Name ASC" Set GetItemGroupsRS = OpenReadOnlyRS(strSQL) End Function '----------------------------------------------------------- ' GetQuantityInStock ' ------------------ ' Returns a quantity in stock for an item and its modifiers. '----------------------------------------------------------- Function GetQuantityInStock(itemId, SelectedModifiers) Dim rs, rsITEM, qtyinstock, validComplex, complexQis, strSQL, intQnty Set rs = OpenFastRS("SELECT * FROM TBLINVENTORY WHERE ITEMID = "&itemID) validComplex = True complexQis = rs("ComplexQIS") If Trim(complexQis) = "" Then validComplex = False If IsNull(complexQis) = True Then validComplex = False If Trim(rs("QIS")) <> "" Then qtyinstock = rs("QIS") If validComplex = True Then qis = Split(complexQis, ",") selectString = "" For Each item In SelectedModifiers If Not (InStr(1, item, "Cost") > 0) Then selectString = selectString & SelectedModifiers(item) & "&" Next s = Split(selectString, "&") 'Order the list so it's always in ascending order, the way the DB should be i = 0 Do Until i > UBound(s) - 1 If Trim(s(i)) = "" Or Trim(s(i + 1)) = "" Then Exit Do If CLng(s(i)) > CLng(s(i + 1)) Then t = s(i) s(i) = s(i + 1) s(i + 1) = t If i > 0 Then i = i - 1 Else i = i + 1 End If CheckConnection Loop selectString = Join(s, "&") For i = 0 To UBound(qis) a = InStr(1, qis(i), ":") If a > 0 Then If Left(qis(i), a - 1) & "&" = selectString Then qtyinstock = Split(qis(i), ":")(1) Exit For End If End If Next End If rs.Close Set rs = Nothing GetQuantityInStock = qtyInStock End Function specific = Decrypt(Request.QueryString("specific")) mode = Request.QueryString("mode") If Request.Form("LinkTo") <> "" Then Response.Redirect"product.asp?specific="&Request.Form("LinkTo") Select Case mode Case "login_add" If Not PilotPageBegin("products", Empty) Then Response.Redirect g.HomePageURL & "pilot.asp" B2BCheckLogin "products" If IsLoggedIn() Then strSQL = "SELECT MINQUANTITY FROM TBLINVENTORY WHERE ITEMID="&specific Set rsITEM = cnPILOT.Execute(strSQL) intQnty = 1 If NOT rsITEM.EOF Then intQnty = rsITEM(0) rsITEM.Close : Set rsITEM = Nothing If AddItemToCart(specific, intQnty) Then Response.Redirect g.secureURL & "cart.asp" End If Response.Write img1 & pc & "
" Set SelectedModifiers = ParseSelectedModifiers modArray = SelectedModifiers.Items QuickSortArray modArray, 0, UBound(modArray) strMods = EStr(Join(modArray, COMPLEX_MODIFIER_SEPARATOR)) DisplayLogin g.SecureURL & "product.asp?mode=login_add&specific=" & Request.QueryString("specific") & ModKeyToURL(strMods), g.SecureURL & "product.asp?mode=login_add&specific=" & Request.QueryString("specific") & ModKeyToURL(strMods) Case Else DisplaySpecficItem End Select TemplateAfterPC PilotPageEnd %>