<%@ Language=VBScript %> <% option explicit Response.Buffer = True '@BEGINVERSIONINFO '@APPVERSION: 5.10.10 '@FILENAME: search_results.asp '@FILEVERSION: 1.0.1 '@VERSIONDATETIME: 2/21/01 '@DESCRIPTION: Displays search results '@STARTCOPYRIGHT 'The contents of this file is protected under the United States 'copyright laws and is confidential and proprietary to 'LaGarde, Incorporated. Its use or disclosure in whole or in part without the 'expressed written permission of LaGarde, Incorporated is expressly prohibited. ' '(c) Copyright 2000, 2001 by LaGarde, Incorporated. All rights reserved. '@ENDCOPYRIGHT '@ENDVERSIONINFO ' Constant Declarations const varDebug = 0 'DeBug Setting const iPageSize = 10 'Records Per Page const iMaxRecords = 0 'Maximum amount of records returned, 0 is no maximum Dim txtsearchParamTxt, txtsearchParamType, txtsearchParamCat, txtFromSearch, txtsearchParamMan Dim txtCatName, txtsearchParamVen, txtImagePath, txtOutput, txtDateAddedStart Dim txtDateAddedEnd, txtPriceStart, txtPriceEnd, txtSale, SQL, sAmount, rsCatImage Dim iAttCounter, irsSearchAttRecordCount, iAttDetailCounter, irsSearchAttDetailRecordCount Dim iPage, iRec, iNumOfPages, iDesignCounter, iVarPageSize, iSearchRecordCount, icounter, iDesign Dim rsCat, rsSearch, rsSearchAtt, rsSearchAttDetail, arrAttDetail, arrProduct, arrAtt, rsManufacturer, rsVendor dim CurrencyISO iDesign = C_DesignType 'Layout Selection iDesignCounter = 2 iVarPageSize = iPageSize ' Records Per Page txtFromSearch = Trim(Request.Form("txtFromSearch")) ' Requests the variables depending on how the page is entered If txtFromSearch = "fromSearch" Then txtsearchParamTxt = trim(Replace(Replace(Request.Form("txtsearchParamTxt"), "'", "''"), "*", "")) txtsearchParamType = trim(Request.Form("txtsearchParamType")) txtsearchParamCat = trim(Request.Form("txtsearchParamCat")) txtsearchParamMan = trim(Request.Form("txtsearchParamMan")) txtsearchParamVen = trim(Request.Form("txtsearchParamVen")) txtDateAddedStart = MakeUSDate(trim(Request.Form("txtDateAddedStart"))) txtDateAddedEnd = MakeUSDate(trim(Request.Form("txtDateAddedEnd"))) txtPriceStart = trim(Request.Form("txtPriceStart")) txtPriceEnd = trim(Request.Form("txtPriceEnd")) txtSale = trim(Request.Form("txtSale")) Else txtsearchParamTxt = trim(Replace(Replace(Request.QueryString("txtsearchParamTxt"), "'", "''"), "*", "")) txtsearchParamType = trim(Request.QueryString("txtsearchParamType")) txtsearchParamCat = trim(Request.QueryString("txtsearchParamCat")) txtsearchParamMan = trim(Request.QueryString("txtsearchParamMan")) txtsearchParamVen = trim(Request.QueryString("txtsearchParamVen")) txtDateAddedStart = MakeUSDate(trim(Request.QueryString("txtDateAddedStart"))) txtDateAddedEnd = MakeUSDate(trim(Request.QueryString("txtDateAddedEnd"))) txtPriceStart = trim(Request.QueryString("txtPriceStart")) txtPriceEnd = trim(Request.QueryString("txtPriceEnd")) txtSale = trim(Request.QueryString("txtSale")) End If %> <% CurrencyISO = getCurrencyISO(Session.LCID) If iConverion = 1 Then Response.Write "" Set rsSearch = Server.CreateObject("ADODB.RecordSet") ' ------------------------------------------- ' RecordSet Paging Setup -------------------- ' ------------------------------------------- SQL = getProductSQL(txtsearchParamType, txtsearchParamTxt, txtsearchParamCat, txtsearchParamMan, _ txtsearchParamVen, txtDateAddedStart, txtDateAddedEnd, txtPriceStart, txtPriceEnd, txtSale) If varDebug = 1 Then Response.Write SQL & "

