www.gusucode.com > 中网景企业网站源码时尚版 2009.73码程序 > english/cart_checkout.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
dim orderid,action,rsorder
orderid=request.Cookies(cookies_name)("orderid")
action=Request.Form("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 call alertmsgc("Please add products")
set rsorder=conn.execute("select count(*) from cnk_orderdetail where orderid='"&orderid&"'")
if rsorder(0)=0 then  call alertmsgc("There is no product in the cart")

dim thisusername,sex,address,postcode,tel,fax,email,company,baojiafangshi,note,sendway,sendprice,totalprice,alltotalprice
Dim truename,UserFace,idcard,UserIM,mobile
if username<>"" then
	rs.open "select truename,sex,UserFace,idcard,UserIM,address,tel,fax,mobile,email from cnk_users where username='"&username&"'",conn,1,1
	if rs.recordcount>0 then
		truename=rs("truename")
		sex=rs("sex")
		UserIM=rs("UserIM")
		address=rs("address")
		tel=rs("tel")
		fax=rs("fax")
		mobile=rs("mobile")
		email=rs("email")
	end if
	rs.close
end if

if truename<>"" then username=truename
if sex="" then sex=1
%>
<!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 action
Case "" %>
  <% Select Case isShop
	Case 0 Response.Write("Shopping is close")
	Case 1 %>
  <div class="articletitle">Input Your Information</div>
  <div class="formlist">
  <form name="form1" method="post" action="cart_checkout.asp" onSubmit="return validata_form();">
    <ul>
      <li class="t1"><span class="red">*</span> Name:</li>
      <li class="t2"><input name="username" type="text" id="username" class="input" value="<%= username %>" size="50" maxlength="20" /></li>
    </ul>
	<ul>
      <li class="t1"> Sex:</li>
      <li class="t2"><input name="sex" type="radio" value="1" <% If sex=1 Then Response.Write("checked=""checked""")%> />
          Male
          <input type="radio" name="sex" value="0" <% If sex=0 Then Response.Write("checked=""checked""")%> />
          Female</li>
    </ul>
	<ul>
      <li class="t1"> Company:</li>
      <li class="t2"><input name="company" type="text" id="company" class="input" size="50" maxlength="50" />
        &nbsp;</li>
    </ul>
	<ul>
      <li class="t1"> <span class="red">*</span> Address:</li>
      <li class="t2"><input name="address" type="text" id="address" class="input" value="<%= address %>" size="50" maxlength="50" />&nbsp;</li>
    </ul>
	<ul>
      <li class="t1"> PostCode:</li>
      <li class="t2"><input name="postcode" type="text" id="postcode" class="input" size="50" maxlength="8" />&nbsp;</li>
    </ul>
	<ul>
      <li class="t1"> <span class="red">*</span> Telephone:</li>
      <li class="t2"><input name="tel" type="text" id="tel" class="input" value="<%= tel %>" size="50" maxlength="50" />&nbsp;</li>
    </ul>
	<ul>
      <li class="t1"> Fax:</li>
      <li class="t2"><input name="fax" type="text" id="fax" class="input" value="<%= fax %>" size="50" maxlength="50" />&nbsp;</li>
    </ul>
	<ul>
      <li class="t1"> E-mail:</li>
      <li class="t2"><input name="email" type="text" id="email" class="input" value="<%= email %>" size="50" maxlength="50" />&nbsp;</li>
    </ul>
	<ul>
      <li class="t1"> Quote Method:</li>
      <li class="t2"><input name="baojiafangshi" type="checkbox" id="baojiafangshi" value="Fax" />
          Fax
          <input name="baojiafangshi" type="checkbox" id="baojiafangshi" value="E-mail" />
          E-mail</li>
    </ul>
	<ul>
      <li class="t1"> Remark:</li>
      <li class="t2"><input name="note" type="text" id="note" class="input" size="50" maxlength="255">
        &nbsp;</li>
    </ul>
	<ul>
      <li class="t1"> <input name="action" type="hidden" id="action" value="submitorder"></li>
      <li class="t2"><input type="submit" name="Submit" class="button" value="Submit"></li>
    </ul>
	<div class="clearboth"></div>
  </form>
  </div>
  <% Case 2 %>
    <div class="articletitle">My Cart</div>
	<div class="cnktable">
	<table border="0" align="center" cellpadding="2" cellspacing="1">
      <tr class="tabletitle">
        <td width="9%"> No.</td>
        <td width="33%"> Item</td>
        <td width="17%"> QTY</td>
        <td width="21%">Price</td>
        <td width="20%">Total</td>
      </tr>
      <% 
	   dim bh,totalcount,totalone
	   bh=1
	   totalcount=0
	   totalprice=0
	  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><%= rs("quantity") %></td>
        <td>$ <%= rs("price") %></td>
        <td>$ <%= totalone %></td>
      </tr>
      <% totalcount=totalcount+rs("quantity")
	  totalprice=totalprice+totalone
	bh=bh+1	
	rs.movenext
	loop
	rs.close %>
      <tr>
        <td height="38" colspan="5" align="center"><font color="#FF0000"><strong><%= totalcount %></strong></font> Item(s), Totalprice: <font color="#FF0000"><strong>$ <%= totalprice %></strong></font> 
        <input name="Submit2" type="button" class="button" value="Back" onclick="history.go(-1);" /></td>
      </tr>
  </table>
  </div>
  <form name="chkoutform" method="post" action="cart_checkout.asp" onSubmit="return checkout();">
  <div class="cartbox">
	<div class="boxtitle">Receiver Information</div>
    <ul>
      <li class="tt1"><span class="red">*</span> Consignee:</li>
      <li class="tt2"><input name="username" type="text" class="input" id="username" value="<%= username %>" size="40" maxlength="20" />
      &nbsp;</li>
    </ul>
	<ul>
      <li class="tt1"> Sex:</li>
      <li class="tt2"><input name="sex" type="radio" value="1" <% If sex=1 Then Response.Write("checked=""checked""")%> />
          Male
          <input type="radio" name="sex" value="0" <% If sex=0 Then Response.Write("checked=""checked""")%> />
          Female&nbsp;</li>
    </ul>
	<ul>
      <li class="tt1"> Company:</li>
      <li class="tt2"><input name="company" type="text" class="input" id="company" size="40" maxlength="50" />
      &nbsp;</li>
    </ul>
	<ul>
      <li class="tt1"> <span class="red">*</span> Address:</li>
      <li class="tt2"><input name="address" type="text" class="input" id="address" value="<%= address %>" size="40" maxlength="50" />
      &nbsp;</li>
    </ul>
	<ul>
      <li class="tt1"> Postcode:</li>
      <li class="tt2"><input name="postcode" type="text" class="input" id="postcode" size="40" maxlength="8" />
      &nbsp;</li>
    </ul>
	<ul>
      <li class="tt1"> <span class="red">*</span> Telephone:</li>
      <li class="tt2"><input name="tel" type="text" class="input" id="tel" value="<%= tel %>" size="40" maxlength="50" />
      &nbsp;</li>
    </ul>
	<ul>
      <li class="tt1"> E-mail:</li>
      <li class="tt2"><input name="email" type="text" id="email" class="input" value="<%= email %>" size="40" maxlength="50" />
	  &nbsp;</li>
    </ul>
	<ul>
      <li class="tt1"> Remark:</li>
      <li class="tt2"><input name="note" type="text" class="input" id="note" size="40" maxlength="255">
          &nbsp;</li>
    </ul>
	<div class="clearboth"></div>
  </div>
  <div class="cartbox">
    <div class="boxtitle">Consignment Method</div>
	<ul>
      <li class="tt1"> Select Consignment Method:</li>
      <li class="tt2">
        <% dim xh
		xh=1
		rs.open "select * from cnk_sendway where Lang=1",conn,1,1
		do while not rs.eof %>
		<input type="radio" name="sendway" value="<%= rs("id") %>" id="sendway<%= rs("id") %>" <% If xh=4 Then Response.Write("checked=""checked""")%> />
        <label for="sendway<%= rs("id") %>"><%= rs("sendname") %>, carriage: $ <%= rs("sendprice") %></label><br />
		<% rs.movenext
		xh=xh+1
		loop
		rs.close %>
      </li>
    </ul>
  </div>
  <div class="clearboth"></div>
  <div align="center"><br />
    <input name="action" type="hidden" id="action" value="submitorder">
	<input name="totalprice" type="hidden" id="totalprice" value="<%= totalprice %>">
	<input type="submit" name="Submit" class="button" value=" Check out ">
	</div>
	</form>
  <% End Select %>
<% Case "submitorder"
thisusername=Trim(Request.Form("username"))
sex=Trim(Request.Form("sex"))
address=Trim(Request.Form("address"))
postcode=Trim(Request.Form("postcode"))
tel=Trim(Request.Form("tel"))
fax=Trim(Request.Form("fax"))
email=Trim(Request.Form("email"))
company=Trim(Request.Form("company"))
baojiafangshi=Trim(Request.Form("baojiafangshi"))
note=Trim(Request.Form("note"))
sendway=Trim(Request.Form("sendway"))
totalprice=Trim(Request.Form("totalprice"))
alltotalprice=totalprice+sendprice

rs.open "select * from cnk_orderform where id is null",conn,1,3
rs.addnew
rs("orderid")=orderid
if userid<>"" then rs("userid")=userid
rs("username")=thisusername
rs("sex")=sex
rs("company")=company
rs("address")=address
rs("postcode")=postcode
rs("tel")=tel
rs("email")=email
rs("note")=note
if isShop=1 then
rs("fax")=fax
rs("baojiafangshi")=baojiafangshi
rs.update
rs.close
conn.execute("update cnk_orderdetail set isorder=1 where orderid='"&orderid&"'")
Response.Cookies(cookies_name)("orderid")=""
call alertmsgc("It's OK, thank you")
end if
if isShop=2 then
sendprice=GetSentprice(Trim(Request.Form("sendway")))
rs("sendway")=sendway
rs("sendpay")=sendprice
rs("totalprice")=totalprice
rs("alltotalprice")=alltotalprice
rs("bizhong")="USD$"
rs.update
rs.close
conn.execute("update cnk_orderdetail set isorder=1 where orderid='"&orderid&"'")
Response.Cookies(cookies_name)("orderid")=""
end if
%>
<div class="textbox">
  <div class="articletitle">Order complete! (waiting for pay)</div>
  Order number: <span class="red"><%= orderid %></span> <br />   
  Order Date:<%= zhuan_time(now) %>
  <br />
Order state: Order complete, waiting for pay<br />
Products Totalprice: $<%= totalprice %><br />
Freight Price:$<%= sendprice %><br />
Totalprice:$<%= alltotalprice %></div>
<% End Select %>
  <br />
  <br />
</div>

</body>
</html>