gusucode.com > 爱美尔女性商城源码 1.0源码程序 > products.asp

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--#include file="conn.asp"-->
<!--#include file="webconfig.asp"-->
<%
typeid=request("typeid")
if typeid<>"" then
typeid=request("typeid")
else
typeid="2"
end if
if typeid="1" then
typelbname="电视购物"
else
typelbname="家居用品"
end if
%>
<%
anclassid=request("anid")
nclassid=request("nid")
mkey=request("mkey")
allprice=request("allprice")
orderby=request("orderby")
datetime=request("datetime")

 if anclassid<>""then
  tj1="and anclassid="&anclassid
 else
 tj1=""
 end if
 
  if nclassid<>""then
 tj2="and nclassid="&nclassid
 else
 tj2=""
 end if
 
if mkey<>""then
 tj3="and bookname like '%"&mkey&"%'"
 else
 tj3=""
 end if
 
 if allprice<>""then
 if allprice="1" then
 tj4="and huiyuanjia<=100"
 elseif allprice="2" then
 tj4="and huiyuanjia>=100  and huiyuanjia<=150"
  elseif allprice="3" then
 tj4="and huiyuanjia>=150  and huiyuanjia<=300"
  elseif allprice="4" then
 tj4="and huiyuanjia>=300  and huiyuanjia<=500"
  elseif allprice="5" then
 tj4="and huiyuanjia>=500"
 end if
 else
 tj4=""
 end if
 
 if orderby<>""then
 if orderby="priceasc" then
 tj5="order by huiyuanjia asc"
 elseif orderby="pricedesc" then
  tj5="order by huiyuanjia desc"
   elseif orderby="datetime" then
  tj5="order by adddate asc"
   elseif orderby="datetimedesc" then
  tj5="order by adddate desc"
 end if
 else
 tj5=""
 end if
 
if act<>""then
 if act="bestbook"then
  tj6="bestbook=1"
  elseif act="newsbook" then
   tj6="newsbook=1"
  end if
  else
 tj6=""
 end if
%>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=webname%>-<%=description1%></title>
<meta name="keywords" content="<%=keywords%>" />
<meta name="description" content="<%=description1%>" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.idtabs.js"></script>
<script type="text/javascript" src="js/swf.js"></script>
</head>
<body>
<!--#include file="top.asp" -->
<%
if anclassid="" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 1 * FROM BJX_class1 where typeid="&typeid&" order by anclassidorder asc",conn,1,1
if rs.recordcount=0 then

else
while not rs.eof
anclassid=rs("anclassid")
rs.movenext
wend
end if
rs.close
set rs=nothing
end if
%>
<table width="995" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="20"><div align="center"></div></td>
  </tr>
</table>
<table width="995" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="189" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td style="background:url(images/index_left_top.gif) top no-repeat left; height:50px;">&nbsp;</td>
        </tr>
      <tr>
        <td style="background:url(images/fenlei_bottom2.gif) bottom no-repeat left;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
           <%
set rs=server.CreateObject("adodb.recordset")
rs.open "select * FROM BJX_class1 where typeid="&typeid&" order by anclassidorder asc",conn,1,1
if rs.recordcount=0 then
response.write "<br>目前没有商品分类"
else
while not rs.eof
%>
		 
		  <tr>
            <td><b><a href="products.asp?anid=<%=rs("anclassid")%>&typeid=<%=rs("typeid")%>" class="a1"><img src="images/list_ico1.gif" width="28" height="23" align="absmiddle" /><%=rs("anclass")%></a></b></td>
          </tr>
          <tr>
            <td style="padding-left:28px; padding-top:5px;">
			<%set rss=server.CreateObject("adodb.recordset")
		  rss.open "select * FROM BJX_class2 where typeid="&typeid&" and anclassid="&rs("anclassid")&" order by nclassidorder asc",conn,1,1		
		  if not rss.eof then
		i=1
		do while not rss.eof%>
			 <a href="products.asp?anid=<%=rss("anclassid")%>&nid=<%=rss("nclassid")%>&typeid=<%=rss("typeid")%>"><%=rss("nclass")%></a> <br />
			  <%
	    rss.movenext
         i=i+1
    	 loop
		rss.close
		end if
		
	%>
               </td>
          </tr>
		  <%
	rs.movenext
