设为首页收藏本站

新微赢技术网

 找回密码
 注册
搜索
热搜: 回贴
查看: 60|回复: 2
打印 上一主题 下一主题

[求助]asp 购物车更改数量的问题

[复制链接]
跳转到指定楼层
1#
发表于 2010-1-8 22:52:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--#include file="conn.asp"--->
<!--#include file="util.asp"--->
<%
strCpbm=request("cpbm")
ProductList=session("ProductList")
Products=Split(request("cpbm"),",")
for I=0 to UBound(Products)
PutToShopBag Products(I),ProductList
Next
session("ProductList")=ProductList
Head="以下是你所选购的CD"
ProductList=session("ProductList")
if len(ProductList)=0 then
response.redirect"nothing.asp"
response.End
end if
if request("MySelf")="Yes" then
ProductList=""
Products=split(request("cpbm"),",")
for I=0 to UBound(Products)
PutToShopBag Products(I),ProductList
Next
session("ProductList")=ProductList
end if
if len(ProductList)=0 then
response.redirect"nothing.asp"
response.End
end if
set rs=server.CreateObject("adodb.recordset")
sql="Select * From product"
sql=sql & " Where Product_Id In("& ProductList&")"
rs.open sql,conn,3,3
set rs=conn.Execute(sql)
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>以下是你多选购的CD</title>
<style type="text/css">
<!--
.style2 {color: #333333}
-->
</style>
</head>
<script language="javascript">
function funCheckNUM(NUM)
{ var i,j,strTemp;
strTemp="0123456789"
if (NUM.length==0)
return 0
for(i=0;i<NUM.length;i++)
{
j=strTemp.indexOf(NUM.charAt(i));
if(j==-1)
{
return 0;
}
}
return 1;
}
function clean()
{
window.location.href="clear.asp"
}
</script>
<script language=javascript >
<!--
function form1_onsubmit()
{ newprice="Q_"&rs("Product_Id")
if((funCheckNUM(document.FORM1.newprice.value)==0))
{
alert("会员价有非法字符,请填写正确的会员价!@");
document.FORM1.newprice.focus();
return false;
}
//-->
}
</script>
<body topmargin="5">
<center>
<div align="center">
<center>
<table width="80%" border="0" cellpadding="0">
<tr>
<td width="80%" valign="top"><p align="center"></p>
<p align="center"><font color="#666666"><%=Head%></font></p>
<!--Webbot BOT="GeneraredScript" PREVIEW="" startspan-->
<script language="javascript"><!--
function FrontPage_Form1_Validator(theForm)
{
var checkOK="0123456789-";
var checkStr=theForm.<%="Q_"&rs("Product_Id")%>.value;
var allValid=true;
var decPoints=0
var allNum=""
for(i=0;i<checkStr.length;i++)
{ ch=checkStr.charAt(i);
for(j=0;j<checkOK.length;j++)
if(ch==checkOK.charAt(j))
break;
if(j==checkOK.length)
{ allValid=false;
break;
}
allNum+=ch;
}
if(!allValid)
{
alert("请输入正确的商品数量!(1~4个字符)");
theForm.<%="Q_"&rs("Product_Id")%>.focus();
return(false);
}
return(true);
}
//-->
</script>
<!--Webbot BOT="GeneraredScript" PREVIEW="" endspan-->
<form action="eshop.asp" method="post" onSubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1">
<input type="hidden" name="MySelf" value="Yes">
<div align="center"><center>
<table border="0" cellspacing="1" width="550" class="main" bgcolor="#CCCCCC">
<tr bgcolor="#CCCCFF"></tr>
<td align="center" width="82" height="22" bgcolor="#CCFFFF"><span class="style2">CD编号</span></td>
<td align="center" width="82" height="22" bgcolor="#CCFFFF"><span class="style1">CD名称</font></td>
<td align="center" width="82" height="22" bgcolor="#CCFFFF"><span class="style1">CD价格</font></td>
<td align="center" width="82" height="22" bgcolor="#CCFFFF"><span class="style1">数量</font></td>
<td align="center" width="82" height="22" bgcolor="#CCFFFF"><span class="style1">购买</font></td>
<td align="center" width="82" height="22" bgcolor="#CCFFFF"><span class="style1">总价</font></td>
</tr>
<%
Sum=0
While Not rs.EOF
Quatity=cint(request("Q_"&rs("Product_Id"))) '我用SQL语句输出是这个地方的问题,
'有问题,可我不知道怎么改好
if Quatity<=0 then              
Quatity=cint(session(rs("Product_Id")))
if Quatity<=0 then Quatity=1
end if
session(rs("Product_Id"))=Quatity
Sum=Sum+ccur(rs("P_Newprice"))*Quatity
%>
<tr>
<td align="center" width="82" bgcolor="#eeeeee"><%=rs("Product_Id")%></td>
<td align="center" width="170" bgcolor="#eeeeee"><%=rs("Product_Name")%></td>
<td align="center" width="72" bgcolor="#eeeeee"><%=rs("P_Newprice")%></td>
<td align="center" width="76" bgcolor="#eeeeee" ><!--Webbot
bot="Validation" S-Display-Name="请输入正确的CD数量!" S-Data-Type="Integer" S-Number_Separators="x"
--><input name="<%="Q_" &rs("Product_Id")%>" value="<%=Quatity%>" size="3">
</td>
<td align="center" width="60" bgcolor="#EEEEEE"><input type="checkbox" name="cpbm" value="<%=rs("Product_Id")%>"Checked>
</td>
<td align="center" width="72" bgcolor="#eeeeee"><%=ccur(rs("P_Newprice"))*Quatity%>.00元</td>
</tr>
<%
rs.moveNext
Wend
%>
<tr>
<td align="right" colspan="6" width="546" bgcolor="#EEEEEE"><font color="#FF0000">总价格=人民币<%=Sum%>.00元</font></td>
</tr>
</table></center></div>
<blockquote><p align="center">
<input type="submit" value="更改数量" name="B1" style="font-size:13px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" value="继续购物" name="B2" onClick="window.close();"style="font-size:13px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" value="订单取消" name="B3" onClick="clean()" style="font-size:13px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" value="去收银台" onClick="window.open('ment.asp',window.close(),'Sample','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scollbars=yes,resizable=yes,copyhistory=yes,width=610,height=600,left=100,top=100')" name="B4"style="font-size:13px">
<p align="center"><font color="#FF0000">注意:更改CD数量需要按“更改数量”</font></p>
</p></blockquote></form>
</td></tr>
</table>
</center>
</div>
<% rs.close
conn.close
%>
</body>
</html>



现在选购一件商品的时候可以更改数量,当选购多件后,一点更改数量,默认就只显示一件商品的信息,后面的就没了
2#
发表于 2010-1-11 11:05:03 | 只看该作者
沙发...................
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

申请友链|小黑屋|最新主题|手机版|新微赢技术网 ( 苏ICP备08020429号 )  

GMT+8, 2024-11-20 07:23 , Processed in 0.096803 second(s), 8 queries , Gzip On, Memcache On.

Powered by xuexi

© 2001-2013 HaiAn.Com.Cn Inc. 寰耽

快速回复 返回顶部 返回列表