📄 shopdisplayproducts.asp
字号:
<%Option Explicit%>
<!--#include file="shop$db.asp"-->
<%
dim search
Dim dbc
Session("CurrentUrl")="shopdisplayproducts"
ShopOpenDataBase dbc
mypage=request.querystring("page")
mypagesize=10
if mypage= "" then
mypage=1
ProcessFirst
CreateSql
else
sql=Session("sqlquery")
end if
ShopPageHeader
DisplayProducts
ShopPageTrailer
Sub ProcessFirst()
CAT_ID = CInt(Request.QueryString("id"))
CATEGORY = Request.QueryString ("cat")
If cat_id = "" and CATEGORY = "" Then
CAT_ID = CInt(Request.form("id"))
CATEGORY = Request.Form ("cat")
end if
SUBCAT=Request.querystring("subcat")
if Subcat="" then
request.form("Subcat")
end if
end sub
Sub CreateSQL()
search=Request.querystring("Search")
if search<>"" then
SQL=Session("SQL")
exit sub
end if
Sql = "select * from Products WHERE "
if CAT_ID <> "" then
sql = sql & " 类别ID= " & cat_id
else
sql = sql & "类别 LIKE '"& CATEGORY & "%'"
end if
If Subcat<> "" then
sql = sql & " AND 子类别ID=" & Subcat
end if
'debugwrite sql
end sub
%>
<%
Sub DisplayProducts()
Dim header
Dim recordcount
dim words
dim wordcount
dim i
dim msg
header="<div align='center'><h5>"
If category <> "" Then
header = header & Category
else
header= header & "搜索结果"
End If
header = header & "</h5><br>"
response.write header
ShopOpenDatabase dbc
ShopOpenRecordSet SQL,objRS, mypagesize, mypage
if objRS.eof then
response.write "找不到相匹配的商品!"
If search<>"" then
wordcount=Session("wordcount")
words=Session("Words")
msg= "<br>搜索的关键字是:"
msg=msg & words(0)
if wordcount>1 then
for i = 1 to wordcount-1
msg = msg & ", " & Words(i)
next
end if
msg=msg & "</div>"
response.write msg
end if
exit sub
end if
recordcount=0
ProductFormatHeader
response.write "<font size=2>Page " & mypage & " of " & maxpages & "<br></font>"
While Not objRS.EOF and recordcount < maxrecs
ProductGetValues (objRS) ' get product values
ProductFormatRow
objRS.MoveNext
recordcount=recordcount+1
Wend
response.write "</table>"
Call PageNavBar (SQL)
objRS.Close
set objRS=nothing
ShopCloseDatabase dbc
end sub
Sub ProductFormatRow
Dim strPrice
mycolor="#1C845F"
strPrice=FormatCurrency(curCprice,2)
%>
<form action="shopaddtocart.asp" method="POST">
<tr>
<tr>
<td width="10%" valign="top" height="30" bgcolor="<%=mycolor%>"><%=strCcode%></td>
<td width="20%" valign="top" height="30" bgcolor="<%=mycolor%>"><%=strcname%>
<% if strButtonImage<>"" then%>
<img src="<%=strButtonImage%>">
<%end if%></td>
<td width="35%" valign="top" height="30" bgcolor="<%=mycolor%>">
<p align="left"> <a href="javascript:popwin2(<%=lngCatalogid%>)"><%=memcdescription%></a>
</td>
<td width="10%" height="30" bgcolor="<%=mycolor%>">
<p align="center"><input type="text" size="3" value="1" name="quantity" ></p></td>
<td width="15%" valign="middle" bgcolor="<%=mycolor%>" height="30"><%=strPrice%></td>
<%FormatButton%>
</tr>
<input type="hidden" name="productid" value="<%=lngCatalogId%>">
</form>
<%
end sub
'
Sub FormatButton
dim mytext
mytext="订购"
%>
<td width="10%" valign="middle" height="30" bgcolor="<%=mycolor%>"><p align=center>
<%
response.write "<p align=center><input type=submit value=""" & mytext & """ name=Order></td>"
end sub
Sub ProductFormatHeader
%>
<center>
<script language="javascript">
function popwin2(id,path)
{ window.open("list.asp?id="+id+"&ppath="+path,"","height=400,width=500,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}
</script>
<table border="1" cellspacing="1" cellpadding="1" bordercolordark="#000000" bordercolorlight="#000000" width="90%" >
<tr>
<td width="10%" height="20" align="center" bgcolor="#005D39">商品编号</td>
<td width="20%" height="20" align="center" bgcolor="#005D39">商品名称</td>
<td width="35%" height="20" align="center" bgcolor="#005D39">商品描述</td>
<td width="10%" height="20" align="center" bgcolor="#005D39">数量</td>
<td width="15%" height="20" align="center" bgcolor="#005D39">单价</td>
<td width="10%" height="20" align="center" bgcolor="#005D39">订购</td>
</tr>
<%
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -