<% '**************************default.htm********************************' dim objEndConn dim objQuery dim objResults dim queryString dim urlGenDefault dim objNavResults dim intNumResults dim blnRefinementsPresent dim hadNu dim strNavKeywords, strBreadCrumbTitle dim intLenQString dim strQString dim blnBadCharFound dim intCtr_I dim intASCIICode dim intSupCount strNavKeywords = "" strBreadCrumbTitle = "" hadNu = false set objEndConn = Server.CreateObject("Endeca.HttpENEConnection") objEndConn.Hostname = Application("ENDECA_HOSTNAME") objEndConn.Port = Application("ENDECA_PORT") set objQuery = Server.CreateObject("Endeca.UrlENEQuery") queryString = Request.QueryString set urlGenDefault = Server.CreateObject("Endeca.UrlGen") urlGenDefault.init queryString, "UTF-8" '09/22/2005 - AAP - Added because some external sites were linking to our product pages with 'multiple settings for dept_id, causing a comma to separate the values. This finds the comma, 'and sets dept_id with the appropriate first value. dim intCommaPos dim intDeptId intDeptId = int(request.querystring("dept_id")) intCommaPos = instr(intDeptId,",") if intCommaPos > 0 then intDeptId = left(intDeptId,intCommaPos - 1) urlGenDefault.removeparam "dept_id" urlGenDefault.addparam "dept_id", intDeptId querystring = urlGenDefault.querystring set objResults = nothing set objEndConn = nothing set urlGenDefault = nothing redirect ("default.htm?" & querystring) end if if len(request.querystring("Ntk")) <> 0 and len(request.querystring("Ntt")) = 0 then 'searched on nothing, redirect to prod index. set objResults = nothing set objEndConn = nothing set objQuery = nothing redirect("/products/") end if '08/31/2006 - AAP - Removing hard-coded redirect to ez facts, and replacing with a Keyword Redirect. ''10/18/2005 - AAP - Added a check for ez+facts, because our testers want our users to be ''able to find the EZ Facts document list. 'if lcase(request.querystring("Ntt")) = "ez facts" then ' set objResults = nothing ' set objEndConn = nothing ' set objQuery = nothing ' response.redirect("../refinfo/ezfacts/default.htm") 'end if '10/11/2005 - AAP - Filter-out bad characters from search string intLenQString = len(request.querystring("Ntt")) if intLenQString > 0 then blnBadCharFound = false strQString = "" for intCtr_I = 1 to intLenQString intASCIICode = asc(mid(request.querystring("Ntt"),intCtr_I,1)) if (intASCIICode >= 65 and intASCIICode <= 90) or (intASCIICode >= 97 and intASCIICode <= 122) or (mid(request.querystring("Ntt"),intCtr_I,1) = "+") or (intASCIICode >= 48 and intASCIICode <= 57) or (intASCIICode = 32) or (intASCIICode = 42) or (mid(request.querystring("Ntt"),intCtr_I,1) = "-") then strQString = strQString + mid(request.querystring("Ntt"),intCtr_I,1) else blnBadCharFound = true end if next if blnBadCharFound then urlGenDefault.removeparam "Ntt" urlGenDefault.addparam "Ntt", strQString response.redirect ("default.htm?" & urlGenDefault.querystring) end if end if 'check for cat prefix if len(request.querystring("Ntt")) <> 0 then dim oldNtt dim cat_prefix cat_prefix = "" oldNtt = request.querystring("Ntt") 'Response.write(mid(oldNtt,4,1)) Dim intPos intPos = InStr(Left(oldNtt, 4), "-") If intPos > 0 Then 'grab prefix code (maximum 3 characters) cat_prefix = Trim(UCase(left(oldNtt, intPos - 1))) 'Response.write(cat_prefix) End If 'if Prefix does contain chars then assume it is a catelog ex. 5bb-8252 If not IsNumeric(cat_prefix) Then 'set urlGenDefault = Server.CreateObject("Endeca.UrlGen") 'urlGenDefault.init Request.QueryString, "UTF-8" urlGenDefault.removeParam "Ntt" urlGenDefault.addParam "Ntt", Trim(Mid(oldNtt, intPos + 1)) 'response.write(Trim(Mid(oldNtt, intPos + 1))) End If end if 'yahoo slurp fix to add in Nu if it's missing. if not len(request.querystring("Nu")) and len(Request.Querystring("dept_id")) = 0 then urlGenDefault.removeParam "Nu" urlGenDefault.addParam "Nu", "dept_id" hadNu = true end if queryString = urlGenDefault.QueryString objQuery.init queryString, "windows-1252" objQuery.SetNavAllRefinements(true) '10-11-05 - PL - if this flag is set, were printing, so display all. dim isPrinting isPrinting = false '02/07/2006 - AAP - As per Paul, we're setting the page to display (aggregate) records by default. objQuery.SetNavNumAggrERecs(15) if len(request.querystring("recsPerPage")) and clng(request.querystring("recsPerPage")) < 100 then objQuery.SetNavNumAggrERecs(clng(request.querystring("recsPerPage"))) end if if request.querystring("dept_id") <> "" and request.querystring("printpage") = "true" then 'SET THIS TO do more than 10 results... objQuery.SetNavNumAggrERecs(600) isPrinting = true end if '09/08/2005 - AAP - blnRefinementsPresent was created because showRefinements was not a reliable-enough flag 'to check for. Sometimes, the last refinement would not be a valid dimension, and showRefinements would be 'set to FALSE when refinements and products were present. blnRefinementsPresent = false on error resume next set objResults = objEndConn.Query(objQuery) if InStr(err.Description, "Nothing was requested in query to to") > 0 then set objResults = nothing set objEndConn = nothing set objQuery = nothing redirect("/products/") elseif err.number <> 0 then 'Cannot connect to Endeca if len(Request.querystring("dept_id")) > 0 then set objResults = nothing set objEndConn = nothing set objQuery = nothing failedEndeca(err) response.Redirect("/store/product_group.asp?dept_id=" & Request.querystring("dept_id")) else set objResults = nothing set objEndConn = nothing set objQuery = nothing failedEndeca(err) Response.Redirect("/store/") end if end if On Error Goto 0 if objResults.ContainsNavigation() then set objNavResults = objResults.GetNavigation() else '5/18/06 - PFL - for some reason they get here, they have a dept_id, but no N number. if Request.querystring("R") <> "" and Request.querystring("pf_id") <> "" then 'Redirect them to record page. set objResults = nothing set objEndConn = nothing set objQuery = nothing Redirect("eproduct.asp?R=" & Request.querystring("R") & "&pf_id=" & Request.querystring("pf_id") & "&dept_id=" & Request.querystring("pf_id") ) elseif Request.querystring("Nao") <> "" then set urlGenDefault = Server.CreateObject("Endeca.UrlGen") urlGenDefault.init Request.QueryString, "UTF-8" urlGenDefault.removeParam "Nao" set objResults = nothing set objEndConn = nothing set objQuery = nothing Redirect("default.htm?" & urlGenDefault.querystring) end if end if '9/6/06 - PFL - Redirection code to the NEW pages. %><% 'do easy one first... if search, redirect: if len(request.querystring("Ntt")) and Request.querystring("N") = "539" then dim url_red url_red = "default_rw.asp?Ntt=" & request.querystring("Ntt") Redirect(CreateRewriteUrl(url_red)) else 'do tier navigation redirect 'do search nagigation redirect set my_descriptor_dimensions = objNavresults.GetDescriptorDimensions() dim strTierName_red(3) dim intTierIndex_red dim strDepartmentIdID_red For i = 1 to my_descriptor_dimensions.Count if left(my_descriptor_dimensions.Item(i).getName,4) = "tier" then intTierIndex_red = int(mid(my_descriptor_dimensions.Item(i).getName,5,1)) '9/21/06 - replace any / in the name just in case... strTierName_red(intTierIndex_red) = replace(my_descriptor_dimensions.Item(i).getDescriptor().getName(), "/", " ") elseif my_descriptor_dimensions.Item(i).getName() = "Department_Id" then strDepartmentIdID_red = request.QueryString("dept_id") end if next dim refinments refinments = "" dim seeDeptYet seeDeptYet = false dim breadCrumbGref, breadCrumbRef for des_count = 1 to my_descriptor_dimensions.Count set sample_descriptor_dimension = my_descriptor_dimensions.Item(des_count) set sample_descriptor_value = sample_descriptor_dimension.GetDescriptor() anc_name = left(sample_descriptor_dimension.GetName(),4) anc_full_name = sample_descriptor_dimension.GetName() anc_num = right(sample_descriptor_dimension.GetName(),1) set ancestor_descriptor_list = sample_descriptor_dimension.GetAncestors() set query_toolkit = Server.CreateObject("Endeca.ENEQueryToolkit") set new_N_value = query_toolkit.RemoveDescriptor(objnavresults, sample_descriptor_value) my_next_query_url = "Default_rw.asp?" if anc_full_name = "tier1" then my_next_query_url = my_next_query_url & "t1=" & strTierName_red(1) elseif anc_full_name = "tier2" then my_next_query_url = my_next_query_url & "t1=" & strTierName_red(1) & "&t2=" & strTierName_red(2) elseif anc_full_name = "tier3" then my_next_query_url = my_next_query_url & "t1=" & strTierName_red(1) & "&t2=" & strTierName_red(2) & "&t3=" & strTierName_red(3) elseif anc_full_name = "Department_Id" then seeDeptYet = true my_next_query_url = my_next_query_url & "t1=" & strTierName_red(1) & "&t2=" & strTierName_red(2) & "&t3=" & strTierName_red(3) & "&dept_id=" & sample_descriptor_value.getName() if breadcrumbref <> "" then my_next_query_url = my_next_query_url & "&ref=" & breadcrumbref end if else 'handle the 'refinements' if seeDeptYet then breadcrumbgref = breadcrumbgref & "+" & sample_descriptor_value.getid() my_next_query_url = my_next_query_url & "t1=" & strTierName_red(1) & "&t2=" & strTierName_red(2) & "&t3=" & strTierName_red(3) & "&dept_id=" & strDepartmentIdID & "&gref=" & breadcrumbgref if breadcrumbref <> "" then my_next_query_url = my_next_query_url & "&ref=" & breadcrumbref end if else breadcrumbref = breadcrumbref & "+" & sample_descriptor_value.getid() my_next_query_url = my_next_query_url & "t1=" & strTierName_red(1) & "&t2=" & strTierName_red(2) & "&t3=" & strTierName_red(3) & "&ref=" & breadcrumbref end if end if my_next_query_url = createRewriteUrl(my_next_query_url) if des_count = my_descriptor_dimensions.Count then nextislast = true end if If sample_descriptor_value.GetName() <> "tier3" then if nextislast = true then nextislast = false my_next_query_url = my_next_query_url end if end if next if len(my_next_query_url) = 0 then redirect("/search/") end if redirect(my_next_query_url) end if 'Response.end %> <% on error resume next If not objQuery is Nothing then set objQuery = Nothing If not objEndConn is Nothing then set objEndConn = Nothing If not objResults is Nothing then set objResults = Nothing If not objNavResults is Nothing then set objNavResults = Nothing set rec = nothing 'close endeca connections If not objResults2 is Nothing then set objResults2 = nothing If not objQuery2 is Nothing then set objQuery2 = nothing If not alphaDic is Nothing then set alphaDic = nothing If not my_url_manipulator is Nothing then set my_url_manipulator = nothing If not my_toolkit is Nothing then set my_toolkit = nothing If not my_url_manipulator2 is Nothing then set my_url_manipulator2 = nothing '4/14/06 - PFL - found a few things that could be closed that aren't. If not urlGenDefault is Nothing then set urlGenDefault = nothing If not url_manipulator is Nothing then set url_manipulator = nothing If not urlg is Nothing then set urlg = nothing If not toolkit is Nothing then set toolkit = nothing If not urlgen is Nothing then set urlgen = nothing If not query_toolkit is Nothing then set query_toolkit = nothing '08/31/2006 - AAP - setting supplemental_objects to nothing. Housekeeping. if not my_supplemental_objects is nothing then set my_supplemental_objects = nothing if not sample_supplement is nothing then set sample_supplement = nothing if not my_supplement_properties is nothing then set my_supplement_properties = nothing 'i_docs page If not objDocQuery is Nothing then set objDocQuery = Nothing If not objDocEndConn is Nothing then set objDocEndConn = Nothing If not objDocResults is Nothing then set objDocResults = Nothing If not objDocNavResults is Nothing then set objDocNavResults = Nothing on error goto 0 %>