| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 478 人关注过本帖
标题:asp购物车其他都OK了 就删除的时候一直删除不掉。
只看楼主 加入收藏
蚂蚁哥
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2012-3-1
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
asp购物车其他都OK了 就删除的时候一直删除不掉。
第一个是第一次把产品加入购物车的时候的处理页面add.asp 另外一个是处理订单的一个页面 order_check.asp
先是add.asp的代码

<%
Sub PutToShopBag( Prodid, ProductList )
   If Len(ProductList) = 0 Then
      ProductList = "'" & Prodid & "'"
   ElseIf InStr( ProductList, Prodid ) <= 0 Then
      ProductList = ProductList & ", '" & Prodid & "'"
   End If
End Sub
%>
<%
ProductList = Session("ProductList")
Products = Split(Request("Product_Id"), ",")
For I=0 To UBound(Products)
   PutToShopBag Products(I), ProductList
Next
Session("ProductList") = ProductList
If Session("UserName")<>"" Then
Response.Redirect"order_check.asp"
Else
%>
html代码,删除了 让各位大哥看着方便....
<%
end if
%>

下一个是处理的页面 我把删除的动作放另外一个页面的 order_check.asp

<!--#include file="inc/conn.asp" -->
<%
Sub PutToShopBag( Product_Id, ProductList )
   If Len(ProductList) = 0 Then
      ProductList = "'" & Product_Id & "'"
   ElseIf InStr( ProductList, Product_Id ) <= 0 Then
      ProductList = ProductList & ", '" & Product_Id & "'"
   End If
End Sub
%>

<html>
<head>
<title>购物车</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="css/mt_style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body,td,th {
    font-size: 12px;
}
-->
</style></head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onLoad="self.focus();">

<%
'如果购买车为空,转入提示界面
ProductList = Session("ProductList")
If Len(ProductList) = 0 Then
   Response.write "<table  height=100% width=100%  ><tr><td align=center>您好!目前您的购物车为空,是不是 <a href='javascript:window.close()'><b>继续购物</b></a>?</td></tr></table>"
   response.end
end if

'判断是否支付,如支付转到支付页面,并生成在线支付所需数据参数
if request("payment")="开始支付" then
response.redirect "payment.asp"
end if

 
If request("action")="del" Then
    response.Write("<div align=center>已经提交动作了 但是还是删除不掉</div>")
    Dim   aArr
    aArr=Array(ProductList)
    Dim   ii
    For   ii=Lbound(aArr)   To   Ubound(aArr)
    If   aArr(ii)=3110285125   Then
    aArr(ii)=aArr(ii-1)
    End   If
    Next

end if

if request("payment")="清空购物车" then
   Session("ProductList")=""
   response.redirect "order_check.asp"

End If

if productlist<>"" then
  Set rsc=Server.CreateObject("ADODB.RecordSet")
  sqlc="select * from Product where Product_Id in ("&productlist&") order by Product_Id"
  rsc.open sqlc,conn,1,1
else
    Response.write "<table  height=100% width=100%  ><tr><td align=center>您好!目前您的购物车为空,是不是需要 <a href='../helpcenter.asp' target='blank_'><b>帮助</b></a>?还是 <a href='javascript:window.close()'><b>继续购物</b></a>?</td></tr></table>"
   response.end
end if


%>
<table width="630" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>           
    <td colspan="4" height="47"><font color=333333>&nbsp;&nbsp;&nbsp;&nbsp;欢迎您的光临,您所订购的商品清单如下:</font></td>
        </tr>
        <tr>
          <td colspan="4" height="88">
      <table border="0" cellspacing="1" cellpadding="0" align="center" width="567" bgcolor="#FCA607">
        <form action="order_check.asp" method="POST" name="check">
          <tr bgcolor="#FFFFFF">
            <td width="56" height="25">
              <div align="center"><font color="333333">取消</font></div>
            </td>
            <td width="283">
              <div align="center"><font color="333333">商 品 名 称</font></div>
            </td>
            <td width="57">
              <div align="center"><font color="333333">数 量</font></div>
            </td>
            <td width="85">
              <div align="center"><font color="333333">单 价</font></div>
            </td>
            <td width="85">
              <div align="center"><font color="333333">合 计</font></div>
            </td>
            <td width="85" align="center"><div align="center"><font color="333333">删除</font></div></td>
          </tr>
