<%@ Language=VBScript %> <% ProductID=Request.QueryString ("PID") If Request.ServerVariables ("HTTP_METHOD") = "POST" Then Sort End If %> <% PageTitle = "SiteManager - Sort Specifications"%> <% PageID=204%> <% Header %> <% Menu PageID %> <%' Main body of page goes here ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ %>

<%= FormatDateTime(Date,1) %>

Specification Display Order

You can easily specify the order in which the Specifications are displayed. Just follow the instructions below.

1. Select the Specification that you want to move.

<% OpenConnection1 Sql = "SELECT SpecID,nSortOrder,txtSpecification FROM P_Specs WHERE nProductID="& ProductID &" ORDER BY nSortOrder" Set rs = Server.CreateObject("ADODB.Recordset") rs.Open Sql, DB, 1, 3 Count = rs.RecordCount a = 1 %>

2. Select an option from below.

Move Up position(s)
Move Down position(s)
Move to First Position
Move to Last Position


<% Footer %> <% Sub Sort Dim ProductOrder() NumberOfProducts = int(Request.Form("NumberOfProducts")) UpQty = int(Request.Form("UpQty")) DnQty = int(Request.Form("DnQty")) ReDim ProductOrder(NumberOfProducts) For a = 0 to NumberOfProducts ProductOrder (a) = a Next CurrentPosition = int(Request.Form ("CurrentPosition")) Move = Request.Form ("Move") If Move = "First" then ProductOrder(CurrentPosition) = 1 For a = 1 to CurrentPosition - 1 ProductOrder (a) = (ProductOrder (a) + 1) Next End IF If Move = "Last" then ProductOrder(CurrentPosition) = NumberOfProducts For a = CurrentPosition + 1 to NumberOfProducts ProductOrder (a) = (ProductOrder (a) - 1) Next End IF If Move = "Up" then If CurrentPosition - UpQty < 1 then UpQty = CurrentPosition - 1 End IF ProductOrder(CurrentPosition) = CurrentPosition - UpQty For a = (CurrentPosition - UpQty) to CurrentPosition - 1 ProductOrder (a) = (ProductOrder (a) + 1) Next End IF If Move = "Down" then If CurrentPosition + DnQty > NumberOfProducts then DnQty = NumberOfProducts - CurrentPosition End IF ProductOrder(CurrentPosition) = CurrentPosition + DnQty For a = CurrentPosition + 1 to CurrentPosition + DnQty ProductOrder(a) = (ProductOrder (a) - 1) Next End IF For a = 0 to NumberOfProducts 'Response.Write(ProductOrder (a)) Next OpenConnection1 Sql = "SELECT * FROM P_Specs WHERE nProductID=" & ProductID & " ORDER BY nSortOrder" Set rs = Server.CreateObject("ADODB.Recordset") rs.Open Sql,DB,1,3 Count = rs.RecordCount a = 1 While Not rs.EOF rs("nSortOrder")=ProductOrder(a) a = a + 1 rs.MoveNext Wend End Sub %>