真晕,关于购物车的问题请教下!

mideachen 2008-04-03 08:47:06
购物车数据是存放在session里面的,如果我一次订购12种商品,每种商品的数量从1到12(a类商品是1件,b类商品是2件,c类商品是3件...L类商品是12件),然后我正式订购后生成的订单后,数量却正好相反了。a类商品的数量变成12件了,L类商品变成1件了。查了一天查不出啥问题,高手们帮忙看看吧,谢谢了!!!

晕,代码长了点贴不上来
...全文
60 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
mideachen 2008-04-03
  • 打赏
  • 举报
回复
喔,刚才重新细看了下,订单存在数据库里面的数据没有错,是显示订单明细时,出现订购的商品数量出现颠倒现象了
ymle1228 2008-04-03
  • 打赏
  • 举报
回复
太长了,看的好累啊!
mideachen 2008-04-03
  • 打赏
  • 举报
回复
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>订单结束</title>
<link href="Css/Style.css" rel="stylesheet" type="text/css">
<script src="SiteCode/Common.js"></script>
<!--#include file="Top.shtml" --></head>
<body topmargin="0" leftmargin="0">
<table width="950" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="215" valign="top"> <table width="210" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="27" align="center" background="/image/bg1.gif"><strong>常
见 问 题</strong> </td>
</tr>
<tr>
<td bgcolor="#FFFAF4" class="biao" style="line-height:22px"> <TABLE WIDTH="190" BORDER="0" CELLSPACING="0" CELLPADDING="0" align="center" >
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 6 * from Article where NewsTypeID=1 order by ID desc",conn,1,1
if rs.eof and rs.bof then
response.write "<TR><TD height=45 bgcolor=#FFFFFF align=center>暂无动态信息!</td></tr>"
else
i=0
do while not rs.eof %>
<TR>
<TD width="16"><IMG height=11 src="image/tp003.gif" width=12 border=0></TD>
<TD height="26"><font color="<%=rs("Color")%>"><a href="/faq.shtml?id=<%=rs("ID")%>" alt="<%=rs("Title")%>">
<%=rs("Title")%> </a></font></TD>
</TR>
<%
i=i+1
if i>=10 then exit do
rs.movenext
loop
rs.close
set rs=nothing
end if%>
</TABLE></td>
</tr>
</table>
<table width="210" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5"> </td>
</tr>
</table>
<table width="210" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="27" align="center" background="/image/bg1.gif"><strong>搜
索 商 品</strong> </td>
</tr>
<tr>
<td align="center" bgcolor="#FFFAF4" class="biao"> <table border="0" width="85%" cellspacing="1" cellpadding="5">
<form action="/Search_Product.shtml" method="Post">
<tr>
<td>关键字:
<input type="text" name="Key2" size="14" class=an5></td>
</tr>
<tr>
<td>品  牌:
<select name="BrandID" style="width:95">
<option value="" selected></option>
<script src="/SiteCode/BrandListID.JS"></script>
</select></td>
</tr>
<tr>
<td align="center"><input name="Submit2" type="image" src="/img/serch.gif" width="60" height="19" border="0"></td>
</tr>
</form>
</table></td>
</tr>
</table> </td>
<td width="735" valign="top"> <table border="0" width="735" align="center" cellspacing="0" cellpadding="0">
<tr>
<td width="10" height="31" ><img src="Image/index_27l.gif" width="10" height="40"></td>
<td width="716" background="Image/index_27c.gif" > <table border="0" width="50%" cellspacing="0" cellpadding="0">
<tr>
<td align="right"><img src="Image/PageList/Icon_02.gif" border="0"></td>
<td>您的位置:<a href="/index.html">网站首页</a> > 您已完成此次订购</td>
</tr>
</table></td>
<td width="9"><img src="Image/index_27r.gif" width="9" height="40"></td>
</tr>
</table>
<table border="0" width="735" cellspacing="0" cellpadding="0">
<tr>
<td> <table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#E3F4F1">
<td width="294" height="28" align="center" class="probuy2" style="border-top:1px solid #BBBFCA"> <b>商品名称</b>(您本次惠顾的商品清单)</td>
<td width="167" align="center" class="probuy2" style="border-top:1px solid #BBBFCA"><strong>规
格</strong></td>
<td width="94" align="center" class="probuy2" style="border-top:1px solid #BBBFCA"> <b>单
价</b></td>
<td width="58" align="center" class="probuy2" style="border-top:1px solid #BBBFCA"><b>数
量</b></td>
<td width="122" align="center" class="probuy2" style="border-right:1px solid #BBBFCA;border-top:1px solid #BBBFCA"><strong>小
计</strong></td>
</tr>
<%
SalesListT=split(SalesList,",")
QuatitytT=split(Quatityt,",")
for i=0 to ubound(SalesListT)
%>
<tr>
<td height="23" bgcolor="#FFFFFF" class="probuy2"> 
<%
sql="select * from Sales where ID="&SalesListT(i)
set rs=server.createobject("ADODB.Recordset")
rs.open sql,conn,1,3