" With rsSearch .CursorLocation = adUseClient .CacheSize = iVarPageSize .MaxRecords = iMaxRecords .Open SQL, cnn, adOpenForwardOnly, adLockReadOnly, adCmdText .PageSize = iVarPageSize End With ' Determine the page user is requesting If Request.QueryString("PAGE") = "" Then iPage = 1 Else iPage = CInt(Request.QueryString("PAGE")) ' Protect against out of range pages, in case ' of a user specified page number If iPage < 1 Then iPage = 1 Else If iPage > rsSearch.PageCount Then iPage = rsSearch.PageCount Else iPage = CInt(Request.QueryString("PAGE")) End If End If End If iSearchRecordCount = rsSearch.RecordCount iNumOfPages = Int(iSearchRecordCount / iPageSize) If CInt(iNumOfPages+1) = CInt(iPage) Then iVarPageSize = rsSearch.RecordCount - (iNumOfPages * iPageSize) If NOT rsSearch.EOF Then rsSearch.AbsolutePage = CInt(iPage) ' Create Attribute Record Sets for product on page SQL = getAttributeSQL(rsSearch, iVarPageSize, iPage) If varDebug = 1 Then Response.Write SQL & "

" Set rsSearchAtt = Server.CreateObject("ADODB.RecordSet") If SQL <> "" Then rsSearchAtt.Open SQL, cnn, adOpenKeyset, adLockReadOnly, adCmdText SQL = getAttributeDetailSQL(rsSearchAtt) If varDebug = 1 Then Response.Write SQL & "

" If SQL <> "" Then Set rsSearchAttDetail = Server.CreateObject("ADODB.RecordSet") rsSearchAttDetail.Open SQL, cnn, adOpenKeyset, adLockReadOnly, adCmdText End If End If If txtsearchParamCat = "ALL" Then txtCatName = "All " & C_CategoryNameP Else If Not rsSearch.EOF Then txtCatName = rsSearch.Fields("catName") Else Set rsCat = Server.CreateObject("ADODB.RecordSet") SQL = getCategorySQL(txtsearchParamCat) rsCat.Open SQL, cnn, adOpenForwardOnly, adLockReadOnly, adCmdText txtCatName = rsCat.Fields("catName") closeObj(rsCat) End If End If If txtsearchParamTxt = "" Then txtsearchParamTxt = "*" 'Corrects Number of Pages if there is overflow less then records per page If iSearchRecordCount mod iPageSize <> 0 Then iNumOfPages = iNumOfPages + 1 %> SF Search Engine Output Page
<%If C_BNRBKGRND = "" Then%> <%Else%> <%End If%>
<%= C_STORENAME %>
 
Search Results
Check Out
Search for: <%= txtsearchParamTxt %> in <%= C_CategoryNameS %>: <%= txtCatName %><% If txtsearchParamMan <> "ALL" Then SQL = "SELECT mfgName FROM sfManufacturers WHERE mfgID = " & txtsearchParamMan Set rsManufacturer = Server.CreateObject("ADODB.RecordSet") rsManufacturer.Open SQL, cnn, adOpenForwardOnly, adLockReadOnly, adCmdText Response.write ", " & C_ManufacturerNameS & ": " & rsManufacturer.Fields("mfgName") & "" closeObj(rsManufacturer) End If If txtsearchParamVen <> "ALL" Then SQL = "SELECT vendName FROM sfVendors WHERE vendID = " & txtsearchParamVen Set rsVendor = Server.CreateObject("ADODB.RecordSet") rsVendor.Open SQL, cnn, adOpenForwardOnly, adLockReadOnly, adCmdText Response.write ", " & C_VendorNameS & ": " & rsVendor.Fields("vendName") & "" closeObj(rsVendor) End If %>
<%= iSearchRecordCount %> Records Returned <%= iVarPageSize %> Records Displayed.
New Search|Advanced Search

<% If iNumOfPages <> 1 And iNumOfPages <> 0 Then Response.Write bottomPaging(iPage, iPageSize, iSearchRecordCount, iNumOfPages, "Search") %>


<% ' ------------------------------------------- ' Empty Search Results ---------------------- ' ------------------------------------------- If rsSearch.EOF Then txtOutput = "" _ & "" _ & "" _ & "" _ & "" _ & "" _ & "
Sorry, No Matching Records Returned!

