购物车中最小订购量的问题

piperzero 2006-08-29 08:48:30
当购物车中修改的数字低于最小定购量返回错误,然购物者再次修改.
...全文
352 9 打赏 收藏 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
wansai00 2006-09-04
  • 打赏
  • 举报
回复
。。。。。。
yongfa365 2006-09-04
  • 打赏
  • 举报
回复
<%@ LANGUAGE="VBScript" %>
<!--#include file="Inc/Conn.asp" -->
<%
Sub PutToShopBag( cpbm, ProductList )
If Len(ProductList) = 0 Then
ProductList = "'" & cpbm & "'"
ElseIf InStr( ProductList, cpbm ) <= 0 Then
ProductList = ProductList & ", '" & cpbm & "'"
End If
End Sub



ProductList = Session("ProductList")
Products = Split(Request("cpbm"), ", ")
For I=0 To UBound(Products)
PutToShopBag Products(I), ProductList
Next
Session("ProductList") = ProductList


Head="Below is the product detailed list which you selects and purchases"
ProductList = Session("ProductList")
If Len(ProductList) =0 Then
Response.Redirect "Product.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 "Product.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
%>
<html>
<head>
<meta name="Author" content="Hypo">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Basket list </title>
<link href="Inc/tanxiaofeng.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE1 {color: #FFFFFF};
-->
</style>
</head>
<script language="Javascript">

function fucCheckNUM(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>
<body bgcolor="#D9D9D9" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div align="center"> <br>
<table width="100%" border="0" align="center" cellspacing="0">
<tr>
<td width="80%" valign="top"><p align="center">
</p>
<p align="center">
<font color="#FF0000" >Basket list</font></p>
<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("quantity must number");
theForm.<%="Q_" & rs("Product_Id")%>.focus();
return (false);
}
return (true);
}
//--></script><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="100%" cellpadding="0">
<tr>
<td align="center" width="163" height="22" bgcolor="#999999"><font color="#FFFFFF">Item No</font></td>
<td align="center" width="429" height="22" bgcolor="#999999"><font color="#FFFFFF">Product Name</font></td>
<td align="center" width="93" height="22" bgcolor="#999999"><font color="#FFFFFF">quantity</font></td>
<td align="center" width="153" bgcolor="#999999"><span class="STYLE1"><STRONG>Unit Price</STRONG></span></td>
<td align="center" width="153" bgcolor="#999999"><span class="STYLE1"><STRONG>Total Price</STRONG></span></td>
<td align="center" width="149" height="22" bgcolor="#999999"><font color="#FFFFFF">buy it</font></td>
</tr>
<%
Sum = 0
While Not rs.EOF
Quatity = CInt( Request( "Q_" & rs("Product_Id")) )
If Quatity <= 0 Then
Quatity = CInt( Session(rs("Product_Id")) )
If Quatity <= 0 Then Quatity = rs("minorder")
End If

Session(rs("Product_Id")) = Quatity
Sum = Sum + ccur(rs("Price")) * Quatity
%>
<tr>
<td align="center" width="163" bgcolor="#F0FCFF"><%=rs("Product_Id")%> </td>
<td align="center" width="429" bgcolor="#F0FCFF"><%=rs("en_Title")%> </td>
<td width="93" align="center" bgcolor="#F0FCFF">