wend
end if
rs.close
set rs=nothing
%>
         
        
          <tr>
            <td>&nbsp;</td>
          </tr>
        </table></td>
      </tr>
    </table>
	<!--#include file="left.asp"-->
      </td>
    <td width="10" valign="top"><div align="center"></div></td>
    <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><a href="<%=url7%>"><img src="<%=pic7%>" width="800" height="95" /></a></td>
      </tr>
    </table>
	<%
	set rs_s=server.CreateObject("adodb.recordset")
rs_s.open "select * from BJX_class1 where anclassid="&anclassid&"",conn,1,3
anclass=rs_s("anclass")

rs_s.update
rs_s.close
set rs_s=nothing

if nclassid<>"" then
set rs_s=server.CreateObject("adodb.recordset")
rs_s.open "select * from BJX_class2 where anclassid="&anclassid&" and nclassid="&nclassid&"",conn,1,3
nclass=rs_s("nclass")

rs_s.update
rs_s.close
set rs_s=nothing
end if
	%>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="40">您当前的位置: <a title="" href="index.asp" alt="">首页</a>  &gt;&gt; <b><%=anclass%></b> <%if nclassid<>"" then%>&gt;&gt; <b><%=nclass%></b><%end if%></td>
        </tr>
      </table>

	  <%

 set rs=server.createobject("adodb.recordset")
rs.open "select * from BJX_goods where (1=1) "&tj1&" "&tj2&" "&tj3&" "&tj4&" "&tj6&" and typeid="&typeid&" "&tj5&" ",conn,1,1

		if rs.recordcount=0 then 
		%>
		  <table width="100%" cellpadding="0" cellspacing="0">
             <tr valign="top">
          <td width="25%" align="center" id="pdt-916" product="916">暂无内容</td>
            </tr>
      </table>
          <%
		else
	  		rs.PageSize =20 '每页记录条数
			iCount=rs.RecordCount '记录总数
			iPageSize=rs.PageSize
    		maxpage=rs.PageCount 
    		page=request("page")
    if Not IsNumeric(page) or page="" then
        page=1
    else
        page=cint(page)
    end if
    if page<1 then
        page=1
    elseif  page>maxpage then
        page=maxpage
    end if
    rs.AbsolutePage=Page
	if page=maxpage then
		x=iCount-(maxpage-1)*iPageSize
	else
		x=iPageSize
	end if
		%>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td align="left">总共找到<font style="color:#FF0000"><%=iCount%></font>个商品</td>
          <td align="right">排序方式: 
            <select name="orderby"  onchange="window.location='products.asp?anid=<%=anclassid%>&nid=<%=nclassid%>&allprice=<%=allprice%>&mkey=<%=mkey%>&typeid=<%=typeid%>&orderby=' + this.options[this.selectedIndex].value; ">
              <option selected="selected" value="">默认</option>
              <option value="datetimedesc">按发布时间 新-&gt;旧</option>
              <option value="datetime">按发布时间 旧-&gt;新</option>
              <option value="pricedesc">按价格 从高到低</option>
              <option value="priceasc">按价格 从低到高</option>
              <option value="">访问周次数</option>
              <option value="">总访问次数</option>
              <option value="">周购买次数</option>
              <option value="">总购买次数</option>
              <option value="">评论次数</option>
            </select></td>
        </tr>
      </table>
	   
      <table width="100%" cellpadding="0" cellspacing="0">
        <tr valign="top">
		<%
				ii=0
				For i=1 To x
		%>
          <td width="25%" align="center" id="pdt-916" product="916"><div>
            <div><a href="#" target="_blank"></a></div>
            <div>
                <table border="0" cellspacing="0" cellpadding="0" width="100%">
                  <tbody>
                    <tr>
                      <td height="170" align="center"><a href="showpro.asp?id=<%=rs("bookid")%>" target="_blank"><img alt="<%=rs("bookname")%>" src="<%=rs("bookpic")%>" width="150" height="150" style="border:1px solid #ccc;" /></a></td>
                    </tr>
                    <tr>
                      <td align="center"><a title="ZA 沁漾保湿眼霜 20g" href="showpro.asp?id=<%=rs("bookid")%>"><%if len(trim(rs("bookname")))>15 then
			response.write left(trim(rs("bookname")),12)&".."
			else
			response.write trim(rs("bookname"))
			end if%></a></td>
                    </tr>
                    <tr>
                      <td align="center"><font style="text-decoration:line-through; color:#999;">市场价:¥<%=formatnumber(rs("shichangjia"),2)&"元"%></font></td>
                    </tr>
					 <tr>
                      <td align="center" style="color:#ff3399; font-weight:bold;">销售价:¥<%=formatnumber(rs("huiyuanjia"),2)&"元"%></td>
                    </tr>
                    <tr>
                      <td height="40" align="center" style="color:#ff3399; font-weight:bold;"><a 
                                href="ShoppingCart.asp?id=<%=rs("bookid")%>&action=add" 
                                target="_blank"><img src="images/bt2.gif" width="100" height="25" /></a>&nbsp;<a href="shoucang.asp?id=<%=rs("bookid")%>&action=add" 
                                target="_blank"><img src="images/bt3.gif" width="62" height="25" /></a></td>
                    </tr>
                  </tbody>
                </table>
            </div>
          </div></td>
         <%rs.movenext
		     ii=ii+1%>
                <%if ii mod 4 =0 then%>
  </tr>
   <%end if%>
                <% next%>
    </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="39" align="center">
            <%
		call PageControl(iCount,maxpage,page,"border=0 align=center","<p align=center>")
		
		rs.close
		set rs=nothing