" _ & "
" Response.Write txtOutput 'Response.End Else ' ------------------------------------------- ' SEARCH RESULT PRODUCT OUTPUT ::: BEGIN ---- ' ------------------------------------------- 'create arrays for display arrProduct = rsSearch.GetRows(iVarPageSize) If Not rsSearchAtt.EOF Then arrAtt = rsSearchAtt.GetRows irsSearchAttRecordCount = rsSearchAtt.RecordCount-1 If Not rsSearchAttDetail.EOF Then arrAttDetail = rsSearchAttDetail.GetRows irsSearchAttDetailRecordCount = rsSearchAttDetail.RecordCount-1 End If End If For iRec = 0 to iVarPageSize-1 ' Set Default Image if none specified for product If arrProduct(2, iRec) = "" Then Set rsCatImage = Server.CreateObject("ADODB.RecordSet") SQL = "SELECT catImage FROM sfCategories WHERE catID = " & arrProduct(10, iRec) rsCatImage.Open SQL, cnn, adOpenForwardOnly, adLockReadOnly, adCmdText txtImagePath = rsCatImage.Fields("catImage") closeObj(rsCatImage) Else txtImagePath = arrProduct(2, iRec) End If icounter = 1 %>
<% If iDesign = "1" Then %> <% ElseIf iDesign = "3" And (iDesignCounter / 2) = Int(iDesignCounter / 2) Then%> <% End If %> <% If iDesign = "2" Then %> <% ElseIf iDesign = "3" And (iDesignCounter / 2) <> Int(iDesignCounter / 2) Then %> <% End If %> <% Response.Write "
<%If txtImagePath <> "" Then%><%ElseIf Trim(arrProduct(3, iRec)) <> "" Then %>Link <%End If%>
<%If txtImagePath <> "" Then%><%ElseIf Trim(arrProduct(3, iRec)) <> "" Then %>Link<%End If%>
<%= C_ProductID %>: <%= arrProduct(0, iRec) %>    <%= C_CategoryNameS %>: <%= arrProduct(7, iRec) %>
<%= arrProduct(1, iRec) %>
<%= C_Description %>: <%If arrProduct(11, iRec) <> "" Then%><%= arrProduct(11, iRec) %><%Else%><%= arrProduct(8, iRec) %><%End If%>
<%= C_Price %>:  <% If iConverion = 1 Then If arrProduct(5, iRec) = 1 Then Response.Write "
" Response.Write "" & C_SPrice & ":
" Response.Write "" & C_YSave & ":
" Else Response.Write "" End If Else If arrProduct(5, iRec) = 1 Then Response.Write "" & FormatCurrency(arrProduct(4, iRec)) & "
" Response.Write "" & C_SPrice & ": " & FormatCurrency(arrProduct(6, iRec)) & "
" Response.Write "" & C_YSave & ": " & FormatCurrency(CDbl(arrProduct(4, iRec))-CDbl(arrProduct(6, iRec))) & "
" Else Response.Write FormatCurrency(arrProduct(4, iRec)) End If End If %>

<% ' ------------------------------------------- ' SEARCH RESULT ATTRIBUTE OUTPUT ::: BEGIN -- ' ------------------------------------------- If irsSearchAttRecordCount <> "" Then For iAttCounter = 0 to irsSearchAttRecordCount If arrProduct(0, iRec) = arrAtt(2, iAttCounter) Then %> <% icounter = icounter + 1 End If Next End If ' ------------------------------------------- ' SEARCH RESULT ATTRIBUTE OUTPUT ::: END ' ------------------------------------------- %>
<%= arrAtt(1, iAttCounter) %>

<%= C_Quantity %>:

<% If iSaveCartActive = 1 Then%> <% End if If iEmailActive = 1 Then %> Email a Friend <% End If %>

<%If txtImagePath <> "" Then%><%ElseIf Trim(arrProduct(3, iRec)) <> "" Then %>Link<%End If%>
<%If txtImagePath <> "" Then%><%ElseIf Trim(arrProduct(3, iRec)) <> "" Then %>Link<%End If%>

" Response.Flush If iDesign = "3" Then iDesignCounter = iDesignCounter + 1 Next ' ------------------------------------------- ' SEARCH RESULT PRODUCT OUTPUT ::: END ------ ' ------------------------------------------- End If %>

<% ' ------------------------------------------- ' SEARCH RESULT PAGING OUTPUT ::: BEGIN ----- ' ------------------------------------------- If iNumOfPages <> 1 And iNumOfPages <> 0 Then Response.Write bottomPaging(iPage, iPageSize, iSearchRecordCount, iNumOfPages, "Search") ' ------------------------------------------- ' SEARCH RESULT PAGING OUTPUT ::: END ------- ' ------------------------------------------- %>

<% ' Object Cleanup closeObj(rsSearch) closeObj(rsSearchAtt) closeObj(rsSearchAttDetail) closeObj(cnn) %>