www.gusucode.com > 中网景企业网站管理系统 2008源码程序 > english/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("Please Login !") 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")="cn" then conn.execute("delete from cnk_orderdetail where orderid='"&orderid&"'") Response.Cookies(cookies_name)("orderlang")="en" 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 USD,USD_user,USD_vip from cnk_products where id="&pid&"",conn,1,1 if weblevel="" then price=rs("USD") if weblevel=0 then price=rs("USD_user") if weblevel=1 then price=rs("USD_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("OK","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("Your cart is empty") 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>Cart -<%= sitename_en %></title> <meta name="Author" content="Powered by websys.cn - 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_en.js"></script> </head> <body> <div style="width:980px; background-color:#FFFFFF; margin-top:20px;"> <% Select Case isShop Case 0 Response.Write("Shopping is close") Case 1 %> <div class="articletitle">My Cart</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%"> No.</td> <td width="27%"> Item</td> <td width="17%"> QTY</td> <td width="14%"> Delete</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_en 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 align="left"><a href="product.asp?id=<%= rs("pid") %>" target="_blank"><%= rs("product_name_en") %></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_en.gif" border="0" onFocus="this.blur()" onClick="javascript:window.close()"> <input name="imageField" type="image" src="<%=UpDir%>images/cart_update_en.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_en.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_checkout_en.gif" border="0" onFocus="this.blur()" onClick="this.form.action='cart_checkout.asp';this.form.submit()"></td> </tr> <tr> <td height="38" colspan="4"><font color="#FF0000"><strong><%= bh-1 %></strong></font> Item(s) Total: <font color="#FF0000"><strong><%= totalcount %></strong></font> in the cart </td> </tr> </form> </table> </div> <% Case 2 %> <div class="articletitle">My Cart</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%"> No.</td> <td width="32%"> Item</td> <td width="18%"> QTY</td> <td width="14%">Price</td> <td width="15%">Total</td> <td width="13%"> Delete</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_en 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><%= bh %></td> <td align="left"><a href="product.asp?id=<%= rs("pid") %>" target="_blank"><%= rs("product_name_en") %></a></td> <td><input name="quantity" onKeyPress="event.returnValue=IsDigit();" value="<%= rs("quantity") %>" size="6" maxlength="9"></td> <td><%= rs("price") %></td> <td><%= totalone %></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") 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> Item(s), Totalprice: <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_en.gif" border="0" onFocus="this.blur()" onClick="javascript:window.close()"> <input name="imageField" type="image" src="<%=UpDir%>images/cart_update_en.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_en.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_en.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 %>