Sub PageControl(iCount,pagecount,page,table_style,font_style)
'生成上一页下一页链接
    Dim query, a, x, temp
    action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
    query = Split(Request.ServerVariables("QUERY_STRING"), "&")
    For Each x In query
        a = Split(x, "=")
        If StrComp(a(0), "page", vbTextCompare) <> 0 Then
            temp = temp & a(0) & "=" & a(1) & "&"
        End If
    Next
    Response.Write("<table width=100% border=0 cellpadding=0 cellspacing=0 >" & vbCrLf )        
    Response.Write("<form method=get onsubmit=""document.location = '" & action & "?" & temp & "Page='+ this.page.value;return false;""><TR >" & vbCrLf )
    Response.Write("<TD align=center height=40>" & vbCrLf )
    Response.Write(font_style & vbCrLf )    
    if page<=1 then
        Response.Write ("首 页 " & vbCrLf)        
        Response.Write ("上一页 " & vbCrLf)
    else        
        Response.Write("<A HREF=" & action & "?" & temp & "Page=1>首 页</A> " & vbCrLf)
        Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page-1) & ">上一页</A> " & vbCrLf)
    end if
    if page>=pagecount then
        Response.Write ("下一页 " & vbCrLf)
        Response.Write ("尾 页 " & vbCrLf)            
    else
        Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page+1) & ">下一页</A> " & vbCrLf)
        Response.Write("<A HREF=" & action & "?" & temp & "Page=" & pagecount & ">尾 页</A> " & vbCrLf)            
    end if
    Response.Write(" 页次:" & page & "/" & pageCount & "页" &  vbCrLf)
    Response.Write(" 共有" & iCount & "条产品" &  vbCrLf)
    Response.Write(" 转到" & "<INPUT CLASS=wenbenkuang TYEP=TEXT NAME=page SIZE=2 Maxlength=5 VALUE=" & page & ">" & "页"  & vbCrLf & "<INPUT CLASS=go-wenbenkuang type=submit value=GO>")
    Response.Write("</TD>" & vbCrLf )                
    Response.Write("</TR></form>" & vbCrLf )        
    Response.Write("</table>" & vbCrLf )        
End Sub
%>
          </td>
        </tr>
      </table>
	  <%end if%>
	  </td>
  </tr>
</table>
<!--#include file="bottom.asp" -->
</body>
</html>