<% Session.Timeout = 2 %> <% Response.expires = 0 Response.expiresabsolute = Now() - 1 Response.addHeader "pragma", "no-cache" Response.addHeader "cache-control", "private" Response.addHeader "cache-control", "no-cache" Response.addHeader "cache-control", "no-store" Response.CacheControl = "no-cache" %> <% ' Initialize common variables x_ID = Null: ox_ID = Null: z_ID = Null x_manufact = Null: ox_manufact = Null: z_manufact = Null x_model = Null: ox_model = Null: z_model = Null x_type = Null: ox_type = Null: z_type = Null x_price = Null: ox_price = Null: z_price = Null y_price = Null: w_price = Null x_warranty = Null: ox_warranty = Null: z_warranty = Null y_warranty = Null: w_warranty = Null x_brand = Null: ox_brand = Null: z_brand = Null x_picture01 = Null: ox_picture01 = Null: z_picture01 = Null fs_x_picture01 = 0: fn_x_picture01 = "": ct_x_picture01 = "" wd_x_picture01 = 0: ht_x_picture01 = 0: a_x_picture01 = "" x_picture02 = Null: ox_picture02 = Null: z_picture02 = Null fs_x_picture02 = 0: fn_x_picture02 = "": ct_x_picture02 = "" wd_x_picture02 = 0: ht_x_picture02 = 0: a_x_picture02 = "" x_delivery = Null: ox_delivery = Null: z_delivery = Null x_g_network1 = Null: ox_g_network1 = Null: z_g_network1 = Null x_g_network2 = Null: ox_g_network2 = Null: z_g_network2 = Null x_g_announced = Null: ox_g_announced = Null: z_g_announced = Null x_g_status = Null: ox_g_status = Null: z_g_status = Null x_body_dimension = Null: ox_body_dimension = Null: z_body_dimension = Null x_body_weight = Null: ox_body_weight = Null: z_body_weight = Null x_disp_type = Null: ox_disp_type = Null: z_disp_type = Null x_disp_size = Null: ox_disp_size = Null: z_disp_size = Null x_disp_multitouch = Null: ox_disp_multitouch = Null: z_disp_multitouch = Null x_disp_protection = Null: ox_disp_protection = Null: z_disp_protection = Null x_sound_alerttypes = Null: ox_sound_alerttypes = Null: z_sound_alerttypes = Null x_sound_loudspeaker = Null: ox_sound_loudspeaker = Null: z_sound_loudspeaker = Null x_sound_jack = Null: ox_sound_jack = Null: z_sound_jack = Null x_mem_cardslot = Null: ox_mem_cardslot = Null: z_mem_cardslot = Null x_mem_phonebook = Null: ox_mem_phonebook = Null: z_mem_phonebook = Null x_mem_callrecords = Null: ox_mem_callrecords = Null: z_mem_callrecords = Null x_mem_internal = Null: ox_mem_internal = Null: z_mem_internal = Null x_data_gprs = Null: ox_data_gprs = Null: z_data_gprs = Null x_data_edge = Null: ox_data_edge = Null: z_data_edge = Null x_data_speed = Null: ox_data_speed = Null: z_data_speed = Null x_data_wlan = Null: ox_data_wlan = Null: z_data_wlan = Null x_data_bluetooth = Null: ox_data_bluetooth = Null: z_data_bluetooth = Null x_data_usb = Null: ox_data_usb = Null: z_data_usb = Null x_cam_primary = Null: ox_cam_primary = Null: z_cam_primary = Null x_cam_video = Null: ox_cam_video = Null: z_cam_video = Null x_cam_secondary = Null: ox_cam_secondary = Null: z_cam_secondary = Null x_f_cpu = Null: ox_f_cpu = Null: z_f_cpu = Null x_f_sensors = Null: ox_f_sensors = Null: z_f_sensors = Null x_f_messaging = Null: ox_f_messaging = Null: z_f_messaging = Null x_f_browser = Null: ox_f_browser = Null: z_f_browser = Null x_f_radio = Null: ox_f_radio = Null: z_f_radio = Null x_f_games = Null: ox_f_games = Null: z_f_games = Null x_f_gps = Null: ox_f_gps = Null: z_f_gps = Null x_f_java = Null: ox_f_java = Null: z_f_java = Null x_f_colors = Null: ox_f_colors = Null: z_f_colors = Null x_btt_batery = Null: ox_btt_batery = Null: z_btt_batery = Null x_btt_standby = Null: ox_btt_standby = Null: z_btt_standby = Null x_btt_talktime = Null: ox_btt_talktime = Null: z_btt_talktime = Null x_btt_musicplay = Null: ox_btt_musicplay = Null: z_btt_musicplay = Null x_sar1 = Null: ox_sar1 = Null: z_sar1 = Null x_sar2 = Null: ox_sar2 = Null: z_sar2 = Null %> <% nStartRec = 0 nStopRec = 0 nTotalRecs = 0 nRecCount = 0 nRecActual = 0 sDbWhereMaster = "" sDbWhereDetail = "" sSrchAdvanced = "" psearch = "" psearchtype = "" sSrchBasic = "" sSrchWhere = "" sDbWhere = "" sOrderBy = "" sSqlMaster = "" nDisplayRecs = 20 nRecRange = 10 ' Set up records per page dynamically SetUpDisplayRecs() ' Open connection to the database Set conn = Server.CreateObject("ADODB.Connection") conn.Open xDb_Conn_Str ' Handle Reset Command ResetCmd() ' Get Search Criteria for Advanced Search SetUpAdvancedSearch() ' Get Search Criteria for Basic Search SetUpBasicSearch() ' Build Search Criteria If sSrchAdvanced <> "" Then If sSrchWhere <> "" Then sSrchWhere = sSrchWhere & " AND " sSrchWhere = sSrchWhere & "(" & sSrchAdvanced & ")" End If If sSrchBasic <> "" Then If sSrchWhere <> "" Then sSrchWhere = sSrchWhere & " AND " sSrchWhere = sSrchWhere & "(" & sSrchBasic & ")" End If ' Save Search Criteria If sSrchWhere <> "" Then Session(ewSessionTblSearchWhere) = sSrchWhere nStartRec = 1 ' reset start record counter Session(ewSessionTblStartRec) = nStartRec Else sSrchWhere = Session(ewSessionTblSearchWhere) Call RestoreSearch() End If ' Build Filter condition sDbWhere = "" If sDbWhereDetail <> "" Then If sDbWhere <> "" Then sDbWhere = sDbWhere & " AND " sDbWhere = sDbWhere & "(" & sDbWhereDetail & ")" End If If sSrchWhere <> "" Then If sDbWhere <> "" Then sDbWhere = sDbWhere & " AND " sDbWhere = sDbWhere & "(" & sSrchWhere & ")" End If ' Set Up Sorting Order sOrderBy = "" SetUpSortOrder() ' Set up SQL sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, sDbWhere, sOrderBy) 'Response.Write sSql ' Uncomment to show SQL for debugging %> <% ''' %> <% ' Set up Record Set Set rs = Server.CreateObject("ADODB.Recordset") rs.CursorLocation = 3 rs.Open sSql, conn, 1, 2 nTotalRecs = rs.RecordCount If nDisplayRecs <= 0 Then ' Display All Records nDisplayRecs = nTotalRecs End If nStartRec = 1 SetUpStartRec() ' Set Up Start Record Position %>

<% If Session(ewSessionMessage) <> "" Then %> <%= Session(ewSessionMessage) %>

<% Session(ewSessionMessage) = "" ' Clear message End If %> <% If nTotalRecs > 0 Then %>
<% ' Avoid starting record > total records If CLng(nStartRec) > CLng(nTotalRecs) Then nStartRec = nTotalRecs End If ' Set the last record to display nStopRec = nStartRec + nDisplayRecs - 1 ' Move to first record directly for performance reason nRecCount = nStartRec - 1 If Not rs.Eof Then rs.MoveFirst rs.Move nStartRec - 1 End If nRecActual = 0 Do While (Not rs.Eof) And (nRecCount < nStopRec) nRecCount = nRecCount + 1 If CLng(nRecCount) >= CLng(nStartRec) Then nRecActual = nRecActual + 1 ' Set row color sItemRowClass = " class=""ewTableRow""" sListTrJs = " onmouseover='ew_mouseover(this);' onmouseout='ew_mouseout(this);' onclick='ew_click(this);'" ' Display alternate color for rows If nRecCount Mod 2 <> 1 Then sItemRowClass = " class=""ewTableAltRow""" End If x_ID = rs("ID") x_manufact = rs("manufact") x_model = rs("model") x_type = rs("type") x_price = rs("price") x_warranty = rs("warranty") x_brand = rs("brand") x_picture01 = rs("picture01") x_picture02 = rs("picture02") x_delivery = rs("delivery") x_g_network1 = rs("g_network1") x_g_network2 = rs("g_network2") x_g_announced = rs("g_announced") x_g_status = rs("g_status") x_body_dimension = rs("body_dimension") x_body_weight = rs("body_weight") x_disp_type = rs("disp_type") x_disp_size = rs("disp_size") x_disp_multitouch = rs("disp_multitouch") x_disp_protection = rs("disp_protection") x_sound_alerttypes = rs("sound_alerttypes") x_sound_loudspeaker = rs("sound_loudspeaker") x_sound_jack = rs("sound_jack") x_mem_cardslot = rs("mem_cardslot") x_mem_phonebook = rs("mem_phonebook") x_mem_callrecords = rs("mem_callrecords") x_mem_internal = rs("mem_internal") x_data_gprs = rs("data_gprs") x_data_edge = rs("data_edge") x_data_speed = rs("data_speed") x_data_wlan = rs("data_wlan") x_data_bluetooth = rs("data_bluetooth") x_data_usb = rs("data_usb") x_cam_primary = rs("cam_primary") x_cam_video = rs("cam_video") x_cam_secondary = rs("cam_secondary") x_f_cpu = rs("f_cpu") x_f_sensors = rs("f_sensors") x_f_messaging = rs("f_messaging") x_f_browser = rs("f_browser") x_f_radio = rs("f_radio") x_f_games = rs("f_games") x_f_gps = rs("f_gps") x_f_java = rs("f_java") x_f_colors = rs("f_colors") x_btt_batery = rs("btt_batery") x_btt_standby = rs("btt_standby") x_btt_talktime = rs("btt_talktime") x_btt_musicplay = rs("btt_musicplay") x_sar1 = rs("sar1") x_sar2 = rs("sar2") %> <%=sListTrJs%>> <% End If rs.MoveNext Loop %>
Product Name
Picture
 
<% Response.Write x_model %> <% If Not IsNull(x_picture01) Then %> " target="_self"> <% End If %>
<% End If %> <% ' Close recordset and connection rs.Close Set rs = Nothing conn.Close Set conn = Nothing %>
<% If nTotalRecs > 0 Then %> <% End If %>

 

 

    

<% If nTotalRecs > 0 Then rsEof = (nTotalRecs < (nStartRec + nDisplayRecs)) PrevStart = nStartRec - nDisplayRecs If PrevStart < 1 Then PrevStart = 1 NextStart = nStartRec + nDisplayRecs If NextStart > nTotalRecs Then NextStart = nStartRec LastStart = ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1 %>

<% If CLng(nStartRec)=1 Then %> <% Else %> <% End If %> <% If CLng(PrevStart) = CLng(nStartRec) Then %> <% Else %> <% End If %> <% If CLng(NextStart) = CLng(nStartRec) Then %> <% Else %> <% End If %> <% If CLng(LastStart) = CLng(nStartRec) Then %> <% Else %> <% End If %>
Page  FirstFirstPreviousPrevious NextNextLastLast of <%=(nTotalRecs-1)\nDisplayRecs+1%>
<% If CLng(nStartRec) > CLng(nTotalRecs) Then nStartRec = nTotalRecs nStopRec = nStartRec + nDisplayRecs - 1 nRecCount = nTotalRecs - 1 If rsEOF Then nRecCount = nTotalRecs If nStopRec > nRecCount Then nStopRec = nRecCount %> <%%> <% %> <% %> <% Else %> <% If sSrchWhere = "0=101" Then %> <% Else %> No Product found <% End If %> <% End If %>

 

Products Per Page 

<% '''' ' %> <% '------------------------------------------------------------------------------- ' Function SetUpDisplayRecs ' - Set up Number of Records displayed per page based on Form element RecPerPage ' - Variables setup: nDisplayRecs Sub SetUpDisplayRecs() Dim sWrk sWrk = Request.QueryString(ewTblRecPerPage) If sWrk <> "" Then If IsNumeric(sWrk) Then nDisplayRecs = CInt(sWrk) Else If LCase(sWrk) = "all" Then ' Display All Records nDisplayRecs = -1 Else nDisplayRecs = 20 ' Non-numeric, Load Default End If End If Session(ewSessionTblRecPerPage) = nDisplayRecs ' Save to Session ' Reset Start Position (Reset Command) nStartRec = 1 Session(ewSessionTblStartRec) = nStartRec Else If Session(ewSessionTblRecPerPage) <> "" Then nDisplayRecs = Session(ewSessionTblRecPerPage) ' Restore from Session Else nDisplayRecs = 20 ' Load Default End If End If End Sub '------------------------------------------------------------------------------- ' Function SetUpAdvancedSearch ' - Set up Advanced Search parameter based on querystring parameters from Advanced Search Page ' - Variables setup: sSrchAdvanced Sub SetUpAdvancedSearch() Dim arrFldOpr, arrFldOpr2, sSrchStr ' Field manufact sSrchStr = "" x_manufact = Request.QueryString("x_manufact") z_manufact = Request.QueryString("z_manufact") arrFldOpr = Split(z_manufact, ",") If x_manufact <> "" And IsValidOpr(arrFldOpr) Then sSrchStr = sSrchStr & "[manufact] " & arrFldOpr(0) & " " & _ arrFldOpr(1) & AdjustSql(x_manufact) & arrFldOpr(2) End If If sSrchStr <> "" Then If sSrchAdvanced <> "" Then sSrchAdvanced = sSrchAdvanced & " AND " sSrchAdvanced = sSrchAdvanced & "(" & sSrchStr & ")" End If ' Field model sSrchStr = "" x_model = Request.QueryString("x_model") z_model = Request.QueryString("z_model") arrFldOpr = Split(z_model, ",") If x_model <> "" And IsValidOpr(arrFldOpr) Then sSrchStr = sSrchStr & "[model] " & arrFldOpr(0) & " " & _ arrFldOpr(1) & AdjustSql(x_model) & arrFldOpr(2) End If If sSrchStr <> "" Then If sSrchAdvanced <> "" Then sSrchAdvanced = sSrchAdvanced & " AND " sSrchAdvanced = sSrchAdvanced & "(" & sSrchStr & ")" End If ' Field type sSrchStr = "" x_type = Request.QueryString("x_type") z_type = Request.QueryString("z_type") arrFldOpr = Split(z_type, ",") If x_type <> "" And IsValidOpr(arrFldOpr) Then sSrchStr = sSrchStr & "[type] " & arrFldOpr(0) & " " & _ arrFldOpr(1) & AdjustSql(x_type) & arrFldOpr(2) End If If sSrchStr <> "" Then If sSrchAdvanced <> "" Then sSrchAdvanced = sSrchAdvanced & " AND " sSrchAdvanced = sSrchAdvanced & "(" & sSrchStr & ")" End If ' Field price sSrchStr = "" x_price = Request.QueryString("x_price") z_price = Request.QueryString("z_price") y_price = Request.QueryString("y_price") w_price = Request.QueryString("w_price") arrFldOpr = Split(z_price, ",") If x_price <> "" And y_price <> "" And IsValidOpr(arrFldOpr) Then sSrchStr = sSrchStr & "[price] BETWEEN " & _ arrFldOpr(1) & AdjustSql(x_price) & arrFldOpr(2) & " AND " & _ arrFldOpr(1) & AdjustSql(y_price) & arrFldOpr(2) End If If sSrchStr <> "" Then If sSrchAdvanced <> "" Then sSrchAdvanced = sSrchAdvanced & " AND " sSrchAdvanced = sSrchAdvanced & "(" & sSrchStr & ")" End If ' Field warranty sSrchStr = "" x_warranty = Request.QueryString("x_warranty") z_warranty = Request.QueryString("z_warranty") v_warranty = Request.QueryString("v_warranty") If v_warranty = "" Then v_warranty = Session(ewSessionTblAdvSrch & "_v_warranty") y_warranty = Request.QueryString("y_warranty") w_warranty = Request.QueryString("w_warranty") arrFldOpr = Split(z_warranty, ",") If x_warranty <> "" And IsValidOpr(arrFldOpr) Then sSrchStr = sSrchStr & "[warranty] " & arrFldOpr(0) & " " & _ arrFldOpr(1) & AdjustSql(x_warranty) & arrFldOpr(2) End If arrFldOpr2 = Split(w_warranty, ",") If y_warranty <> "" And IsValidOpr(arrFldOpr2) Then If sSrchStr <> "" Then sSrchStr = sSrchStr & " " & ewIIf(v_warranty="OR", "OR", "AND") & " " sSrchStr = sSrchStr & "[warranty] " & arrFldOpr2(0) & " " & _ arrFldOpr2(1) & AdjustSql(y_warranty) & arrFldOpr2(2) End If If sSrchStr <> "" Then If sSrchAdvanced <> "" Then sSrchAdvanced = sSrchAdvanced & " AND " sSrchAdvanced = sSrchAdvanced & "(" & sSrchStr & ")" End If ' Field brand sSrchStr = "" x_brand = Request.QueryString("x_brand") z_brand = Request.QueryString("z_brand") arrFldOpr = Split(z_brand, ",") If x_brand <> "" And IsValidOpr(arrFldOpr) Then sSrchStr = sSrchStr & "[brand] " & arrFldOpr(0) & " " & _ arrFldOpr(1) & AdjustSql(x_brand) & arrFldOpr(2) End If If sSrchStr <> "" Then If sSrchAdvanced <> "" Then sSrchAdvanced = sSrchAdvanced & " AND " sSrchAdvanced = sSrchAdvanced & "(" & sSrchStr & ")" End If If sSrchAdvanced <> "" Then ' save settings Session(ewSessionTblAdvSrch & "_x_manufact") = x_manufact Session(ewSessionTblAdvSrch & "_z_manufact") = z_manufact Session(ewSessionTblAdvSrch & "_x_model") = x_model Session(ewSessionTblAdvSrch & "_z_model") = z_model Session(ewSessionTblAdvSrch & "_x_type") = x_type Session(ewSessionTblAdvSrch & "_z_type") = z_type Session(ewSessionTblAdvSrch & "_x_price") = x_price Session(ewSessionTblAdvSrch & "_v_price") = v_price Session(ewSessionTblAdvSrch & "_y_price") = y_price Session(ewSessionTblAdvSrch & "_x_warranty") = x_warranty Session(ewSessionTblAdvSrch & "_v_warranty") = v_warranty Session(ewSessionTblAdvSrch & "_y_warranty") = y_warranty Session(ewSessionTblAdvSrch & "_w_warranty") = w_warranty Session(ewSessionTblAdvSrch & "_x_brand") = x_brand End If End Sub ' Function to check if the search operators are valid Function IsValidOpr(arOpr) Dim Opr IsValidOpr = IsArray(arOpr) If IsValidOpr Then IsValidOpr = (UBound(arOpr) >= 2) If IsValidOpr Then For Each Opr In arOpr Opr = UCase(Trim(Opr)) If Not (Opr = "=" Or Opr = "<" Or Opr = "<=" Or _ Opr = ">" Or Opr = ">=" Or Opr = "<>" Or _ Opr = "LIKE" Or Opr = "NOT LIKE" Or Opr = "BETWEEN" Or _ Opr = "'" Or Opr = "'%" Or Opr = "%'" Or Opr = "#" Or Opr = "") Then IsValidOpr = False Exit For End If Next End If End Function '------------------------------------------------------------------------------- ' Function BasicSearchSQL ' - Build WHERE clause for a keyword Function BasicSearchSQL(Keyword) Dim sKeyword sKeyword = AdjustSql(Keyword) BasicSearchSQL = "" BasicSearchSQL = BasicSearchSQL & "[manufact] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[model] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[type] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[price] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[warranty] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[brand] LIKE '%" & sKeyword & "%' OR " If Right(BasicSearchSQL, 4) = " OR " Then BasicSearchSQL = Left(BasicSearchSQL, Len(BasicSearchSQL)-4) End Function '------------------------------------------------------------------------------- ' Function SetUpBasicSearch ' - Set up Basic Search parameter based on form elements pSearch & pSearchType ' - Variables setup: sSrchBasic Sub SetUpBasicSearch() Dim arKeyword, sKeyword psearch = Request.QueryString(ewTblBasicSrch) psearchtype = Request.QueryString(ewTblBasicSrchType) If psearch <> "" Then If psearchtype <> "" Then While InStr(psearch, " ") > 0 sSearch = Replace(psearch, " ", " ") Wend arKeyword = Split(Trim(psearch), " ") For Each sKeyword In arKeyword sSrchBasic = sSrchBasic & "(" & BasicSearchSQL(sKeyword) & ") " & psearchtype & " " Next Else sSrchBasic = BasicSearchSQL(psearch) End If End If If Right(sSrchBasic, 4) = " OR " Then sSrchBasic = Left(sSrchBasic, Len(sSrchBasic)-4) If Right(sSrchBasic, 5) = " AND " Then sSrchBasic = Left(sSrchBasic, Len(sSrchBasic)-5) If psearch <> "" then Session(ewSessionTblBasicSrch) = psearch Session(ewSessionTblBasicSrchType) = psearchtype End If End Sub '------------------------------------------------------------------------------- ' Function ResetSearch ' - Clear all search parameters ' Sub ResetSearch() ' Clear search where sSrchWhere = "" Session(ewSessionTblSearchWhere) = sSrchWhere ' Clear advanced search parameters Session(ewSessionTblAdvSrch & "_x_manufact") = "" Session(ewSessionTblAdvSrch & "_z_manufact") = "" Session(ewSessionTblAdvSrch & "_x_model") = "" Session(ewSessionTblAdvSrch & "_z_model") = "" Session(ewSessionTblAdvSrch & "_x_type") = "" Session(ewSessionTblAdvSrch & "_z_type") = "" Session(ewSessionTblAdvSrch & "_x_price") = "" Session(ewSessionTblAdvSrch & "_y_price") = "" Session(ewSessionTblAdvSrch & "_x_warranty") = "" Session(ewSessionTblAdvSrch & "_v_warranty") = "AND" Session(ewSessionTblAdvSrch & "_y_warranty") = "" Session(ewSessionTblAdvSrch & "_w_warranty") = "" Session(ewSessionTblAdvSrch & "_x_brand") = "" Session(ewSessionTblBasicSrch) = "" Session(ewSessionTblBasicSrchType) = "" End Sub '------------------------------------------------------------------------------- ' Function RestoreSearch ' - Restore all search parameters ' Sub RestoreSearch() ' Restore advanced search settings x_manufact = Session(ewSessionTblAdvSrch & "_x_manufact") z_manufact = Session(ewSessionTblAdvSrch & "_z_manufact") x_model = Session(ewSessionTblAdvSrch & "_x_model") z_model = Session(ewSessionTblAdvSrch & "_z_model") x_type = Session(ewSessionTblAdvSrch & "_x_type") z_type = Session(ewSessionTblAdvSrch & "_z_type") x_price = Session(ewSessionTblAdvSrch & "_x_price") y_price = Session(ewSessionTblAdvSrch & "_y_price") x_warranty = Session(ewSessionTblAdvSrch & "_x_warranty") v_warranty = Session(ewSessionTblAdvSrch & "_v_warranty") y_warranty = Session(ewSessionTblAdvSrch & "_y_warranty") w_warranty = Session(ewSessionTblAdvSrch & "_w_warranty") x_brand = Session(ewSessionTblAdvSrch & "_x_brand") psearch = Session(ewSessionTblBasicSrch) psearchtype = Session(ewSessionTblBasicSrchType) End Sub '------------------------------------------------------------------------------- ' Function SetUpSortOrder ' - Set up Sort parameters based on Sort Links clicked ' - Variables setup: sOrderBy, Session(TblOrderBy), Session(Tbl_Field_Sort) Sub SetUpSortOrder() Dim sOrder, sSortField, sLastSort, sThisSort Dim bCtrl ' Check for an Order parameter If Request.QueryString("order").Count > 0 Then sOrder = Request.QueryString("order") ' Field [manufact] If sOrder = "manufact" Then sSortField = "[manufact]" sLastSort = Session(ewSessionTblSort & "_x_manufact") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_manufact") = sThisSort Else If Session(ewSessionTblSort & "_x_manufact") <> "" Then Session(ewSessionTblSort & "_x_manufact") = "" End If ' Field [model] If sOrder = "model" Then sSortField = "[model]" sLastSort = Session(ewSessionTblSort & "_x_model") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_model") = sThisSort Else If Session(ewSessionTblSort & "_x_model") <> "" Then Session(ewSessionTblSort & "_x_model") = "" End If ' Field [type] If sOrder = "type" Then sSortField = "[type]" sLastSort = Session(ewSessionTblSort & "_x_type") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_type") = sThisSort Else If Session(ewSessionTblSort & "_x_type") <> "" Then Session(ewSessionTblSort & "_x_type") = "" End If ' Field [price] If sOrder = "price" Then sSortField = "[price]" sLastSort = Session(ewSessionTblSort & "_x_price") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_price") = sThisSort Else If Session(ewSessionTblSort & "_x_price") <> "" Then Session(ewSessionTblSort & "_x_price") = "" End If ' Field [warranty] If sOrder = "warranty" Then sSortField = "[warranty]" sLastSort = Session(ewSessionTblSort & "_x_warranty") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_warranty") = sThisSort Else If Session(ewSessionTblSort & "_x_warranty") <> "" Then Session(ewSessionTblSort & "_x_warranty") = "" End If ' Field [brand] If sOrder = "brand" Then sSortField = "[brand]" sLastSort = Session(ewSessionTblSort & "_x_brand") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_brand") = sThisSort Else If Session(ewSessionTblSort & "_x_brand") <> "" Then Session(ewSessionTblSort & "_x_brand") = "" End If ' Field [delivery] If sOrder = "delivery" Then sSortField = "[delivery]" sLastSort = Session(ewSessionTblSort & "_x_delivery") If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC" Session(ewSessionTblSort & "_x_delivery") = sThisSort Else If Session(ewSessionTblSort & "_x_delivery") <> "" Then Session(ewSessionTblSort & "_x_delivery") = "" End If Session(ewSessionTblOrderBy) = sSortField & " " & sThisSort Session(ewSessionTblStartRec) = 1 End If sOrderBy = Session(ewSessionTblOrderBy) If sOrderBy = "" Then sOrderBy = ewSqlOrderBy Session(ewSessionTblOrderBy) = sOrderBy End If End Sub '------------------------------------------------------------------------------- ' Function SetUpStartRec ' - Set up Starting Record parameters based on Pager Navigation ' - Variables setup: nStartRec Sub SetUpStartRec() Dim nPageNo ' Check for a START parameter If Request.QueryString(ewTblStartRec).Count > 0 Then nStartRec = Request.QueryString(ewTblStartRec) Session(ewSessionTblStartRec) = nStartRec ElseIf Request.QueryString("pageno").Count > 0 Then nPageNo = Request.QueryString("pageno") If IsNumeric(nPageNo) Then nStartRec = (nPageNo-1)*nDisplayRecs+1 If nStartRec <= 0 Then nStartRec = 1 ElseIf nStartRec >= ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1 Then nStartRec = ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1 End If Session(ewSessionTblStartRec) = nStartRec Else nStartRec = Session(ewSessionTblStartRec) If Not IsNumeric(nStartRec) Or nStartRec = "" Then nStartRec = 1 ' Reset start record counter Session(ewSessionTblStartRec) = nStartRec End If End If Else nStartRec = Session(ewSessionTblStartRec) If Not IsNumeric(nStartRec) Or nStartRec = "" Then nStartRec = 1 'Reset start record counter Session(ewSessionTblStartRec) = nStartRec End If End If End Sub '------------------------------------------------------------------------------- ' Function ResetCmd ' - Clear list page parameters ' - RESET: reset search parameters ' - RESETALL: reset search & master/detail parameters ' - RESETSORT: reset sort parameters Sub ResetCmd() Dim sCmd ' Get Reset Cmd If Request.QueryString("cmd").Count > 0 Then sCmd = Request.QueryString("cmd") ' Reset Search Criteria If LCase(sCmd) = "reset" Then Call ResetSearch() ' Reset Search Criteria & Session Keys ElseIf LCase(sCmd) = "resetall" Then Call ResetSearch() ' Reset Sort Criteria ElseIf LCase(sCmd) = "resetsort" Then sOrderBy = "" Session(ewSessionTblOrderBy) = sOrderBy If Session(ewSessionTblSort & "_x_manufact") <> "" Then Session(ewSessionTblSort & "_x_manufact") = "" If Session(ewSessionTblSort & "_x_model") <> "" Then Session(ewSessionTblSort & "_x_model") = "" If Session(ewSessionTblSort & "_x_type") <> "" Then Session(ewSessionTblSort & "_x_type") = "" If Session(ewSessionTblSort & "_x_price") <> "" Then Session(ewSessionTblSort & "_x_price") = "" If Session(ewSessionTblSort & "_x_warranty") <> "" Then Session(ewSessionTblSort & "_x_warranty") = "" If Session(ewSessionTblSort & "_x_brand") <> "" Then Session(ewSessionTblSort & "_x_brand") = "" If Session(ewSessionTblSort & "_x_delivery") <> "" Then Session(ewSessionTblSort & "_x_delivery") = "" End If ' Reset Start Position (Reset Command) nStartRec = 1 Session(ewSessionTblStartRec) = nStartRec End If End Sub %>
seo specialist karachi