⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mycart.asp

📁 一个不错的个人商务网站的源码
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%Response.Expires = -100%>
<!--#include file="db_conn.asp"-->
<!--#include file="comm/my_request.asp"-->
<!--#include file="comm/nosql.asp" -->
<!--#include file="comm/co.asp" -->
<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href=<%="style/"&r(22)%>.css rel=stylesheet type=text/css>
<title>我的购物车</title>
</head>


<body>
<div align="center">
	<table border="0" width="100%" cellpadding="0" class="li_table" cellspacing="0">
		<tr>
			<td valign="top">
<%
url=request.servervariables("http_referer")
'如果购买车为空,转入错误界面
ProductList = Session("ProductList")
If Len(ProductList) = 0 Then
Response.write "<script>alert(""对不起,您的购物车为空,请购物!"");window.close();</script>"
Response.end
end if

Sub PutToShopBag( mc, ProductList )
   If Len(ProductList) = 0 Then
      ProductList =mc
   ElseIf InStr( ProductList, mc ) <= 0 Then
      ProductList = ProductList & ","& mc
   End If
End Sub

'取消要购买物品的处理
If Request("cmdShow") = "Yes" Then
   ProductList = ""
   Products = Split(nosql(request("mc")), ",")
   For I=0 To UBound(Products)
      PutToShopBag Products(I), ProductList
   Next
   Session("ProductList") = ProductList
  'response.write "sdfsdf"&Session("ProductList")
End If
%><form action="Mycart.asp" method="POST" name="form1">
			<table border="0" width="100%" id="table2" cellspacing="0" cellpadding="0">
				<tr>
					<td height="20" colspan="5" class="maincolor">
					<p align="center">
					我的购物清单</td>
				</tr>
				<tr>
				    <input type="hidden" name="cmdShow" value="Yes">
					<td height="18" bgcolor="#EBEBEB" width="7%">购买</td>
					<td height="18" bgcolor="#EBEBEB" width="34%">商品名称</td>
					<td height="18" bgcolor="#EBEBEB" width="20%">单价</td>
					<td height="18" bgcolor="#EBEBEB" width="20%">数量</td>
					<td height="18" bgcolor="#EBEBEB" width="18%">金额</td>
				</tr>
<%
'数据库操作
if productlist<>"" then
sql="select * from yqj_product where id in ("&productlist&") order by id"
Set rs = conn.Execute( sql )
'response.write sql
else
response.write "<script language=javascript>alert('对不起,您的购物车为空!');window.close();</script>"
response.End
end if

   'On Error Resume Next
   Sum = 0
   While Not rs.EOF
if session("level")="" or isnull(session("level")) or session("level")=0 then
RMB=rs("p_mmoney")
else
RMB=rs("vip_mmoney")
end if
   Quatity = CInt( Request( "Q_" & rs("p_name")))
     If Quatity <= 0 Then 
      Quatity = 1
      elseif Quatity > rs("p_nums") then
      response.write "<script language=javascript>alert('你选择的产品"&rs("p_name")&"已经超过库存数量!');</script>"
      Quatity = rs("p_nums")
    End If
    Session(rs("p_name")) = Quatity
   Sum = Sum + csng(rmb) * Quatity
   Sum=FormatNumber(Sum,2) 
   session("sum")=sum
   %>
				<tr>
					<td height="18" width="7%">
					<input type=CheckBox name=mc value=<%=rs("id")%> checked onFocus=this.blur()></td>
					<td height="18" width="34%"><%=rs("p_name")%></td>
					<td height="18" width="20%">¥<%=FormatNumber(rmb,2,-1)%>元</td>
					<td height="18" width="20%"><input name=<%response.write "Q_"&rs("p_name")%> type=Text value=<%=Quatity%> size=5 maxlength=5></td>
					<td height="18" width="18%">¥<%=FormatNumber((csng(rmb)*Quatity),2,-1)%>元</td>
				</tr>
				<%
rs.MoveNext
Wend
%>
				<tr>
					<td height="18" colspan="5">
					<p align="right">合计价格:¥<%=FormatNumber(sum,2,-1)%>元</td>
				</tr>
				<tr>
					<td colspan="5"><p align=center>
<input name=Submit type=button id=Submit onclick="window.close();" value=继续购物 onFocus="this.blur()">
&nbsp; <input name=order type=submit value=更新购物车 onFocus="this.blur()">
&nbsp; <input name=Submit2 type=button onClick="javascript: confirmdel()" value=清空购物车 onFocus="this.blur()">
&nbsp; <input name=Submit3 type=button onclick="window.location='gathering.asp'" value=结算中心 onFocus="this.blur()">
</td>
				</tr>
				<tr>
					<td colspan="5">※说明</td>
				</tr>
				<tr>
					<td colspan="5">
					 <li>要改变商品数量,请先于<input name=expx value=1 size=5 maxlength=5 disabled>填写想要商品数量,然后点击<input type=button value=更新购物车 disabled></li>
                      <li>要继续购物,请直接点<input type=button value=继续购物 disabled>之前购买的商品将保存于购物车中</li>
                      <li>要取消购买的商品,请先取消<input type="checkbox" name="C1" value="ON" checked disabled>前面的“√”,然后点击<input type=button value=更新购物车 disabled>
				</td>
				</tr>
			</table>
           </form>
			</td>
		</tr>
	</table>
</div>
</body>

</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -