<%
mypage = request.querystring("whichpage")
If mypage = "" Then
mypage = 1
End If
mypagesize = request.querystring("pagesize")
If mypagesize = "" Then
mypagesize = 12
End If
sidorperrad=12
mySQL = request.querystring("SQLquery")
mainc = request.querystring("mcmode")
Set rsProducts = Server.CreateObject("ADODB.Recordset")
rsproducts.CursorLocation = adUseClient
rsproducts.CacheSize = 20
If sMode <> "" Then
mySQL = "SELECT * FROM products WHERE Category='" & sMode & "' AND MainCategory='" & mainc & "' AND IsOrdinary=1 and IsFirstProd=0 ORDER BY ItemId DESC"
elseif request.querystring("mcmode")<>"" then
sMode=request.querystring("mcmode")
mySQL = "SELECT * FROM products WHERE MainCategory='" & sMode & "' AND Category='' and IsFirstProd=0 AND IsOrdinary=1 ORDER BY ItemId DESC"
End If
rsproducts.Open mySQL, dbMain, adOpenStatic, adLockPessimistic, adCmdText
If rsproducts.EOF Then
%><%
response.Write "Det finns inga produkter"
response.Write vbCrLf
%>
<%
Else
rsproducts.MoveFirst
rsproducts.PageSize = mypagesize
maxpages = CInt(rsproducts.PageCount)
maxrecs = CInt(rsproducts.PageSize)
rsproducts.AbsolutePage = mypage
howmanyrecs = 0
rsproducts.MoveFirst
%>
<%Set rsInfotable=Server.CreateObject("ADODB.Recordset")
if (request.querystring("mode")="") and (request.querystring("mcmode")<>"") then
InfoSQL = "SELECT * FROM CategoryTable WHERE MainCategory='" & request.querystring("mcmode") & "'"
rsInfotable.Open InfoSQL, dbMain, adOpenStatic, adLockPessimistic, adCmdText
If not(rsInfotable.eof and rsInfotable.bof) and (mypage=1)Then
%>
<%
if (rsInfotable("MainCatTitle") <> "") Then
%> <%
End If
If rsInfotable("MainCatPicture") <> "" Then
MapP = Trim("" & rsInfotable("MainCatPicture"))
MapP = ""
response.Write "" & MapP & " | "
end if
If rsInfotable("MainCatDescription") <> "" Then
ForstBrodTxt = rsInfotable("MainCatDescription")
%> | <%
End If
%>
|
<%
End If
else
InfoSQL = "SELECT * FROM CategoryTable2 WHERE MainCategory='" & request.querystring("mcmode") & "' AND Category='" & request.querystring("mode") & "'"
rsInfotable.Open InfoSQL, dbMain, adOpenStatic, adLockPessimistic, adCmdText
If not(rsInfotable.eof and rsInfotable.bof) and (mypage=1) Then
%>
<%
If (rsInfotable.Fields.Item("CatTitle") <> "") Then
%> <%
End If
If (rsInfotable.Fields.Item("CatPicture") <> "") Then
MapP = Trim("" & rsInfotable("CatPicture"))
MapP = ""
response.Write "" & MapP & " | "
end if
If (rsInfotable.Fields.Item("CategoryDescription") <> "") Then
ForstBrodTxt = rsInfotable.Fields.Item("CategoryDescription")
%><%Response.write ForstBrodTxt%>
|
| <%
End If
%>
|
<%
End If
rsInfotable.close'slut
end if
set rsInfotable=nothing
%>
<%
if rsproducts("Category")<>"" then%>
|
<%
set rstext=server.createobject("ADODB.Recordset")
rstext.Open "SELECT DefaultNoImage, LinktextBigPicture FROM ShopText", dbMain, adOpenStatic, adLockPessimistic, adCmdText
Dim noimage, ltbp
noimage=rstext("DefaultNoImage")
ltbp=rstext("LinktextBigPicture")
rstext.close
rsproducts.close
sMode = request.querystring("mode")
If sMode <> "" Then
tmpmySQL = "SELECT * FROM products WHERE Category='" & sMode & "' AND MainCategory='" & mainc & "' and IsFirstProd=1 AND IsOrdinary=1 ORDER BY ItemProductNumber ASC"
elseif request.querystring("mcmode")<>"" then
sMode=request.querystring("mcmode")
tmpmySQL = "SELECT * FROM products WHERE MainCategory='" & sMode & "' AND Category='' and IsFirstProd=1 AND IsOrdinary=1 ORDER BY ItemProductNumber ASC"
End If
rsproducts.Open tmpmySQL, dbMain, adOpenStatic, adLockPessimistic, adCmdText
'Response.Write rsproducts.RecordCount
'Response.end
if not(rsproducts.BOF and rsproducts.EOF) and mypage=1 then
%>
|
<%
else
%>
|
<%
end if
rsproducts.close
rsproducts.Open mySQL, dbMain, adOpenStatic, adLockPessimistic, adCmdText
for i2 = 1 to mypagesize step 1
For i = 1 To (mypage - 1) Step 1
rsproducts.MoveNext
Next
Next
%>
<%
Do While Not (rsproducts.EOF) and (howmanyrecs < maxrecs)
if radtest=0 then
Response.Write " | "
elseif radtest=1 then
Response.Write " | "
else
Response.Write " | "
end if
WriteProductRow
if radtest=2 then
Response.Write " | "
else
Response.Write ""
end if
if radtest<2 then
radtest=radtest+1
else
radtest=0
end if
rsProducts.MoveNext
howmanyrecs = howmanyrecs + 1
Loop
if radtest > 0 then
for i = radtest to 2
Response.Write " | "
next
end if
%>
|
<%
End If
rsproducts.Close
rsproducts.Open mySQL, dbMain, adOpenStatic, adLockPessimistic, adCmdText
If maxpages > 1 Then
If rsproducts.EOF = False Then
%>
<%response.write "Sidor"%>
|
<%
End If
pad = ""
scriptname = request.servervariables("script_name")
ind = request.querystring("indx")
if ind >0 then
ref="" & "<< " & ((sidorperrad * (CInt(ind) - 1)) + 1) & " - " & (sidorperrad * CInt(ind)) & " "
response.Write ref & ""
End If
for counter=(1 + (cint(ind)*sidorperrad)) to maxpages
If Counter = (1 + (CInt(ind) * sidorperrad)) Then
Response.Write " [ "
End If
If Counter = Int(mypage) Then
%>
<%response.write counter%>
<%
Else
ref="" & Counter & " "
response.Write ref & ""
End If
If ((counter )=((cint(ind)*cint(sidorperrad))+cint(sidorperrad))) or (counter=maxpages) then
Response.Write " ] "
Exit For
End If
Next
If ((counter )=((cint(ind)*cint(sidorperrad))+cint(sidorperrad))) and counter maxpages Then
ref = ref & "'>" & (CInt(Counter) + 1) & " - " & maxpages & " >>" & " "
Else
ref=ref & " '>" & (cint(counter)+1) & " - " & (cint(counter) + cint(sidorperrad)) & " >>" & " "
End If
response.Write ref & ""
'exit for
End If
End If
%> |
Tillbaka till första sidan
| <%
'response.Write " | " & vbCrLf
rsproducts.Close
set rsproducts=nothing
Set rstemp = Nothing
%>
|