BigTypeID=rs("BigTypeID")
ProductID=rs("ProductID")
Product=rs("Product")
PriceB=rs("PriceB")
Capa=rs("Capa")
GuiGe=rs("GuiGe")
Sign=rs("Sign")

rs.close
set rs=nothing
%>
<a href="/Product/Product<%=BigTypeID%><%=ProductID%>.html" target="_blank"><%=Product%></a>
</td>
<td height="23" bgcolor="#FFFFFF" style="padding-left:10px" class="probuy2"><%=Sign%></td>
<td bgcolor="#FFFFFF" style="padding-left:10px" class="probuy2"><font color="Red"><%=PriceB%>元</font>
/ <%=Capa%><%=GuiGe%></td>
<td bgcolor="#FFFFFF" class="probuy2" style="padding-left:10px"><%=QuatitytT(i)%>
</td>
<td bgcolor="#FFFFFF" class="probuy2" style="padding-left:10px;border-right:1px solid #BBBFCA"><font color=red><%=Formatnumber(PriceB*QuatitytT(i),2,-1,0,0)%></font>
元</td>
</tr>
<%next%>
</table></td>
mideachen 2008-04-03
  • 打赏
  • 举报
回复

<%
UserName=Request.Cookies("WifeB2C_User")("UserName")
OrdersFrom=Request.Cookies("UnitOfNo1Th")("FromMemberID")
If OrdersFrom="" Then
sql="select UserFrom from UserInfo where UserName='"&UserName&"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
If rs.eof or rs.bof then
OrdersFrom=""
else
OrdersFrom=rs("UserFrom")
end if
rs.close
Set rs=nothing
End If
%>
<%
if UserName="" then
Info="操作错误,原因可能是:\n您尚未注册或您还没有登陆!"
Action = "location='/UserInfo/Login.shtml'"
Call ShowMsgBox(Info, Action)
End If
%>
<%
'判断购物车是否为空,为SalesList赋值
SalesList=Session("SalesList")
Quatityt=Session("Quatityt")
If SalesList="" then
Info="操作错误,原因可能是:\n对不起,您的购物车为空请购物后查看!"
Action="self.close()"
Call ShowMsgBox(Info, Action)
end if

'防止用户刷新重新提交订单
If Session("Sum")="0" then
Session("Sum")=""
Info="操作错误,原因可能是:\n对不起,您的订单已经提交过了,请不要重复提交!"
Action="self.close()"
Call ShowMsgBox(Info, Action)
End if

'如果购买金额小于最低购买金额的处理
if Int(Application("WifeB2C_LoyBuy"))-Int(replace(Session("Sum"),",",""))>0 then
Info="操作错误,原因可能是:\n对不起,您现在的购物金额小于本站规定的最低金额无法进行结算!"
Action="self.close()"
Call ShowMsgBox(Info, Action)
End if
%>
<%
'取得公用数据 [Session("sum")是经过处理加","的字串,SUM是没有处理的]
PSum=Replace(Request("Sum"),",","")
DeliMoney=Request("DeliMoney")
DeliID=Request("DeliID")
PayType=Request("PayType")
RealName=Request("RealName")
Phone=Request("Phone")
Mobile=Request("Mobile")
JiFen=Request("JiFen")
PostCode=Request("PostCode")
Email=Request("Email")
ReAddRess=Request("ReAddRess")
MsgContent=replace(request("MsgContent"),">",">")
MsgContent=replace(MsgContent,"<","<")
MsgContent=replace(MsgContent,"'","’")

If PSum="" or DeliMoney="" then
Info="操作错误,原因可能是:\n未知错误,信息丢失,请重新购买!"
Action="history.go(-2)"
Call ShowMsgBox(Info, Action)
End if

