asp shopping cart

来源:互联网 发布:如何设置网络 编辑:程序博客网 时间:2024/06/05 08:19
 
<%  dim proId,qtn,actact=Request("act")     '根据act的值,来判断采取什么过程.proId=Request("proId") 'productIDqtn=Request("qtn")     'Quantityif act="mod" then      '修改商品数量  call uCart.ModifItem(proId,qtn,2)elseif act="del" then  '删除某个商品  call uCart.DelItem(proId)elseif act="clearAll" then '清空购物车  call uCart.RemoveAll()end ifIf uCart.CheckItem(proId)=False and act="add" Then '添加产品进行判定,防止刷新页面增加商品set rs = Server.CreateObject("adodb.recordset")rs.open "select goods_name,market_price,shop_price,goods_img from t_goods where goods_id="&proId,conn,1,1if not rs.eof then    call uCart.AddItem(proId,rs("goods_name"),rs("market_price"),rs("shop_price"),0,qtn,rs("goods_img"))end ifrs.closeset rs=nothingend ifmyCart=uCart.ViewCart() '查看购物车里详细信息%>            <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#DEF3C8">              <tr>                <td width="11%" height="30" align="center" class="font_14hei">图片</td>                <td width="19%" align="center" class="font_14hei">商品名称</td>                <td width="20%" align="center" class="font_14hei">销售价格</td>                <td width="20%" align="center" class="font_14hei">优惠价格</td>                <td width="10%" align="center" class="font_14hei">数量</td>                <td width="10%" align="center" class="font_14hei">金额</td>                <td width="10%" align="center" class="font_14hei">操作</td>              </tr>           <%For i=LBound(myCart,2) To UBound(myCart,2) If myCart(0,i)<>"" Then '以前的判断语句   %>              <form name="form1" method="post" action="?act=mod">              <tr>                <td height="30" align="center" bgcolor="#FFFFFF"><img src="<%= myCart(6,i) %>" width="98" height="103" /></td>                <td align="center" bgcolor="#FFFFFF" class="font_12lvse"><%= myCart(1,i) %></td>                <td align="center" bgcolor="#FFFFFF">¥<%= myCart(2,i) %></td>                <td align="center" bgcolor="#FFFFFF">¥<%= myCart(3,i) %></td>                <td align="center" bgcolor="#FFFFFF"><input name="qtn" type="text" value="<%= myCart(5,i) %>" size="2" onkeyup="this.value=this.value.replace(/\D/g,'')" />                <input type="hidden" name="proId" value="<%= myCart(0,i) %>" />                <input type="submit" value="修改" /></td>                <td align="center" bgcolor="#FFFFFF">¥<% Response.Write(myCart(5,i)*myCart(3,i)) %></td>                <td align="center" bgcolor="#FFFFFF"><a href="?act=del&proId=<%= proId %>">删除</a></td>              </tr>              </form>              <% End IfNextif uCart.CheckEmtpy then Response.Write("<td colspan='7' align='center'>暂无购买商品,请继续 <a href='product.asp' style='color:red'>购物</a></td>")myprice=uCart.TPrice() '得到商品总金额%>            </table>                        <p style="margin-top:5px;">                 <input type="button" value="继续购物" onclick="window.location.href='product.asp';" />              <input type="button" value="清空购物车" onclick="window.location.href='?act=clearAll';" />              <span style="margin-left:500px;">商品总额:¥<%  if uCart.CheckEmtpy then '检查购物车是否为空   Response.Write(0)  else     Response.Write(myprice(1))   end if   %></span>              <input type="button" value="去结算" style="margin-left:10px;" onclick="window.location.href='order1.asp';" />             </p>

原创粉丝点击