<input Name="<%="Q_" & rs("Product_Id")%>" Value="<%=Quatity%>" Size="3" onKeypress="return min_in()" onblur="check_input(this.value)" > </td>
<td width="153" align="center" bgcolor="#F0FCFF"><%price=rs("price")%>
<font color="#FF0000"><%response.Write formatnumber(price,2,-1,0)%></font>€</td>
<td width="153" align="center" bgcolor="#F0FCFF"><%xiaoji=cdbl(rs("price")*Quatity)%><font color="#FF0000"><%response.Write formatnumber(xiaoji,2,-1,0)%></font>€</td>
<td align="center" width="149" bgcolor="#F0FCFF"><input Type="CheckBox" Name="cpbm" Value="<%=rs("Product_Id")%>" Checked> </td>
</tr>
<%
rs.MoveNext
Wend
%>
<tr bgcolor="#F0FCFF">
<td height="22" ColSpan="6" Align="Right">All total price:<%zongji=sum%><font color="#FF0000"><%response.Write formatnumber(zongji,2,-1,0)%></font>€</td>
</tr>
</table>
</center></div><blockquote>
<p align="center">
<input Type="submit" Value="revise your quantity" name="B1" style="font-size: 9pt">   
<input type="button" value="Continue Shopping" name="B2" onClick="window.close();" style="font-size: 9pt">   
<input type="button" value="Empty Car" name="B3" OnClick="clean()" style="font-size: 9pt">   
<input type="button" value="Go to Counter" name="B4" onClick="location.href='Ment1.asp'" style="font-size: 9pt" >   
<input type="button" value="Close" name="B5" onClick="window.close();" style="font-size: 9pt"> <p align="center">NoticeIf you want "revise your quantity" please click " revise your quantity " button ! </blockquote>
</form>
</td></tr></table>
</div>
<%
rs.close
conn.close
%>
<script>
function min_in()
{
if (event.keyCode < 45 || event.keyCode > 57){alert('同志只能输入数字,谢谢'); event.returnValue = false;}
}

function check_input(aaa)
{
if (aaa<3)
{
alert("哥哥,太少了");
return false;
}
}
</script>

</body>
</html>
piperzero 2006-09-02
  • 打赏
  • 举报
回复
<%@ LANGUAGE="VBScript" %>
<!--#include file="Inc/Conn.asp" -->
<%
Sub PutToShopBag( cpbm, ProductList )
If Len(ProductList) = 0 Then
ProductList = "'" & cpbm & "'"
ElseIf InStr( ProductList, cpbm ) <= 0 Then
ProductList = ProductList & ", '" & cpbm & "'"
End If
End Sub



ProductList = Session("ProductList")
Products = Split(Request("cpbm"), ", ")
For I=0 To UBound(Products)
PutToShopBag Products(I), ProductList
Next
Session("ProductList") = ProductList


Head="Below is the product detailed list which you selects and purchases"
ProductList = Session("ProductList")
If Len(ProductList) =0 Then
Response.Redirect "Product.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 "Product.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
%>
<html>
<head>
<meta name="Author" content="Hypo">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Basket list </title>
<link href="Inc/tanxiaofeng.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE1 {color: #FFFFFF};
-->
</style>
</head>
<script language="Javascript">

function fucCheckNUM(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>
<body bgcolor="#D9D9D9" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div align="center"> <br>
<table width="100%" border="0" align="center" cellspacing="0">
<tr>
<td width="80%" valign="top"><p align="center">
</p>
<p align="center">
<font color="#FF0000" >Basket list</font></p>
<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("quantity must number");
theForm.<%="Q_" & rs("Product_Id")%>.focus();
return (false);
}
return (true);
}
//--></script><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="100%" cellpadding="0">
<tr>
<td align="center" width="163" height="22" bgcolor="#999999"><font color="#FFFFFF">Item No</font></td>
<td align="center" width="429" height="22" bgcolor="#999999"><font color="#FFFFFF">Product Name</font></td>
<td align="center" width="93" height="22" bgcolor="#999999"><font color="#FFFFFF">quantity</font></td>
<td align="center" width="153" bgcolor="#999999"><span class="STYLE1"><STRONG>Unit Price</STRONG></span></td>
<td align="center" width="153" bgcolor="#999999"><span class="STYLE1"><STRONG>Total Price</STRONG></span></td>
<td align="center" width="149" height="22" bgcolor="#999999"><font color="#FFFFFF">buy it</font></td>
</tr>
<%
Sum = 0
While Not rs.EOF
Quatity = CInt( Request( "Q_" & rs("Product_Id")) )
If Quatity <= 0 Then
Quatity = CInt( Session(rs("Product_Id")) )
If Quatity <= 0 Then Quatity = rs("minorder")
End If

