📄 favorite.asp
字号:
<%@language=vbscript codepage=936 %>
<%
option explicit
response.buffer=true
%>
<!--#include file="../conn.asp"-->
<!--#include file="../inc/function.asp"-->
<%
Action=trim(request("Action"))
dim ClientName
UserName=trim(request.Cookies("Client")("UserName"))
if UserName="" then
response.write "<br><br>请先<a href='Client_Login.asp'>登录</a>!"
response.end
else
UserName=ReplaceBadChar(UserName)
end if
dim trs,rsClient,ClientID
dim MyFavorites,ProductID
set rsClient=server.CreateObject("adodb.recordset")
rsClient.open "select * from PE_Client where UserName='" & UserName & "'",Conn,1,1
if rsClient.bof and rsClient.eof then
response.write "对不起,你还没登记你的信息!"
response.end
else
ClientID=rsClient("ClientID")
ClientName=rsClient("ContacterName")
MyFavorites=trim(rsClient("MyFavorites"))
if isNull(MyFavorites) then MyFavorites=""
end if
rsClient.close
set rsClient=nothing
ProductID=trim(request("ProductID"))
select case Action
case "Add"
if ProductID="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>请指定要添加到收藏夹中的产品ID!</li>"
else
ProductID=Clng(ProductID)
MyFavorites=AddToFavorite(MyFavorites,ProductID)
end if
case "Del"
if ProductID="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>请指定要添加到收藏夹中的产品ID!</li>"
else
ProductID=Clng(ProductID)
MyFavorites=RemoveFromFavorite(MyFavorites,ProductID)
end if
case "Clear"
MyFavorites=""
end select
MyFavorites=ReplaceBadChar(MyFavorites)
Conn.execute("update PE_Client set MyFavorites='" & MyFavorites & "' where ClientID=" & ClientID & "")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="client.css" rel="stylesheet" type="text/css">
<title>收藏夹</title>
</head>
<body>
<table width="100%" border="0" cellpadding="2" cellspacing="1" class="border">
<tr>
<td align="center" class="title"><%=ClientName%>的收藏夹 </td>
</tr>
<tr>
<td class="tdbg"><%
if MyFavorites="" then
response.write "<br> 您目前的收藏夹内没有任何信息!您可以在<a href='ProductList.asp' target='main'><font color='#ff0000'>订购产品</font></a>中收藏您喜爱的商品。<br><br></td></tr></table>"
response.write "<br>"
response.write "<table width='100%' border='0' cellpadding='2' cellspacing='1' class='border'><tr><td class='title'>"
response.write "<img src='images/help.gif' align='absmiddle'>小 贴 士</td></tr>"
response.write "<tr><td class='tdbg'><li>在左栏的订购管理-<a href='ProductList.asp' target='main'><font color='#FF0000'>订购产品</font></a>中,点击产品的<img src='images/fav.gif' border='0' align='absmiddle'>按钮,您的收藏夹中才会有商品。</li></td></tr></table>"
response.end
end if
%></td>
</tr>
<tr>
<td class="tdbg">
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<%
dim rsProductList,iNum
set rsProductList=Conn.execute("select * from PE_Product where ProductID in (" & MyFavorites & ") order by ProductID desc")
do while not rsProductList.eof
%>
<td>
<table width="100%" border="0" cellpadding="2" cellspacing="1" class="border3">
<tr class="tdbg3">
<td width="23" rowspan="5" align="center" valign="middle"><img src="productpic/01.gif" width="135" height="128"></td>
<td colspan="2"><strong><%=rsProductList("ProductName")%></strong></td>
</tr>
<tr>
<td width="46" align="center" class="tdbg3"><b>型号:</b></td>
<td class="tdbg3"><%=rsProductList("ProductModel")%></td>
</tr>
<tr>
<td align="center" class="tdbg3"><b>简介:</b></td>
<td class="tdbg3"><%=rsProductList("ProductIntro")%><br>
此价格为媒体价,实际销售价格请和我们的销售代表联系。以您与销售代表商定的价格为准。</td>
</tr>
<tr>
<td align="center" class="tdbg3"><b>价格:</b></td>
<td class="tdbg3">¥<%=rsProductList("Price")%></td>
</tr>
<tr>
<td width="46" align="center" class="tdbg3"> </td>
<td class="tdbg3"><a href="ShoppingCart.asp?Action=Add&ProductID=<%=rsProductList("ProductID")%>"><img src="images/buy.gif" width="76" height="21" border="0"></a> <a href="Client_Favorite.asp?Action=Del&ProductID=<%=rsProductList("ProductID")%>"><img src="images/fav2.gif" width="78" height="22" border="0"></a></td>
</tr>
</table>
</td>
<%
rsProductList.movenext
iNum=iNum+1
if iNum mod 2=0 and not rsProductList.eof then response.write "</tr><tr>"
loop
set rsProductList=nothing
%>
</tr>
</table>
</td>
</tr>
</table>
<br>
<table width="100%" border="0" cellpadding="2" cellspacing="1" class="border">
<tr>
<td class="title"><img src="images/help.gif" align="absmiddle">小 贴 士</td>
</tr>
<tr>
<td class="tdbg"><li>如果您要订购商品,请单击“购买”按钮,进入购物车进行操作</li>
<li>收藏夹内的商品只是作为您的收藏,并没有被订购</li>
<li>如果要删除您收藏的商品,请单击“取消收藏”按钮</li></td>
</tr>
</table>
</body>
</html>
<%
call CloseConn()
function AddToFavorite(arrFavorites, iProductID)
If trim(arrFavorites) = "" Then
AddToFavorite = iProductID
exit function
end if
If FoundInArr(arrFavorites, iProductID ) =False Then
AddToFavorite = arrFavorites & "," & iProductID
else
AddToFavorite = arrFavorites
End If
End function
function RemoveFromFavorite(sFavorites, iProductID)
dim arrFavorites,i,rFavorites
If trim(sFavorites) = "" or trim(sFavorites)=trim(iProductID) Then
RemoveFromFavorite = ""
exit function
end if
if instr(sFavorites,",")>0 then
arrFavorites=split(sFavorites,",")
for i=0 to ubound(arrFavorites)
if trim(arrFavorites(i))<>trim(iProductID) then
if rFavorites="" then
rFavorites=trim(arrFavorites(i))
else
rFavorites=rFavorites & "," & trim(arrFavorites(i))
end if
end if
next
RemoveFromFavorite=rFavorites
else
RemoveFromFavorite=sFavorites
end if
End function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -