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

📄 shopcart.asp

📁 诚信商店系统源代码
💻 ASP
字号:
<!--#include file="title.asp"--><meta name=keywords content="诚信商店,血饮狂刀,Clanboo,lanboo,金统联,webmaster@xytime.com,jsbuy.com,cebuy.com,王星亮,完美商店,超级商店,商城,冷面">
<%
Sub PutToShopBag( productID,quantity, productList ,quantityList)
   If Len(productList) = 0 Then
      productList = "" & productID & ""
	  quantityList="" & quantity & ""
   ElseIf InStr( productList&",", productID&"," ) <= 0 Then
      productList =  productID & ""& ", " &productList
      quantityList = quantity & ", " &quantityList
   End If
   session("productList")=productList
   session("quantityList")=quantityList
End Sub

productList = session("productList")
quantityList = session("quantityList")
if Request("ProcID")<>"" then
   PutToShopBag Request("ProcID"), "1",productList,quantityList
end if
session("productList")=productList 
session("quantityList")=quantityList

Head="以下是您所选购的物品清单"

If Request("clear") = "yes" Then
   productList = ""
   quantityList = ""
   session("productList") = productList
   session("quantityList") = quantityList
End If

If Request("MySelf") = "Yes" Then
   productList = ""
   quantityList = ""
   products = Split(Request("ProcID"), ", ")
   For I=0 To UBound(products)
		j=UBound(products)-i
		tempQuantity=Request("quantity"&products(j))
		if tempQuantity="" then tempQuantity=1
'		j=i
      PutToShopBag products(j), tempQuantity,productList,quantityList
   Next
   session("productList") = productList
   session("quantityList") = quantityList
End If
'If Len(productList) = 0 Then
'	Response.Redirect "Nothing.asp"
'	response.end
'end if
%>
<script language="Javascript">
//函数名:fucCheckNUM
//功能介绍:检查是否为数字
//参数说明:要检查的数字
//返回值:1为是数字,0为不是数字
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(){ 
	if (confirm("确定要清空购物车?")==1){
	window.location.href="shopCart.asp?clear=yes"}
}

function checknum(theform) 
{
//newprice="Q_"&rs("product_Id")
 	if ((fucCheckNUM(theform.value)==0) )
	{	
	   theform.value="";
		//theform.newprice.focus();
		return false;
	}
}

function checkNumNull(theform) {
	if (theform.value=="") {	
	   alert("请填写购买商品的数量");
		//theform.newprice.focus();
		theform.focus();
		return false;
	}
}
//-->

</SCRIPT>
<table width="100%" border="0" cellspacing="0">
  <tr>
    <td width="80%" valign="top"><p align="center">
<font color="#FF0000" class=main1><%=Head%></font></p>
<form name="form1" Action="shopCart.asp" Method="POST" >
      <input type="hidden" name="MySelf" value="Yes">
<div align="center"><center>
               <table border="0" cellspacing="1" width="550" class=main bgcolor="#a5cede">
                    <tr bgcolor="#5294b7" align=center> 
                      <td align="center" width="65"  height="22" bgcolor="#5294b7"><font color="#FFFFFF" class="p105"><b>购买</b></font></td>
                      <td align="center" width="65"  height="22" bgcolor="#5294b7"><font color="#FFFFFF" class="p105"><b>商品编号</b></font></td>
                      <td align="center" height="22" bgcolor="#5294b7"><font color="#FFFFFF" class="p105"><b>商品名称</b></font></td>
                      <td align="center" width="65"  height="22" bgcolor="#5294b7"><font color="#FFFFFF" class="p105"><b>商品价格</b></font></td>
                      <td align="center" width="65"  height="22" bgcolor="#5294b7"><font color="#FFFFFF" class="p105"><b>商品数量</b></font></td>
                      <td align="center" width="65"  height="22" bgcolor="#5294b7"><font color="#FFFFFF" class="p105"><b>总价</b></font></td>
                    </tr>
                    <%
Sum = 0
'	response.write session("quantityList")&"quantityList<br>"
'	response.write session("productList")&"productList<br>"
If Len(productList) <>0 Then
'	response.End
   quantityArray = Split(session("quantityList"), ", ")
   productArray = Split(session("productList"), ", ")
   for i=0 to UBound(productArray)
	set rs=server.createobject("adodb.recordset")
	sql = "Select * from web_ProcLib where ProcID="&productArray(i)
	rs.open sql,conn,1,1
 	if Not rs.EOF or err then
		 quantity = quantityArray(i)
'		 quantity = cstr(quantityArray(i))
'		 response.write quantity&"quantity"
'		response.End 
	     If quantity <= 0 Then quantity = 1
	     Sum = Sum + rs("A16") * quantity
%>
                    <tr bgcolor="#f1f8fa"> 
                      <td Align="center" width="29">
                        <input Type="CheckBox" Name="ProcID" Value="<%=rs("ProcID")%>" Checked>
                      </td>
                      <td align="center" width="52"><%=rs("ProcID")%>  </td>
                      <td align="center" width="133"><%=rs("A5")%>  </td>
                      <td align="center" width="58"><%=rs("A15")%> </td>
                      <td align="center" width="64"> 
                        <input Name="quantity<%=rs("ProcID")%>" Value="<%=quantity%>" Size="4" onKeyUp="checknum(quantity<%=rs("ProcID")%>)">
                      </td>
                      <td Align="center" width="56"><%=rs("A16")*quantity%>元 
                      </td>
                    </tr>
                    <%	
    end if
   next
	rs.close
	canPay=""
else
	canPay="disabled"
end if
%>
                    <tr bgcolor="#f1f8fa"> 
                      <td Align="Right" ColSpan="6" width="417" height="24"><font Color="Red">总价格:&nbsp;<%=Sum%>&nbsp;元<font color="#ABABAB">人民币</font> 
                        &nbsp;&nbsp;</font></td>
                    </tr>
                  </table>
      </center></div><blockquote>
        <p align="center">
        <input Type="submit" Value="确认更改" name="B1" style="font-size: 9pt" <%=canPay%>>&nbsp;&nbsp;
        <input type="button" value="继续购物" name="B2" onclick="window.location='<%=session("oldUrl")%>';" style="font-size: 9pt">&nbsp;&nbsp;
        <input type="button" value="订单取消" name="B3" OnClick="clean()" style="font-size: 9pt" <%=canPay%>>&nbsp;&nbsp;
        <input type="button" value="去收银台" name="B4" onclick="window.location.href='PayMent.asp';" style="font-size: 9pt" <%=canPay%>>
      </blockquote>
              <div align="center"><font color="#FF0000">注意:改变商品数量和减少商品种类需按“确认更改”按钮</font> 
                <br>
              </div>
            </form>
    </td>
  </tr></table>


⌨️ 快捷键说明

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