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

📄 cart_list.asp

📁 网上购物系统
💻 ASP
字号:
<%
dim startime
startime=timer()
%>
<% Response.Expires = -100 %>
<!--#include file="Conn.asp"-->
<!--#include file="include/MyRequest.asp" -->
<!--#include file="include/nosql.asp" -->
<!--#include file="Sub.asp" -->
<%
url=request.servervariables("http_referer")

ProdIds  = Session("ProdIds")
ProdNums = Session("ProdNums")

Sub PutToShopBag( add, x )
	p=split(x,",")
    If Len(x) = 0 Then
        x = add
    Else
    	for i=0 to ubound(p)
			if p(i)=add then
    			response.write "<script language=javascript>alert('您已经将此商品加入了购物车,请不要重复!');javascript:history.go(-1);</script>"
    			response.End
    		end if
		next
		x = x & "," & add
    End If
End Sub

'非相同过滤过程
Sub PutToShopBag2( x, y ) 
    If Len(y) = 0 Then
        y = x
    Else
        y = y & ","& x
    End If
End Sub

'保存商品数量
If Request("cmdShow") = "Yes" Then
    ProdIds = ""
    a = Split(nosql(request("mc")), ",")
    For I=0 To UBound(a)
        if  a(I)="" then a(I)=1
        PutToShopBag a(I), ProdIds
    Next
    Session("ProdIds") = ProdIds
   
    ProdNums = ""
    b = Split(nosql(request("pbuynums")), ",")
    For I=0 To UBound(b)
        if b(I)="" then b(I)=1
        PutToShopBag2 b(I), ProdNums
    Next
    Session("ProdNums") = ProdNums
    response.write "<meta http-equiv=""refresh"" content=""0;url=cart_list.asp"">"
End If

Call Header("我的购物车","我的购物车")
response.write  "<div class=MainDesc>"&_
				"	<table border=1 width=100% cellpadding=4 style='border-collapse: collapse' bordercolor='#DFDFDF'>"&_
				"		<tr bgcolor=#F3F3F3><td>商品名称</td><td>市场价</td><td>网站价</td><td>订购数量</td><td>小计</td><td>删除</td></tr>"&_
				"		<form action=Cart_List.asp method=post name=form1 onsubmit=return CheckFrom();>"&_
				"		<input type=hidden name=cmdShow value=Yes>"
    					if ProdIds<>"" then
      		    			aaa=split(ProdNums,",")
     		    			bbb=split(ProdIds,",")
    		    			Quatitys=split(Request("pbuynums"),",")
                			session("y")=ubound(bbb)+1

        	    			for i=0 to ubound(bbb)
        	    			set rs=server.createobject("adodb.recordset")
        	    			sql="select id,prod_info_PriceM,prod_info_PriceS,prod_info_name from prod_info where id="&bbb(i)
        	    			rs.open sql,conn,1,1
        	    			if not rs.eof then
        	        			set id=rs(0)
        	        			set prod_info_PriceM=rs(1)
        	        			set RMB=rs(2)
        	        			set prod_info_name=rs(3)

        	        			While Not rs.EOF
        	        			Quatity = Quatitys(i)
        	        			If Quatity <>"" Then 
        	            			x=Quatity
        	        			else
        	            			x=aaa(i)
       	                			if aaa(i)="" then x=1
       	            			end if
       	            			sum1=sum1 + csng(rmb) * x
       	            			sum=FormatNumber(sum1,2,-1)
       	            			session("sum")=sum
response.write  "		<tr>"&_
				"			<td><input type=hidden name=mc value="&id&"><a href=prod_Detail.asp?id="&id&" target=_blank>"&prod_info_name&"</a></td>"&_
				"			<td>¥"&FormatNumber(prod_info_PriceM,2,-1)&"</td>"&_
				"			<td><font color=#FF0000>¥"&FormatNumber(Rmb,2,-1)&"</font></td>"&_
				"			<td><input name=pbuynums value="&x&" size=5 maxlength=5></td>"&_
				"			<td>¥"&FormatNumber((csng(rmb)*x),2,-1)&"</td>"&_
				"			<td><a href=Cart_Del.asp?MyAction=Del&id="&id&">删除</a></td>"&_
				"		</tr>"
            	    			rs.MoveNext
            	    			Wend
        	   				end if
        	  				rs.close
        	   				set rs=nothing
        	   				next
response.write  "		<tr><td colspan=6 align=right>合计金额:<span style='color:#FF6633;font-size:18px;'>¥"&sum&"</span></td></tr>"&_
				"		<tr>"&_
				"			<td colspan=6 align=center>"&_
				"    			<input name=order type=submit onFocus=this.blur() value=修改数量>&nbsp;"&_
				"    			<input type=button value=清空购物车 onclick=window.location='cart_clear.asp'>&nbsp;"&_
				"    			<input name=Submit type=button onclick=window.location='index.asp' value=我还要买别的 onFocus=this.blur()>&nbsp;"&_
				"    			<input type=button value=去收银台结账付款 onclick=window.location='Cart_Order.asp'>"&_
				"    		</td>"&_
				"		</tr>"
    	    			else
response.write  "		<tr><td colspan=6 align=center><a href=index.asp>购物车为空,请返回选购商品!</a></td></tr>"
    	    			end if
response.write  "	</table>"&_
				"</div>"
Footer
dim endtime
endtime=timer()
response.write  "页面执行时间:"&FormatNumber((endtime-startime)*1000,3)&"毫秒"
%>

⌨️ 快捷键说明

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