If DeliID="" then
Info="操作错误,原因可能是:\n请您选择合适的配送方式!"
Action="history.go(-1)"
Call ShowMsgBox(Info, Action)
End if

If RealName="" or Phone="" or PostCode="" then
Info="操作错误,原因可能是:\n未填写收货人的姓名;\n未填写收货人的联系电话;\n未填写您收货地区的邮政编码。"
Action="history.go(-1)"
Call ShowMsgBox(Info, Action)
End if

If PayType="0" then
Info="操作错误,原因可能是:\n请您选择合适的结算方式!"
Action="history.go(-1)"
Call ShowMsgBox(Info, Action)
End if

If ReAddRess="" then
Info="操作错误,原因可能是:\n请填写有效的收货地址!"
Action="history.go(-1)"
Call ShowMsgBox(Info, Action)
End if

If Len(MemberName)>300 then
Info="操作错误,原因可能是:\n收货地址及其他要求不能超过300字。"
Action="history.go(-1)"
Call ShowMsgBox(Info, Action)
End if
%>
<%
'产生订单编号
yy=year(date)
mm=right("00"&month(date),2)
dd=right("00"&day(date),2)
idate=yy & mm & dd

xx=right("00"&hour(time),2)
ff=right("00"&minute(time),2)
mm=right("00"&second(time),2)
itime=xx & ff & mm

BillNo=idate & itime
%>
<%
'初始化用户选择的配送方式,产生对用户的反馈信息
sqlp="select * from DeliVery where ID=" & DeliID
set rsp=server.createobject("adodb.recordset")
rsp.open sqlp,conn,1,1
DeliVery=rsp("DeliVery")
DeliIntro=rsp("DeliIntro")
DeliTime=rsp("DeliTime")
rsp.close
set rsp=nothing
'结束
%>
<%
'初始化用户选择的结算方式,产生对用户的反馈信息
sqlp="select * from PayType where PayName='"&PayType&"'"
set rsp=server.createobject("ADODB.Recordset")
rsp.open sqlp,conn,1,1

If PayType="结算宝" or PayType="在线结算" then
PayIntro="空"
Else
PayIntro=rsp("PayIntro")
End if

rsp.close
set rsp=nothing
'结束
%>
<%
'开始向数据库里写订单信息
AllSum=int(PSum)+int(DeliMoney) '商品费用+配送费[取整]
Conn.execute "Insert into Orders (UserName,Mobile,ReAddRess,RealName,BillNo,JiFen,OrderTime,DeliID,AllSum,PayType,PostCode,Phone,SalesList,Quatityt,Ifpay,MsgContent,OrdersFrom) values ('"&UserName&"','"&Mobile&"','"&ReAddRess&"','"&RealName&"','"&BillNo&"','"&JiFen&"','"&Now()&"','"&DeliID&"','"&AllSum&"','"&PayType&"','"&PostCode&"','"&Phone&"','"&SalesList&"','"&Quatityt&"','"&IfPay&"','"&MsgContent&"','"&OrdersFrom&"')"
Conn.Execute "Update UserInfo Set OrderSum=OrderSum+'"&AllSum&"',OrderNo=OrderNo+1 where UserName='"&UserName&"'"
email2="368316627@qq.com"

mailserver="59.36.100.198"
Set msg = Server.CreateObject("JMail.Message")
Msg.ContentType="text/html"
fNote = "<span style=""FONT-SIZE: 13px;font-family: '宋体,Arial';""><B>你好!</B><BR><BR><B>有新订单需要处理了!</B>:<a href=""http://www.maiwenju.com/mideachen"" target=""_blank"">点击这里去查收</a><BR><BR><B>订单号码:</B>:"&BillNo&"<BR><BR><B>订购总金额:</B>:"&AllSum&" 元</span>"
msg.silent = true
msg.Logging = true
msg.Charset = "gb2312"
msg.From = "info@maiwenju.com"
msg.MailServerUserName ="info@maiwenju.com"
msg.MailServerPassword ="dddddd"
msg.FromName = "快而优系统自动发送"
msg.AddRecipient (email2)
msg.Subject = "老板!有人下订单了,快看看去吧!"
msg.Body = fNote
msg.Send (mailserver)
msg.close
set msg = nothing
%>
<%
'清空购物车的所有属性
Session("SalesList")=""
Session("Quatityt")=""
Session("ProductList")=""
Session("Sum")="0"
%>
<html>
<head>

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