www.gusucode.com > 中网景企业网站源码时尚版 2009.73码程序 > chinese/cart.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!--#include file="../opendb.asp" --> <!--#include file="../common/md5.asp" --> <!--#include file="../common/Alipay_Payto.asp" --> <% 'Call DisableOutSite() Dim ThisLang ThisLang=0 if isNoLoginOrder=0 and username="" then call alertmsgc("您未登录,请登录!") dim quantity,orderid,action,rsorder,ranNum quantity=Request.Form("quantity") orderid=request.Cookies(cookies_name)("orderid") action=Request("action") if request.Cookies(cookies_name)("orderlang")="en" then conn.execute("delete from cnk_orderdetail where orderid='"&orderid&"'") Response.Cookies(cookies_name)("orderlang")="cn" if orderid="" then randomize ranNum=int(900*rnd)+100 orderid=zhuan_date(date()) orderid=replace(trim(orderid),"-","") 'orderid=replace(orderid,":","") 'orderid=replace(orderid," ","") orderid=orderid&ranNum Response.Cookies(cookies_name)("orderid")=orderid end if conn.execute("delete from cnk_orderdetail where #"&date&"#-initime>2 and isorder=0") select case action case "add" dim pid,price pid=clng(Request("pid")) rs.open "select price,price_user,price_vip from cnk_products where id="&pid&"",conn,1,1 if weblevel="" then price=rs("price") if weblevel=0 then price=rs("price_user") if weblevel=1 then price=rs("price_vip") rs.close if quantity="" then quantity=1 else quantity=clng(quantity) end if rs.open "select id from cnk_orderdetail where pid="&pid&" and orderid='"&orderid&"'",conn,1,1 if rs.recordcount>0 then conn.execute("update cnk_orderdetail set quantity=quantity+"&quantity&" where id="&rs("id")) else conn.execute("insert into cnk_orderdetail (orderid,pid,quantity,price) values ('"&orderid&"',"&pid&","&quantity&","&price&")") end if rs.close response.Redirect "cart.asp" case "gengxin" dim theitem 'quantity=split(quantity,",") rs.open "select id from cnk_orderdetail where orderid='"&orderid&"' order by id",conn,1,1 'if UBound(quantity) <> 0 then for each theitem in Request.Form("quantity") if clng(theitem)<1 then conn.execute("delete from cnk_orderdetail where id="&rs("id")) exit for else conn.execute("update cnk_orderdetail set quantity="&theitem&" where id="&rs("id")) end if rs.movenext next 'end if rs.close 'call alertmsg_url("更新数量成功","cart.asp") Response.Redirect("cart.asp") case "del" conn.execute("delete from cnk_orderdetail where id="&Trim(Request.QueryString("delid"))) response.Redirect "cart.asp" case "clear" conn.execute("delete from cnk_orderdetail where orderid='"&orderid&"'") call alertmsgc("询价车已经清空") case "" dim bh,totalcount,totalprice,totalone bh=1 totalcount=0 totalprice=0 %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>购物车 -<%= sitename %></title> <meta name="Author" content="Powered by websys.cn - Asean Leung"> <link href="<%=UpDir%>skin/cnk/cnkcss.css" rel="stylesheet" type="text/css" /> <link href="<%=UpDir%>skin/cnk/sys.css" rel="stylesheet" type="text/css" /> <script type="text/JavaScript" src="<%=UpDir%>common/com.js"></script> </head> <body> <div style="width:980px; background-color:#FFFFFF; margin-top:20px;"> <% Select Case isShop Case 0 Response.Write("购物功能已经关闭") Case 1 %> <div class="articletitle">我的询价车</div> <div class="cnktable"> <table border="0" align="center" cellpadding="2" cellspacing="1"> <form name="form1" method="post" action=""> <tr class="tabletitle"> <td width="15%"> 编号</td> <td width="27%"> 产品名称</td> <td width="17%"> 数量</td> <td width="14%"> 删除</td> </tr> <% rs.open "select cnk_orderdetail.id,cnk_orderdetail.orderid,cnk_orderdetail.quantity,cnk_orderdetail.pid,cnk_products.product_model,cnk_products.product_name from cnk_orderdetail,cnk_products where cnk_orderdetail.pid=cnk_products.id and cnk_orderdetail.orderid='"&orderid&"' order by cnk_orderdetail.id",conn,1,1 do while not rs.eof%> <tr> <td><%= bh %></td> <td><a href="product.asp?id=<%= rs("pid") %>" target="_blank"><%= rs("product_name") %></a></td> <td><input name="quantity" onKeyPress="event.returnValue=IsDigit();" value="<%= rs("quantity") %>" size="6" maxlength="9"></td> <td><a href=cart.asp?action=del&delid=<%= rs("id") %>><img src="<%=UpDir%>images/del.gif" border="0"></a></td> </tr> <% totalcount=totalcount+rs("quantity") bh=bh+1 rs.movenext loop rs.close %> <tr> <td height="45" colspan="4" align="center"><input name="imageField" type="image" src="<%=UpDir%>images/cart_jxtj.gif" border="0" onFocus="this.blur()" onClick="javascript:window.close()"> <input name="imageField" type="image" src="<%=UpDir%>images/cart_update.gif" border="0" onFocus="this.blur()" onClick="this.form.action='cart.asp?action=gengxin';this.form.submit()"> <input name="imageField" type="image" src="<%=UpDir%>images/cart_delall1.gif" border="0" onFocus="this.blur()" onClick="this.form.action='cart.asp?action=clear';this.form.submit()"> <input name="imageField" type="image" src="<%=UpDir%>images/cart_checkout1.gif" border="0" onFocus="this.blur()" onClick="this.form.action='cart_checkout.asp';this.form.submit()"></td> </tr> <tr align="center"> <td height="38" colspan="4">询价车里有产品: <font color="#FF0000"><strong><%= bh-1 %></strong></font> 件 总数: <font color="#FF0000"><strong><%= totalcount %></strong></font> 件</td> </tr> </form> </table> </div> <% Case 2 %> <div class="articletitle">我的购物车</div> <div class="cnktable"> <table border="0" align="center" cellpadding="2" cellspacing="1"> <form name="form1" method="post" action=""> <tr class="tabletitle"> <td width="8%"> 编号</td> <td width="32%"> 产品名称</td> <td width="18%"> 数量</td> <td width="14%">单价<%if weblevel<>"" then Response.Write("("&GetWebLevelName(weblevel)&")") %></td> <td width="15%">小计</td> <td width="13%"> 删除</td> </tr> <% rs.open "select cnk_orderdetail.id,cnk_orderdetail.orderid,cnk_orderdetail.quantity,cnk_orderdetail.pid,cnk_orderdetail.price,cnk_products.product_model,cnk_products.product_name from cnk_orderdetail,cnk_products where cnk_orderdetail.pid=cnk_products.id and cnk_orderdetail.orderid='"&orderid&"' order by cnk_orderdetail.id",conn,1,1 do while not rs.eof totalone=rs("price")*rs("quantity") %> <tr> <td align="center"><%= bh %></td> <td align="center" align="left"><a href="product.asp?id=<%= rs("pid") %>" target="_blank"><%= rs("product_name") %></a></td> <td align="center"><input name="quantity" onKeyPress="event.returnValue=IsDigit();" value="<%= rs("quantity") %>" size="6" maxlength="3"></td> <td align="center"><%= rs("price") %></td> <td align="center"><%= totalone %></td> <td align="center"><a href=cart.asp?action=del&delid=<%= rs("id") %>><img src="<%=UpDir%>images/del.gif" border="0"></a></td> </tr> <% totalcount=totalcount+rs("quantity") totalprice=totalprice+totalone bh=bh+1 rs.movenext loop rs.close %> <tr> <td height="38" colspan="6" align="center">购物车里有:<font color="#FF0000"><strong><%= totalcount %></strong></font> 个商品, 总价: <font color="#FF0000"><strong>¥ <%= totalprice %></strong></font> 元</td> </tr> <tr> <td height="45" colspan="6" align="center"><input name="imageField" type="image" src="<%=UpDir%>images/cart_jxtj.gif" border="0" onFocus="this.blur()" onClick="javascript:window.close()"> <input name="imageField" type="image" src="<%=UpDir%>images/cart_update.gif" border="0" onFocus="this.blur()" onClick="this.form.action='cart.asp?action=gengxin';this.form.submit()"> <input name="imageField" type="image" src="<%=UpDir%>images/cart_delall.gif" border="0" onFocus="this.blur()" onClick="this.form.action='cart.asp?action=clear';this.form.submit()"> <input name="imageField2" type="image" src="<%=UpDir%>images/cart_checkout.gif" border="0" onFocus="this.blur()" onClick="this.form.action='cart_checkout.asp';this.form.submit()" /></td> </tr> </form> </table> </div> <% End Select %> <br /> <br /> </div> </body> </html> <% end select %>