📄 product_list.asp
字号:
<!--#include file="conn.asp"-->
<%
'☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
'★ ★
'☆ 56770网络商城V2.3多语言版 ☆
'★ ★
'☆ 版权所有: 56770.com ☆
'★ ★
'☆ 程序制作: 56770网络 小寒 MoGui ☆
'★ email:admin@56770.com ★
'☆ QQ:88464758 ☆
'★ ★
'☆ [主页地址]http://www.56770.com ☆
'★ [支持论坛]http://bbs.56770.com/ ★
'☆ ☆
'★ 其他产品: ★
'☆ [56770MM写真系统] [56770行业信息网] ☆
'☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
%>
<%
if session("admin_name")="" then
response.redirect "default.asp"
end if
product_name=request("product_name")
sort_name=request("sort_name")
csort_name=request("csort_name")
cxsort_name=request("cxsort_name")
cysort_name=request("cysort_name")
bianhao=request("bianhao")
%>
<%
'开始删除操作
if request("del")="true" then
product_name=request("product_name")
conn.execute "delete * from 56770_product where product_name='" &request("product_name")&"'"
conn.execute "delete * from 56770_propic where bianhao='" &request("product_name")&"'"
url="product_list.asp?page=" & request("page")& "&sort_name=" & request("sort_name")& "&csort_name=" & request("csort_name")
response.redirect url
end if
%>
<link rel="stylesheet" href="css.css" type="text/css">
<body text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="#FFFFFF" vspace="0" hspace="0">
<tr>
<td height="27" background="images/admin_bg_1.gif">.:: 您可以在这里进行商品相关操作 点击相应<font color=red>分类名</font>可列出<font color=red>该类</font>下的所有商品</td>
<td align="right" background="images/admin_bg_1.gif">
<%set rs=server.CreateObject("adodb.recordset")
rs.open "select * from 56770_sort order by sort_id", conn, 1, 1
if rs.eof and rs.bof then
response.write "目前还没有分类"
else%>
<select name="anclassid" onChange="var jmpURL=this.options[this.selectedIndex].value ;if(jmpURL!='') {window.location=jmpURL; }else{ this.selectedIndex=0; }" >
<option selected>--请选择商品分类--</option>
<option value=product_list.asp>查看全部商品</option>
<option value="product_list.asp?type=1">总会员价排列</option>
<option value="product_list.asp?type=2">总销售量排列</option>
<%do while not rs.eof%>
<option value="product_list.asp?sort_name=<%=rs("sort_name")%>"><%=trim(rs("sort_name"))%></option>
<%rs.movenext
loop
end if
rs.close
set rs=nothing
%>
<option value="product_list.asp?product_name=<%=product_name%>&sort_name=<%=sort_name%>&csort_name=<%=csort_name%>&type=1">此类会员价排列</option>
<option value="product_list.asp?product_name=<%=product_name%>&sort_name=<%=sort_name%>&csort_name=<%=csort_name%>&type=2">此类销售量排列</option>
</select>
</td></tr>
</table>
<%
sql = "select * from 56770_csort order by csort_id "
set rs=server.createobject("ADODB.Recordset")
rs.open sql, conn, 1, 1
%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("csort_name"))%>", "<%= trim(rs("sort_name"))%>", "<%= trim(rs("csort_id"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
set rs=nothing
%>
onecount=<%=count%>;
function changelocation(sort_name)
{
document.cxsort_name.csort_name.length = 0;
var sort=sort_name;
var i;
document.cxsort_name.csort_name.options[0] = new Option('请选择二级分类', '');
for(i=0; i < onecount; i++)
{
if(subcat[i][1] == sort)
{
document.cxsort_name.csort_name.options[document.cxsort_name.csort_name.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
<table border="0" cellspacing="1" cellpadding="4" bgcolor="#FFFFFF" align="center" width="100%">
<form name="cxsort_name" method="post" action="product_list.asp">
<tr bgcolor="#B0CBE6">
<td align="right">一级分类:</td>
<td>
<select name="sort_name" onChange="changelocation(document.cxsort_name.sort_name.options[document.cxsort_name.sort_name.selectedIndex].value)">
<option value="" selected>请选择一级分类</option>
<%
sql="select * from 56770_sort"
set rs=server.createobject("ADODB.Recordset")
rs.open sql, conn, 1, 1
while not rs.eof
%>
<option value="<%=rs("sort_id")%>"><%=rs("sort_name")%></option>
<%
rs.movenext
wend
rs.Close()
%>
</select>
</td>
<td align="right">二级分类:</td>
<td>
<select name="csort_name">
<option selected value="">请选择二级分类</option>
</select>
</td>
<td colspan="2" align="center">
<input type="submit" name="Submit" value="快速搜索">
</td>
</tr>
</form>
</table>
<script LANGUAGE="javascript">
changelocation(document.cxsort_name.sort_name.options[document.cxsort_name.sort_name.selectedIndex].value);
</script>
<table border="0" cellspacing="1" cellpadding="4" bgcolor="#000000" align="center" width="100%">
<form method="post" action="product_list.asp">
<tr bgcolor="#B0CBE6">
<td align="right" width="15%"><input type="button" name="Submit2" value="显示全部商品" onClick="location.href='product_list.asp'"></td>
<td width="40%">
商品名 :<input type="text" name="product_name" class="form">
</td>
<td colspan="2" align="center" bgcolor="#B0CBE6">
<input type="submit" name="Submit" value="搜索">
</td>
</from>
<form method="post" action="product_list.asp">
<td align="right" width="15%">按编号搜索</td>
<td width="30%">
<input type="text" name="bianhao" class="form">
</td>
<td colspan="2" align="center" bgcolor="#B0CBE6">
<input type="submit" name="Submit1" value="搜索">
</td>
</tr>
</form>
</table>
<table border="0" cellspacing="1" cellpadding="2" width="100%" align="center" bgcolor="#D6DFF7">
<tr>
<td bgcolor="#6699CC" height="25" width="5%">ID</td>
<td bgcolor="#6699CC" width="23%">商品名</td>
<td bgcolor="#6699CC" width="9%">一级分类</td>
<td bgcolor="#6699CC" width="9%">二级分类</td>
<td bgcolor="#6699CC" width="8%" align="center">三级分类</td>
<td bgcolor="#6699CC" width="5%" align="center">销量</td>
<td bgcolor="#6699CC" width="5%" align="center">状态</td>
<td bgcolor="#6699CC" colspan="2">操作</td>
</tr>
<%
sql="select * from 56770_product where product_name<>''"
if product_name<>"" then sql=sql + " and product_name like '%"&product_name&"%'"
if bianhao<>"" then sql=sql + " and bianhao like '%"&bianhao&"%'"
if sort_name<>"" then sql=sql + " and sort_name="&sort_name&""
if csort_name<>"" then sql=sql + " and csort_name="&csort_name&""
if cxsort_name<>"" then sql=sql + " and cxsort_name="&cxsort_name&""
if cysort_name<>"" then sql=sql + " and cysort_name='"&cysort_name&"'"
if request("type")="" then sql=sql + " order by day desc"
if request("type")="1" then sql=sql + " order by price desc"
if request("type")="2" then sql=sql + " order by buys desc"
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.open sql, conn, 1, 2
if rs.eof then
Response.Write("<tr bgcolor=""#B0CBE6"">")
Response.Write("<td colspan=""11"" height=""50"" align=""center"" >目前本类还没有商品,请<a href=""addproduct.asp"">添加一个商品</a></td>")
Response.Write("</tr>")
else
if not isempty(request("page"))then
pagecount=cint(request("page"))
else
pagecount=1
end if
rs.pagesize=20
rs.AbsolutePage=pagecount
do while not rs.eof
%>
<%
sqlt="select * from 56770_sort where sort_id="&rs("sort_name")&""
Set rst=Server.CreateObject("ADODB.RecordSet")
rst.open sqlt, conn, 1, 1
sort_names=rst("sort_name")
rst.close
set rst=nothing
sqltt="select * from 56770_csort where csort_id="&rs("csort_name")&""
Set rstt=Server.CreateObject("ADODB.RecordSet")
rstt.open sqltt, conn, 1, 1
csort_names=rstt("csort_name")
rstt.close
set rstt=nothing
sqlttt="select * from 56770_cxsort where cxsort_id="&rs("cxsort_name")&""
Set rsttt=Server.CreateObject("ADODB.RecordSet")
rsttt.open sqlttt, conn, 1, 1
cxsort_names=rsttt("cxsort_name")
rsttt.close
set rsttt=nothing
%>
<tr bgcolor="#B0CBE6">
<td height="22" width="5%" ><%=rs("id")%></td>
<td width="20%"><%=rs("product_name")%></td>
<td width="9%"><a href="product_list.asp?sort_name=<%=rs("sort_name")%>" title="查询 <%=sort_names%> 分类下的商品"><%=sort_names%></a></td>
<td width="11%"><a href="product_list.asp?sort_name=<%=rs("sort_name")%>&csort_name=<%=rs("csort_name")%>" title="查询 <%=csort_names%> 分类下的商品"><%=csort_names%></a></td>
<td align="center" width="9%">
<a href="product_list.asp?sort_name=<%=rs("sort_name")%>&csort_name=<%=rs("csort_name")%>&cxsort_name=<%=rs("cxsort_name")%>" title="查询 <%=cxsort_names%> 分类下的商品"><%=cxsort_names%></a>
</td>
<td align="center" width="5%"><%=rs("buys")%></td>
<td align="center" width="5%"><%if rs("stj")=true then response.write"<font color=red>荐</font>" end if %> <%if rs("cx")=true then response.write"<font color=#000000>特</font>" end if %></td>
<td width="4%"><a href="product_edit.asp?id=<%=rs("id")%>">编辑</a></td>
<td width="4%"> <a onclick='{if(confirm("删除商品将彻底删除与之有关的数据,将不可恢复!")){return true;}return false;}' href="product_list.asp?del=true&id=<%=rs("id")%>&product_name=<%=rs("product_name")%>&sort_name=<%=sort_name%>&csort_name=<%=csort_name%>&page=<%=cstr(pagecount)%>">[×]</a>
</td>
</tr>
<%
rs.movenext
i=i+1
if i >= rs.pagesize then exit do
loop
%>
<tr bgcolor="#D6DFF7">
<form action="product_list.asp" method="post">
<td height="35" colspan="11">
<div align="center"> 共 <b><%=rs.recordcount%></b> 个商品, 页次: <b><font color=red><%=pagecount%></font>/<%=rs.pagecount%></b>,
当前从第
<%
if pagecount <= 1 then
response.write "<font color=red>1</font>"
else
response.write "<font color=red>" & pagecount*rs.pagesize-rs.pagesize+1 & "</font>"
end if
%>
个开始。
<% if pagecount=1 and rs.pagecount<>pagecount and rs.pagecount<>0 then%>
<a href="product_list.asp?product_name=<%=product_name%>&sort_name=<%=sort_name%>&csort_name=<%=csort_name%>&page=<%=cstr(pagecount+1)%>&type=<%=request("type")%>">下一页</a>
<% end if %>
<% if rs.pagecount>1 and rs.pagecount=pagecount then %>
<a href="product_list.asp?product_name=<%=product_name%>&sort_name=<%=sort_name%>&csort_name=<%=csort_name%>&page=<%=cstr(pagecount-1)%>&type=<%=request("type")%>">
上一页</a>
<%end if%>
<% if pagecount<>1 and rs.pagecount<>pagecount then%>
<a href="product_list.asp?product_name=<%=product_name%>&sort_name=<%=sort_name%>&csort_name=<%=csort_name%>&page=<%=cstr(pagecount-1)%>&type=<%=request("type")%>">
上一页</a><a href="product_list.asp?product_name=<%=product_name%>&sort_name=<%=sort_name%>&csort_name=<%=csort_name%>&page=<%=cstr(pagecount+1)%>&type=<%=request("type")%>">
下一页</a>
<% end if%>
直接到第
<select name="page">
<%for i=1 to rs.pagecount%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select>
页
<input type="submit" name="go" value="Go">
<input type="hidden" name="product_name" value=<%=product_name%>>
<input type="hidden" name="sort_name" value=<%=sort_name%>>
<input type="hidden" name="csort_name" value=<%=csort_name%>>
<input type="hidden" name="type" value=<%=request("type")%>>
</div>
</td>
</form>
</tr>
</table>
<%
end if
rs.close
set rs=nothing
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -