#340 품절 상품 구매버튼 보이지 않도록 수정
This commit is contained in:
@ -405,6 +405,10 @@ function same_option_check(val)
|
||||
function price_calculate()
|
||||
{
|
||||
var it_price = parseInt($("input#it_price").val());
|
||||
|
||||
if(isNaN(it_price))
|
||||
return;
|
||||
|
||||
var $el_prc = $("input.io_price");
|
||||
var $el_qty = $("input[name^=ct_qty]");
|
||||
var $el_type = $("input[name^=io_type]");
|
||||
|
||||
@ -1389,8 +1389,7 @@ function item_icon($it)
|
||||
{
|
||||
$icon = '<span class="sit_icon">';
|
||||
// 품절
|
||||
$stock = get_it_stock_qty($it['it_id']);
|
||||
if ($stock <= 0)
|
||||
if (is_soldout($it['it_id']))
|
||||
$icon .= '<img src="'.G5_SHOP_URL.'/img/icon_soldout.gif" alt="품절"> ';
|
||||
|
||||
if ($it['it_type1'])
|
||||
@ -1768,6 +1767,73 @@ function is_used_coupon($mb_id, $cp_id)
|
||||
return $used;
|
||||
}
|
||||
|
||||
// 품절상품인지 체크
|
||||
function is_soldout($it_id)
|
||||
{
|
||||
global $g5;
|
||||
|
||||
// 상품정보
|
||||
$sql = " select it_stock_qty from {$g5['g5_shop_item_table']} where it_id = '$it_id' ";
|
||||
$it = sql_fetch($sql);
|
||||
|
||||
if($it['it_stock_qty'] <= 0)
|
||||
return true;
|
||||
|
||||
$count = 0;
|
||||
$soldout = false;
|
||||
|
||||
// 상품에 선택옵션 있으면..
|
||||
$sql = " select count(*) as cnt from {$g5['g5_shop_item_option_table']} where it_id = '$it_id' and io_type = '0' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if($row['cnt']) {
|
||||
$sql = " select io_id, io_type, io_stock_qty
|
||||
from {$g5['g5_shop_item_option_table']}
|
||||
where it_id = '$it_id'
|
||||
and io_type = '0'
|
||||
and io_use = '1' ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
// 주문대기수량
|
||||
$sql = " select SUM(ct_qty) as qty from {$g5['g5_shop_cart_table']}
|
||||
where it_id = '$it_id'
|
||||
and io_id = '{$row['io_id']}'
|
||||
and io_type = '{$row['io_type']}'
|
||||
and ct_stock_use = 0
|
||||
and ct_status in ('주문', '입금', '준비') ";
|
||||
$sum = sql_fetch($sql);
|
||||
|
||||
// 옵션 재고수량
|
||||
$stock_qty = get_option_stock_qty($it_id, $row['io_id'], $row['io_type']);
|
||||
|
||||
if($stock_qty - $sum['qty'] <= 0)
|
||||
$count++;
|
||||
}
|
||||
|
||||
// 모든 선택옵션 품절이면 상품 품절
|
||||
if($i == $count)
|
||||
$soldout = true;
|
||||
} else {
|
||||
// 주문대기수량
|
||||
$sql = " select SUM(ct_qty) as qty from {$g5['g5_shop_cart_table']}
|
||||
where it_id = '$it_id'
|
||||
and io_id = ''
|
||||
and io_type = '0'
|
||||
and ct_stock_use = 0
|
||||
and ct_status in ('주문', '입금', '준비') ";
|
||||
$sum = sql_fetch($sql);
|
||||
|
||||
// 상품 재고수량
|
||||
$stock_qty = get_it_stock_qty($it_id);
|
||||
|
||||
if($stock_qty - $sum['qty'] <= 0)
|
||||
$soldout = true;
|
||||
}
|
||||
|
||||
return $soldout;
|
||||
}
|
||||
|
||||
// 상품후기 작성가능한지 체크
|
||||
function check_itemuse_write($close=true)
|
||||
{
|
||||
|
||||
@ -106,12 +106,6 @@ if ($row['it_id']) {
|
||||
$next_href2 = '';
|
||||
}
|
||||
|
||||
// 선택 옵션
|
||||
$option_1 = get_item_options($it['it_id'], $it['it_option_subject']);
|
||||
|
||||
// 추가 옵션
|
||||
$option_2 = get_item_supply($it['it_id'], $it['it_supply_subject']);
|
||||
|
||||
// 관리자가 확인한 사용후기의 개수를 얻음
|
||||
$sql = " select count(*) as cnt from `{$g5['g5_shop_item_use_table']}` where it_id = '{$it_id}' and is_confirm = '1' ";
|
||||
$row = sql_fetch($sql);
|
||||
@ -130,6 +124,32 @@ $sql = " select count(*) as cnt
|
||||
$row = sql_fetch($sql);
|
||||
$item_relation_count = $row['cnt'];
|
||||
|
||||
// 상품품절체크
|
||||
$is_soldout = is_soldout($it['it_id']);
|
||||
|
||||
// 주문가능체크
|
||||
$is_orderable = true;
|
||||
if(!$it['it_use'] || $it['it_tel_inq'] || $is_soldout)
|
||||
$is_orderable = false;
|
||||
|
||||
if($is_orderable) {
|
||||
// 선택 옵션
|
||||
$option_1 = get_item_options($it['it_id'], $it['it_option_subject']);
|
||||
|
||||
// 추가 옵션
|
||||
$option_2 = get_item_supply($it['it_id'], $it['it_supply_subject']);
|
||||
|
||||
// 상품 선택옵션 수
|
||||
$sql = " select count(*) as cnt from {$g5['g5_shop_item_option_table']} where it_id = '{$it['it_id']}' and io_type = '0' and io_use = '1' ";
|
||||
$row = sql_fetch($sql);
|
||||
$opt_count = $row['cnt'];
|
||||
|
||||
// 상품 추가옵션 수
|
||||
$sql = " select count(*) as cnt from {$g5['g5_shop_item_option_table']} where it_id = '{$it['it_id']}' and io_type = '1' and io_use = '1' ";
|
||||
$row = sql_fetch($sql);
|
||||
$spl_count = $row['cnt'];
|
||||
}
|
||||
|
||||
$g5['title'] = $it['it_name'].' > '.$it['ca_name'];
|
||||
|
||||
include_once(G5_MSHOP_PATH.'/_head.php');
|
||||
@ -143,7 +163,9 @@ include G5_MSHOP_SKIN_PATH.'/navigation.skin.php';
|
||||
echo '<div id="sit_hhtml">'.stripslashes($it['it_mobile_head_html']).'</div>';
|
||||
?>
|
||||
|
||||
<?php if($is_orderable) { ?>
|
||||
<script src="<?php echo G5_JS_URL; ?>/shop.js"></script>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
if (G5_HTTPS_DOMAIN)
|
||||
|
||||
@ -85,23 +85,22 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
<td><?php echo $it['it_brand']; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($it['it_model']) { ?>
|
||||
<tr>
|
||||
<th scope="row">모델</th>
|
||||
<td><?php echo $it['it_model']; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($it['it_tel_inq']) { // 전화문의일 경우 ?>
|
||||
|
||||
<?php if (!$it['it_use']) { // 판매가능이 아닐 경우 ?>
|
||||
<tr>
|
||||
<th scope="row">판매가격</th>
|
||||
<td>판매중지</td>
|
||||
</tr>
|
||||
<?php } else if ($it['it_tel_inq']) { // 전화문의일 경우 ?>
|
||||
<tr>
|
||||
<th scope="row">판매가격</th>
|
||||
<td>전화문의</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php } else { // 전화문의가 아닐 경우?>
|
||||
<?php if ($it['it_cust_price']) { // 1.00.03?>
|
||||
<tr>
|
||||
@ -117,6 +116,7 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
<input type="hidden" id="it_price" value="<?php echo get_price($it); ?>">
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
/* 재고 표시하는 경우 주석 해제
|
||||
@ -223,9 +223,7 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
}
|
||||
?>
|
||||
|
||||
<?php } // 전화문의가 아닐 경우 끝?>
|
||||
|
||||
<?php if ($it['it_use'] && !$it['it_tel_inq']) { ?>
|
||||
<?php if ($it['it_use'] && !$it['it_tel_inq'] && !$is_soldout) { ?>
|
||||
<div id="sit_sel_option">
|
||||
<?php
|
||||
if(!$option_1) {
|
||||
@ -259,8 +257,12 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
<div id="sit_tot_price"></div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($is_soldout) { ?>
|
||||
<p>상품의 재고가 부족하여 구매할 수 없습니다.</p>
|
||||
<?php } ?>
|
||||
|
||||
<ul id="sit_ov_btn">
|
||||
<?php if (!$it['it_tel_inq']) { ?>
|
||||
<?php if ($is_orderable) { ?>
|
||||
<li><input type="submit" onclick="document.pressed=this.value;" value="바로구매" id="sit_btn_buy"></li>
|
||||
<li><input type="submit" onclick="document.pressed=this.value;" value="장바구니" id="sit_btn_cart"></li>
|
||||
<?php } ?>
|
||||
|
||||
@ -129,12 +129,6 @@ if ($row['it_id']) {
|
||||
// 고객선호도 별점수
|
||||
$star_score = get_star_image($it['it_id']);
|
||||
|
||||
// 선택 옵션
|
||||
$option_1 = get_item_options($it['it_id'], $it['it_option_subject']);
|
||||
|
||||
// 추가 옵션
|
||||
$option_2 = get_item_supply($it['it_id'], $it['it_supply_subject']);
|
||||
|
||||
// 관리자가 확인한 사용후기의 개수를 얻음
|
||||
$sql = " select count(*) as cnt from `{$g5['g5_shop_item_use_table']}` where it_id = '{$it_id}' and is_confirm = '1' ";
|
||||
$row = sql_fetch($sql);
|
||||
@ -157,6 +151,32 @@ $sns_share_links .= get_sns_share_link('facebook', $sns_url, $sns_title, G5_SHOP
|
||||
$sns_share_links .= get_sns_share_link('twitter', $sns_url, $sns_title, G5_SHOP_SKIN_URL.'/img/sns_twt2.png').' ';
|
||||
$sns_share_links .= get_sns_share_link('googleplus', $sns_url, $sns_title, G5_SHOP_SKIN_URL.'/img/sns_goo2.png');
|
||||
|
||||
// 상품품절체크
|
||||
$is_soldout = is_soldout($it['it_id']);
|
||||
|
||||
// 주문가능체크
|
||||
$is_orderable = true;
|
||||
if(!$it['it_use'] || $it['it_tel_inq'] || $is_soldout)
|
||||
$is_orderable = false;
|
||||
|
||||
if($is_orderable) {
|
||||
// 선택 옵션
|
||||
$option_1 = get_item_options($it['it_id'], $it['it_option_subject']);
|
||||
|
||||
// 추가 옵션
|
||||
$option_2 = get_item_supply($it['it_id'], $it['it_supply_subject']);
|
||||
|
||||
// 상품 선택옵션 수
|
||||
$sql = " select count(*) as cnt from {$g5['g5_shop_item_option_table']} where it_id = '{$it['it_id']}' and io_type = '0' and io_use = '1' ";
|
||||
$row = sql_fetch($sql);
|
||||
$opt_count = $row['cnt'];
|
||||
|
||||
// 상품 추가옵션 수
|
||||
$sql = " select count(*) as cnt from {$g5['g5_shop_item_option_table']} where it_id = '{$it['it_id']}' and io_type = '1' and io_use = '1' ";
|
||||
$row = sql_fetch($sql);
|
||||
$spl_count = $row['cnt'];
|
||||
}
|
||||
|
||||
function pg_anchor($anc_id) {
|
||||
global $default;
|
||||
global $item_use_count, $item_qa_count, $item_relation_count;
|
||||
@ -173,7 +193,9 @@ function pg_anchor($anc_id) {
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if($is_orderable) { ?>
|
||||
<script src="<?php echo G5_JS_URL; ?>/shop.js"></script>
|
||||
<?php } ?>
|
||||
|
||||
<div id="sit">
|
||||
|
||||
|
||||
@ -62,9 +62,11 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
<section id="sit_ov">
|
||||
<h2 id="sit_title"><?php echo stripslashes($it['it_name']); ?> 요약정보 및 구매</h2>
|
||||
<p id="sit_desc"><?php echo $it['it_basic']; ?></p>
|
||||
<?php if($is_orderable) { ?>
|
||||
<p id="sit_opt_info">
|
||||
상품 선택옵션 <?php echo $opt_count; ?> 개, 추가옵션 <?php echo $spl_count; ?> 개
|
||||
</p>
|
||||
<?php } ?>
|
||||
<?php if ($star_score) { ?>
|
||||
<div id="sit_star_sns">
|
||||
고객평점 <span>별<?php echo $star_score?>개</span>
|
||||
@ -111,144 +113,138 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
<th scope="row">판매가격</th>
|
||||
<td>판매중지</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } else if ($it['it_tel_inq']) { // 전화문의일 경우 ?>
|
||||
<tr>
|
||||
<th scope="row">판매가격</th>
|
||||
<td>전화문의</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } else { // 전화문의가 아닐 경우?>
|
||||
<?php if ($it['it_cust_price']) { ?>
|
||||
<tr>
|
||||
<th scope="row">시중가격</th>
|
||||
<td><?php echo display_price($it['it_cust_price']); ?></td>
|
||||
</tr>
|
||||
<?php } // 시중가격 끝 ?>
|
||||
|
||||
<?php if ($it['it_cust_price']) { ?>
|
||||
<tr>
|
||||
<th scope="row">시중가격</th>
|
||||
<td><?php echo display_price($it['it_cust_price']); ?></td>
|
||||
</tr>
|
||||
<?php } // 시중가격 끝 ?>
|
||||
<tr>
|
||||
<th scope="row">판매가격</th>
|
||||
<td>
|
||||
<?php echo number_format(get_price($it)); ?> 원
|
||||
<input type="hidden" id="it_price" value="<?php echo get_price($it); ?>">
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<tr>
|
||||
<th scope="row">판매가격</th>
|
||||
<td>
|
||||
<?php echo number_format(get_price($it)); ?> 원
|
||||
<input type="hidden" id="it_price" value="<?php echo get_price($it); ?>">
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
/* 재고 표시하는 경우 주석 해제
|
||||
<tr>
|
||||
<th scope="row">재고수량</th>
|
||||
<td><?php echo number_format(get_it_stock_qty($it_id)); ?> 개</td>
|
||||
</tr>
|
||||
*/
|
||||
?>
|
||||
|
||||
<?php
|
||||
/* 재고 표시하는 경우 주석 해제
|
||||
<tr>
|
||||
<th scope="row">재고수량</th>
|
||||
<td><?php echo number_format(get_it_stock_qty($it_id)); ?> 개</td>
|
||||
</tr>
|
||||
*/
|
||||
?>
|
||||
<?php if ($config['cf_use_point']) { // 포인트 사용한다면 ?>
|
||||
<tr>
|
||||
<th scope="row">포인트</th>
|
||||
<td>
|
||||
<?php
|
||||
$it_point = get_item_point($it);
|
||||
echo number_format($it_point);
|
||||
?> 점
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php
|
||||
$ct_send_cost_label = '배송비결제';
|
||||
|
||||
<?php if ($config['cf_use_point']) { // 포인트 사용한다면 ?>
|
||||
<tr>
|
||||
<th scope="row">포인트</th>
|
||||
<td>
|
||||
<?php
|
||||
$it_point = get_item_point($it);
|
||||
echo number_format($it_point);
|
||||
?> 점
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php
|
||||
$ct_send_cost_label = '배송비결제';
|
||||
if($default['de_send_cost_case'] == '무료')
|
||||
$sc_method = '무료배송';
|
||||
else
|
||||
$sc_method = '주문시 결제';
|
||||
|
||||
if($default['de_send_cost_case'] == '무료')
|
||||
$sc_method = '무료배송';
|
||||
if($it['it_sc_type'] == 1)
|
||||
$sc_method = '무료배송';
|
||||
else if($it['it_sc_type'] > 1) {
|
||||
if($it['it_sc_method'] == 1)
|
||||
$sc_method = '수령후 지불';
|
||||
else if($it['it_sc_method'] == 2) {
|
||||
$ct_send_cost_label = '<label for="ct_send_cost">배송비결제</label>';
|
||||
$sc_method = '<select name="ct_send_cost" id="ct_send_cost">
|
||||
<option value="0">주문시 결제</option>
|
||||
<option value="1">수령후 지불</option>
|
||||
</select>';
|
||||
}
|
||||
else
|
||||
$sc_method = '주문시 결제';
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<th><?php echo $ct_send_cost_label; ?></th>
|
||||
<td><?php echo $sc_method; ?></td>
|
||||
</tr>
|
||||
<?php if($it['it_buy_min_qty']) { ?>
|
||||
<tr>
|
||||
<th>최소구매수량</th>
|
||||
<td><?php echo number_format($it['it_buy_min_qty']); ?> 개<td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php if($it['it_buy_max_qty']) { ?>
|
||||
<tr>
|
||||
<th>최대구매수량</th>
|
||||
<td><?php echo number_format($it['it_buy_max_qty']); ?> 개<td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
if($it['it_sc_type'] == 1)
|
||||
$sc_method = '무료배송';
|
||||
else if($it['it_sc_type'] > 1) {
|
||||
if($it['it_sc_method'] == 1)
|
||||
$sc_method = '수령후 지불';
|
||||
else if($it['it_sc_method'] == 2) {
|
||||
$ct_send_cost_label = '<label for="ct_send_cost">배송비결제</label>';
|
||||
$sc_method = '<select name="ct_send_cost" id="ct_send_cost">
|
||||
<option value="0">주문시 결제</option>
|
||||
<option value="1">수령후 지불</option>
|
||||
</select>';
|
||||
}
|
||||
else
|
||||
$sc_method = '주문시 결제';
|
||||
}
|
||||
<?php
|
||||
if($option_1) {
|
||||
?>
|
||||
<!-- 선택옵션 시작 { -->
|
||||
<section>
|
||||
<h3>선택옵션</h3>
|
||||
<table class="sit_ov_tbl">
|
||||
<colgroup>
|
||||
<col class="grid_3">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<?php // 선택옵션
|
||||
echo $option_1;
|
||||
?>
|
||||
<tr>
|
||||
<th><?php echo $ct_send_cost_label; ?></th>
|
||||
<td><?php echo $sc_method; ?></td>
|
||||
</tr>
|
||||
<?php if($it['it_buy_min_qty']) { ?>
|
||||
<tr>
|
||||
<th>최소구매수량</th>
|
||||
<td><?php echo number_format($it['it_buy_min_qty']); ?> 개<td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php if($it['it_buy_max_qty']) { ?>
|
||||
<tr>
|
||||
<th>최대구매수량</th>
|
||||
<td><?php echo number_format($it['it_buy_max_qty']); ?> 개<td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<!-- } 선택옵션 끝 -->
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if($option_1) {
|
||||
?>
|
||||
<!-- 선택옵션 시작 { -->
|
||||
<section>
|
||||
<h3>선택옵션</h3>
|
||||
<table class="sit_ov_tbl">
|
||||
<colgroup>
|
||||
<col class="grid_3">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<?php // 선택옵션
|
||||
echo $option_1;
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<!-- } 선택옵션 끝 -->
|
||||
<?php
|
||||
}
|
||||
<?php
|
||||
if($option_2) {
|
||||
?>
|
||||
<!-- 추가옵션 시작 { -->
|
||||
<section>
|
||||
<h3>추가옵션</h3>
|
||||
<table class="sit_ov_tbl">
|
||||
<colgroup>
|
||||
<col class="grid_3">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<?php // 추가옵션
|
||||
echo $option_2;
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<!-- } 추가옵션 끝 -->
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if($option_2) {
|
||||
?>
|
||||
<!-- 추가옵션 시작 { -->
|
||||
<section>
|
||||
<h3>추가옵션</h3>
|
||||
<table class="sit_ov_tbl">
|
||||
<colgroup>
|
||||
<col class="grid_3">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<?php // 추가옵션
|
||||
echo $option_2;
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<!-- } 추가옵션 끝 -->
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php } // 전화문의가 아닐 경우 끝 ?>
|
||||
|
||||
<?php if ($it['it_use'] && !$it['it_tel_inq']) { ?>
|
||||
<?php if ($is_orderable) { ?>
|
||||
<!-- 선택된 옵션 시작 { -->
|
||||
<section id="sit_sel_option">
|
||||
<h3>선택된 옵션</h3>
|
||||
@ -286,8 +282,12 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
<div id="sit_tot_price"></div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($is_soldout) { ?>
|
||||
<p>상품의 재고가 부족하여 구매할 수 없습니다.</p>
|
||||
<?php } ?>
|
||||
|
||||
<ul id="sit_ov_btn">
|
||||
<?php if (!$it['it_tel_inq']) { ?>
|
||||
<?php if ($is_orderable) { ?>
|
||||
<li><input type="submit" onclick="document.pressed=this.value;" value="바로구매" id="sit_btn_buy"></li>
|
||||
<li><input type="submit" onclick="document.pressed=this.value;" value="장바구니" id="sit_btn_cart"></li>
|
||||
<?php } ?>
|
||||
|
||||
Reference in New Issue
Block a user