Session(rs("Product_Id")) = Quatity
Sum = Sum + ccur(rs("Price")) * Quatity
%>
<tr>
<td align="center" width="163" bgcolor="#F0FCFF"><%=rs("Product_Id")%> </td>
<td align="center" width="429" bgcolor="#F0FCFF"><%=rs("en_Title")%> </td>
<td width="93" align="center" bgcolor="#F0FCFF">

<input Name="<%="Q_" & rs("Product_Id")%>" Value="<%=Quatity%>" Size="3"> </td>
<td width="153" align="center" bgcolor="#F0FCFF"><%price=rs("price")%>
<font color="#FF0000"><%response.Write formatnumber(price,2,-1,0)%></font>€</td>
<td width="153" align="center" bgcolor="#F0FCFF"><%xiaoji=cdbl(rs("price")*Quatity)%><font color="#FF0000"><%response.Write formatnumber(xiaoji,2,-1,0)%></font>€</td>
<td align="center" width="149" bgcolor="#F0FCFF"><input Type="CheckBox" Name="cpbm" Value="<%=rs("Product_Id")%>" Checked> </td>
</tr>
<%
rs.MoveNext
Wend
%>
<tr bgcolor="#F0FCFF">
<td height="22" ColSpan="6" Align="Right">All total price:<%zongji=sum%><font color="#FF0000"><%response.Write formatnumber(zongji,2,-1,0)%></font>€</td>
</tr>
</table>
</center></div><blockquote>
<p align="center">
<input Type="submit" Value="revise your quantity" name="B1" style="font-size: 9pt">   
<input type="button" value="Continue Shopping" name="B2" onClick="window.close();" style="font-size: 9pt">   
<input type="button" value="Empty Car" name="B3" OnClick="clean()" style="font-size: 9pt">   
<input type="button" value="Go to Counter" name="B4" onClick="location.href='Ment1.asp'" style="font-size: 9pt" >   
<input type="button" value="Close" name="B5" onClick="window.close();" style="font-size: 9pt"> <p align="center">NoticeIf you want "revise your quantity" please click " revise your quantity " button ! </blockquote>
</form>
</td></tr></table>
</div>
<%
rs.close
conn.close
%>

</body>
</html>
xzr2004 2006-08-29
  • 打赏
  • 举报
回复
LZ,yongfa365(http://hi.baidu.com/yongfa365)的我觉得能满足你的要求啊

我以前做过一个,不过系统要求每一个会员的订购量不同,我是把这个订购量放在数据库中的,下订单时再在数据库中查询
piperzero 2006-08-29
  • 打赏
  • 举报
回复
感谢yongfa365(http://hi.baidu.com/yongfa365) 但是这个例子我用不了的.还有么?
hongzi001179 2006-08-29
  • 打赏
  • 举报
回复
up
yongfa365 2006-08-29
  • 打赏
  • 举报
回复
<script>
function min_in()
{
if (event.keyCode < 45 || event.keyCode > 57){alert('同志只能输入数字,谢谢'); event.returnValue = false;}
}

function check_input(aaa)
{
if (aaa<3)
{
alert("哥哥,太少了");
return false;
}
}
</script>
<input type="text" name="money" value="" onKeypress="return min_in()" onblur="check_input(this.value)" >

输个非数字试试,输个小于3的数字点其它地方试试,输个大于3的数字试试。
你可以改变里边的aaa<3为你想要的数字
yongfa365 2006-08-29
  • 打赏
  • 举报
回复
<script>
function min_in()
{
if (event.keyCode < 45 || event.keyCode > 57){alert('同志只能输入数字,谢谢'); event.returnValue = false;}
}

function check_input(aaa)
{
if (aaa<3)
{
alert("哥哥,太少了");
return false;
}
}
</script>
<input type="text" name="money" value="" onKeypress="return min_in()" onblur="check_input(this.value)" >
piperzero 2006-08-29
  • 打赏
  • 举报
回复
ding

28,402

社区成员

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

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