asp 购物车修改数量100件后,总价和数量都对了,继续购物后,数量自动变回1,如何修改程序能保存100件?
<%@LANGUAGE="VBSCRIPT"CODEPAGE="936"%><%Response.Expires=-100%><!--#includefile="db_c...
<%@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
RMB=rs("p_mmoney")
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> 展开
<%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
RMB=rs("p_mmoney")
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> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询