primeidc/module/shop/cart.php
2021-10-26 18:26:49 +09:00

144 lines
6.6 KiB
PHP

<?
//DB연결
$dblink = SetConn($_conf_db["main_db"]);
//회원의 경우 회원아이디로 로그인 전이라면 세션 아이디로
if($_SESSION[$_SITE["DOMAIN"]]["MEMBER"]["ID"]){
$tp = "1";
}else{
$tp = "2";
}
$arrList = getCartList($_SESSION[$_SITE["DOMAIN"]]["SESSIONID"], $_SESSION[$_SITE["DOMAIN"]]["MEMBER"]["ID"],$tp);
//_DEBUG($arrList);
//DB해제
SetDisConn($dblink);
?>
<div class="contain">
<div id="contentArea">
<div class="real-cont">
<!-- //장바구니 -->
<div class="order-step step1">
<h2><img src="../images/shop/order_step_tit1.png" alt="장바구니"></h2>
</div>
<div class="order-info">
<ol>
<li>1. 장바구니에 담긴 상품은 로그 오프 시 <em>자동 삭제</em> 됩니다.</li>
<li>2. 품절 및 판매중지된 상품은 장바구니 목록에서 자동으로 <em>삭제</em>됩니다.</li>
</ol>
</div>
<div class="shop-table">
<form id="frmCartList" name="frmCartList" method="POST">
<input type="hidden" name="evnMode">
<table>
<colgroup>
<col width="50">
<col width="*" >
<col width="100">
<col width="80">
<col width="80">
<col width="100">
<col width="80">
</colgroup>
<thead>
<tr>
<th scope="col"><input type="checkbox" onclick="checkboxCheckAll(this.status);"></th>
<th scope="col">상품명</th>
<th scope="col">판매가</th>
<th scope="col">수량</th>
<th scope="col">배송비</th>
<th scope="col">합계/추가금</th>
<th scope="col">관리</th>
</tr>
</thead>
<tbody>
<?
if($arrList["total"]>0){
for($i=0;$i<$arrList["total"];$i++){
$arrOpt1[$i] = explode("|",$arrList["list"][$i][opt_1]);
$arrOpt2[$i] = explode("|",$arrList["list"][$i][opt_2]);
$arrOpt3[$i] = explode("|",$arrList["list"][$i][opt_3]);
$arrOpt4[$i] = explode("|",$arrList["list"][$i][opt_4]);
$arrOpt5[$i] = explode("|",$arrList["list"][$i][opt_5]);
$arrOptRel1[$i] = explode("|",$arrList["list"][$i][opt_rel_1]);
//추가금액 계산
$optionPrice = $arrOpt1[$i][1] + $arrOpt2[$i][1] + $arrOpt3[$i][1] + $arrOpt4[$i][1] + $arrOpt5[$i][1];
//적립금계산
if($arrList["list"][$i][point_unit]=="P"){
$thisPoint = (($arrList["list"][$i][point]*($arrList["list"][$i][price]+$optionPrice))/100) * $arrList["list"][$i][qty];
}else{
$thisPoint = $arrList["list"][$i][point] * $arrList["list"][$i][qty];
}
//합계금액 계산
$totalPrice += ($arrList["list"][$i][price]*$arrList["list"][$i][qty])+($optionPrice * $arrList["list"][$i][qty]);
?>
<tr>
<td><input type="checkbox" id="items[]" name="items[]" value="<?=$arrList["list"][$i][c_idx]?>" checked="checked"></td>
<td class="space-left">
<div class="prod-info">
<div class="img"><a href="<?=$_SERVER[PHP_SELF]?>?goPage=GoodDetail&g_code=<?=$arrList["list"][$i][g_code]?>"><img src="/uploaded/shop_good/<?=$arrList["list"][$i][idx]?>/<?=$arrList["list"][$i][image_s]?>" width="70" height="70" alt="" class="" /></a></div>
<div class="info">
<div class="tit"><a href="<?=$_SERVER[PHP_SELF]?>?goPage=GoodDetail&idx=<?=$arrList["list"][$i][idx]?>"><?=stripslashes($arrList["list"][$i][g_name])?></a></div>
<div class="opt"><?=$arrOpt1[$i][0]?"| ".$arrOpt1[$i][0]:""?><?=$arrOpt1[$i][1]?" +".number_format($arrOpt1[$i][1]):""?>
<?=$arrOpt2[$i][0]?"| ".$arrOpt2[$i][0]:""?><?=$arrOpt2[$i][1]?" +".number_format($arrOpt2[$i][1]):""?>
<?=$arrOpt3[$i][0]?"| ".$arrOpt3[$i][0]:""?><?=$arrOpt3[$i][1]?" +".number_format($arrOpt3[$i][1]):""?>
<?=$arrOpt4[$i][0]?"| ".$arrOpt4[$i][0]:""?><?=$arrOpt4[$i][1]?" +".number_format($arrOpt4[$i][1]):""?>
<?=$arrOpt5[$i][0]?"| ".$arrOpt5[$i][0]:""?><?=$arrOpt5[$i][1]?" +".number_format($arrOpt5[$i][1]):""?></div>
</div>
</div>
</td>
<td><?=number_format($arrList["list"][$i][price]+$optionPrice)?>원</td>
<!-- <td><?=number_format($thisPoint)?></td> -->
<td><input type="text" style="width:20px;" name="qty_<?=$i?>" value="<?=$arrList["list"][$i][qty]?>" class="input"/></td>
<td><?=number_format($arrOptRel1[$i][0])?>원</td>
<td class="prd_price"><?=number_format(($arrList["list"][$i][price]*$arrList["list"][$i][qty])+($optionPrice * $arrList["list"][$i][qty]))?>원</td>
<td class="prd_edit">
<p><a href="javascript:updateCart('<?=$arrList["list"][$i][c_idx]?>',frmCartList.qty_<?=$i?>.value);"><img src="/images/shop/bt_edit.gif" alt="수정하기" /></a></p>
<p><a href="javascript:deleteCart('<?=$arrList["list"][$i][c_idx]?>');"><img src="/images/shop/bt_del.gif" alt="삭제하기" /></a></p>
</td>
</tr>
<?
}
//배송비 계산
if($totalPrice < $_SITE["SHOP"]["SHIP"]["FREE_PRICE"]){
$shipPrice = $_SITE["SHOP"]["SHIP"]["SHIP_PRICE"];
}else{
$shipPrice = 0;
}
}else{
?>
<tr height="100">
<td colspan="9" align="center">장바구니가 비었습니다.</td>
</tr>
<?}?>
</tbody>
</table>
<div class="total-price">
<!--※ 총 구매비용 합계가 <strong><?=number_format($_SITE["SHOP"]["SHIP"]["FREE_PRICE"])?>원</strong> 이상 구매시 배송비는 무료입니다.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-->
[상품금액] <strong><?=number_format($totalPrice)?>원</strong> + [배송비] <strong><?=number_format($shipPrice)?>원</strong> = [총구매액] <strong><?=number_format($totalPrice+$shipPrice)?>원</strong></div>
<div class="buttons">
<div class="fr">
<a href="/shop.php?goPage=GoodList&cat_no=1" class="btn-pack xlarge">쇼핑 계속하기</a>
<a href="javascript:orderCartChecked(document.frmCartList);" class="btn-pack xlarge dark">선택상품 주문</a>
<a href="javascript:orderCartAll(document.frmCartList);" class="btn-pack xlarge focus">전체 주문하기</a>
<!-- <span class="btn_set"><a href="/shop.php?goPage=GoodList&cat_no=1"><img src="../images/shop/btn_shopping.gif" alt="쇼핑 계속하기" /></a></span>
<span class="btn_set"><a href="javascript:deleteCartChecked(document.frmCartList);"><img src="../images/shop/btn_cart_del.gif" alt="선택상품 삭제" /></a></span>
<span class="btn_set"><a href="javascript:orderCartChecked(document.frmCartList);"><img src="../images/shop/btn_select_order.gif" alt="선택상품 주문" /></a></span>
<span class="btn_set"><a href="javascript:orderCartAll(document.frmCartList);"><img src="../images/shop/btn_all_order.gif" alt="전체 주문하기" /></a></span> -->
</div>
</div>
</form>
</div>
</div>
</div>
</div>