<!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>
<title>購物車 - 訂單號:{dede:var.carts.orders_id/}</title>
<meta http-equiv="Content-Type" content="text/html; charset={dede:global.cfg_soft_lang/}" />
<meta name="generator" content="DedeCMS V5.6" />
<meta name="author" content="desdev.cn" />
<link href="{dede:global.cfg_templets_skin/}/style/dedecms.css" rel="stylesheet" media="screen" type="text/css" />
<link href="{dede:global.cfg_templets_skin/}/style/table.css" rel="stylesheet" media="screen" type="text/css" />
<script type="text/javascript" language="javascript" src="../images/js/j.js"></script>
</head>
<body class="buycarpage">

<div class="header">
	<div class="top w960 center">
		<div class="title">
			 <h1><a href="{dede:global.cfg_basehost/}" title="{dede:global.cfg_webname/}"><img src="{dede:global.cfg_templets_skin/}/images/logo.gif" alt="{dede:global.cfg_webname/}"/></a> </h1>
		</div><!-- /title -->
		<div class="welcome">
            <?php
            if(!$cfg_ml->IsLogin()){
            ?>
            您好,歡迎來到本網站, 請 <a href="../member/login.php?gourl=<?php echo urlencode(GetCurUrl());?>">登錄</a> 或 <a href="../member/index_do.php?fmdo=user&dopost=regnew">註冊</a>
            <?php
            }else{
            ?>
            <b><?php echo $cfg_ml->M_UserName; ?></b>,歡迎您的登陸。 <a href="<?php echo $cfg_memberurl; ?>/index.php">會員中心</a> |
                <a href="<?php echo $cfg_memberurl; ?>/edit_fullinfo.php">我的資料</a> |
                <a href="<?php echo $cfg_memberurl; ?>/index.php?uid=<?php echo urlencode($cfg_ml->M_LoginID);?>">我的空間</a> |
                <a href="<?php echo $cfg_memberurl; ?>/index_do.php?fmdo=login&dopost=exit">退出登錄</a>
            <?php
            }
            ?>
		</div><!-- /banner -->
	</div><!-- /top -->
</div><!-- /header -->

<div class="w960 clear center mt1 cmt-box">
	<div class="sp-title"><h2>購物車</h2></div>
    <div id="errorChickCookie" class="clear center mt1" style="font-style:inherit;color:#666;font-weight:normal;padding-top:8px;padding-bottom:8px;text-align:center;"></div>	
    <div class="buycar">
		<h2>我的購物車 - 訂單號:<em id="carId">{dede:var.carts.orders_id/}</em></h2>
		<form id="form1" name="form1" method="post" action="posttocar.php">
		<input id="dopost" name="do" type="hidden" value="del" />
        <!--startprint1-->
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="dede_table trlist">
			<thead>
				<tr>
					<td colspan="6">商品列表</td>
				</tr>
			</thead>
			<tbody>
				<!--以下列出購物車內購商品列表(數組),開始遍歷數組-->
				<tr>
					<th>選擇</th>
					<th>編號</th>
					<th>名稱</th>
					<th>數量</th>
					<th>單價(元)</th>
					<th>操作</th>
				</tr>
                {dede:array.Items}
				<tr>
					<td height="23"><input type="checkbox" name="ids[]" value="{dede:value.id/}" /></td>
					<td height="23">{dede:value.id/}</td>
					<td height="23"><a href="view.php?aid={dede:value.id/}" target="_bank">{dede:value.title/}</a></td>
					<td height="23">
						<input name="buynum{dede:value.id/}" type="text" id="buynum{dede:value.id/}" value="{dede:value.buynum/}" size="5" maxlength="5" class="ipt-txt" />
						<small>{dede:value.units/}</small></td>
					<td height="23">{dede:value.price/}</td>
					<td height="23"><a href="posttocar.php?do=del&ids={dede:value.id/}">刪除</a></td>
				</tr>
                {/dede:array}
				<!--構造購物車內商品列表結束-->
			</tbody>
			<tfoot>
				<tr>
					<td colspan="6" align="right">
						<div style="float:left;">
							共 <font color=red>{dede:var.carts.cart_count/}</font> 件商品,合計: <font color=red>{dede:var.carts.price_count/}</font>元	</div>
							<div style="float:right; height:33px;">
							<!--<input type="button" value="打印購物車" class="btn-2" onclick="printPage(1)"/>--> 
                            <input type="button" value="更新訂單號" class="btn-2" onclick="makeCarId()"/>
							<input type="button" value="刪除已選定" class="btn-2" onclick="DelPost()"/>
							<input type="button"  value="清空" onclick="if(confirm('確定清空購物車中的商品嗎?')){ location='posttocar.php?do=clear' }" class="btn-2" />
							<input onclick="ChangePost()" type="button" value="更新數量" class="btn-2" />
							<input type="button"  value="下一步" onclick="location='carbuyaction.php'" class="btn-2" />
						</div>
					</td>
				</tr>
			</tfoot>
		</table>
        <!--endprint1-->
        </form>
	</div>    
</div>
<!--購物車列表操作javascript請不要隨意改動-->
<script language="JavaScript" type="text/javascript">
//遍歷checkbox使之全選中,或反選
function CheckAll()
{
	for (var i=0;i<document.form1.elements.length;i++)
	{
		var e = document.form1.elements[i];
		e.checked == true ? e.checked = false : e.checked = true;
	}
}
//改變表單dopost值為:update,後submit提交表單
function ChangePost()
{
	CheckAll();
	document.getElementById("dopost").value = 'update';
	document.form1.submit();
}
//改變表單dopost值為:del,後submit提交表單
function DelPost()
{
	document.getElementById("dopost").value = 'del';
	document.form1.submit();
}
//AJAX產生一個新的訂單編號
function makeCarId()
{
	$.ajax({type: "POST", url: "car.php", data: "dopost=makeid", dataType: 'text',success: function(result){$("#carId").html(result);}}); 
}
//Print Page
function printPage(oper)
{
	if (oper < 10)
	{
		bdhtml = window.document.body.innerHTML;//獲取當前頁的html代碼
		sprnstr = "<!--startprint"+oper+"-->";//設置打印開始區域
		eprnstr = "<!--endprint"+oper+"-->";//設置打印結束區域
		prnhtml = bdhtml.substring(bdhtml.indexOf(sprnstr)+18); //從開始代碼向後取html
		prnhtml = prnhtml.substring(0,prnhtml.indexOf(eprnstr));//從結束代碼向前取html
		window.document.body.innerHTML = prnhtml;
		window.print();
		window.document.body.innerHTML = bdhtml;
	}else{
		window.print();
	}
}
</script>
<!--購物車列表操作javascript結束-->
{dede:include filename="../default/footer.htm"/}
<script language="JavaScript" type="text/javascript">
if(!navigator.cookieEnabled)
{
	$('#errorChickCookie').html('您瀏覽器的 cookie 功能被禁用,請啟用此功能!');
	$('.buycar').hide();
}
</script>
</body>
</html>