<%
Sum = 0
While Not rsc.EOF
 Quatity = CInt( Request( "Q_" & rsc("Product_Id")) )
  If Quatity <= 0 Then
       Quatity = CInt( Session(rsc("Product_Id")) )
      If Quatity <= 0 Then Quatity = 1
  End If

  if len(Quatityt)=0 then
    Quatityt=Quatity
  else
    Quatityt=Quatityt&","&Quatity
  end if

  if len(subslist)=0 then
   subslist=rsc("Title")
  else
   subslist=subslist&","&rsc("Title")
  end if

  Session(rsc("Product_Id")) = Quatity
  Sum = Sum + csng(rsc("Price")) * Quatity
  Sum=FormatNumber(Sum,1)
%>
          <tr bgcolor="#FFFFFF">
            <td width="56" height="20" align="center">
              <input type="CheckBox" name="Product_Id" value="<%=rsc("Product_Id")%>" Checked>
                <input type="hidden" name="subs" value="<%=rsc("Title")%>">         
            </td>
            <td width="283">&nbsp;&nbsp;<font color="333333"><%=rsc("Title")%></font></td>
            <td width="57" align="center">
              <input type="Text" name="<%="Q_" & rsc("Product_Id")%>" value="<%=Quatity%>" size="2" class="form">
           
            </td>
            <td width="85" align=center><font color="333333"><%=FormatNumber(rsc("Price"),1)%></font></td>
            <td width="85" align=center><font color="333333"><%=FormatNumber(csng(rsc("Price"))*Quatity,1)%></font></td>
            <td width="85" align=center><a href="order_check.asp?action=del&produceId=<%=rsc("Product_Id")%>" onclick="return confirm('你确定要删除吗?');">
                    删除</a></td>
          </tr>
          <%
rsc.MoveNext
Wend
rsc.close
set rsc=nothing
%>
          <tr bgcolor="#FFFFFF">
            <td colspan="6" height="35" align="center">            
                <input type="submit" name="payment" value="清空购物车"> &nbsp;
                <input type="submit" name="order" value="更新数量"> &nbsp;
                <input type="submit" name="payment" value="开始支付"> &nbsp;
                <input type="button" value="继续购物" language=javascript onClick="javascript:window.close()" name="button">
                <input type="hidden" name="cmdShow" value="Yes">
              <b> 总价格  = <font color="#ff0000"><%=Sum%>&nbsp;&nbsp;</font></b>
            </td>
          </tr>
        </form>
        <tr><td colspan="6" bgcolor="#ffffff"><br><UL>
            <LI>填写好需要的数量后,点击‘更新数量’
            <LI>如果要取消某个商品,取消选择的勾号,再点击‘更新数量’
        </UL></td></tr>
      </table>
 </td>
</tr>
</table>
</body>
</html>
搜索更多相关主题的帖子: 购物车 其他 Request 
2012-03-01 12:29
cnfarer
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:179
帖 子:3330
专家分:21157
注 册:2010-1-19
收藏
得分:20 
并未对ProductList进行操作,当然删不掉

★★★★★为人民服务★★★★★
2012-03-01 12:49
蚂蚁哥
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2012-3-1
收藏
得分:0 
回复 2楼 cnfarer
版主大人给一段完整代码吧 我比较菜.
2012-03-01 12:59
快速回复:asp购物车其他都OK了 就删除的时候一直删除不掉。
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016160 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved