0) { $no = $i + 1; } $ca_id = $it["ca_id$no"]; $sql = " select ca_nocoupon from {$g4['yc4_category_table']} where ca_id = '$ca_id' "; $row = sql_fetch($sql); if($row['ca_nocoupon']) { alert_close('쿠폰사용이 제한된 카테고리에 속한 상품입니다.'); } } // 장바구니정보 $uq_id = get_session('ss_uniqid'); if($sw_direct != 1) $sw_direct = 0; $sql_common = " from ( select * from {$g4['yc4_cart_table']} where uq_id = '$uq_id' and it_id = '$it_id' and ct_direct = '$sw_direct' order by ct_id asc ) as a "; $sql = " select a.ct_id, a.ct_send_cost_pay, SUM((a.ct_amount + a.it_amount) * a.ct_qty) as item_amount, SUM(a.ct_qty) as item_qty $sql_common group by a.it_id "; $ct = sql_fetch($sql); // 상품총금액 if($ct['item_amount']) { $item_amount = $ct['item_amount']; } else { alert_close('상품의 주문금액이 0원입니다.'); } // 총주문금액 $sql = " select SUM((ct_amount + it_amount) * ct_qty) as total_amount from {$g4['yc4_cart_table']} where uq_id = '$uq_id' and ct_direct = '$sw_direct' "; $row = sql_fetch($sql); if($row['total_amount']) { $total_amount = $row['total_amount']; } else { alert_close('주문하신 상품이 없습니다.'); } // 배송비 계산 if ($default['de_send_cost_case'] == "없음" || $default['de_send_cost_case'] == "착불") $send_cost = 0; else if($default['de_send_cost_case'] == "상한") { // 배송비 상한 : 여러단계의 배송비 적용 가능 $send_cost_limit = explode(";", $default['de_send_cost_limit']); $send_cost_list = explode(";", $default['de_send_cost_list']); $send_cost = 0; for ($k=0; $k= $row['it_sc_condition']) { $send_cost += 0; } else { $send_cost += $row['it_sc_basic']; } } else if($row['it_sc_type'] == 2) { // 유료 $send_cost += $row['it_sc_basic']; } else if($row['it_sc_type'] == 3) { // 수량별부과 $qty = ceil($row['sum_qty'] / $row['it_sc_condition']); $send_cost += ($row['it_sc_basic'] * $qty); } else { $send_cost += 0; } } } } // 쿠폰정보 $sql = " select * from {$g4['yc4_coupon_table']} where cp_use = '1' and cp_type = '0' and cp_start <= '{$g4['time_ymd']}' and cp_end >= '{$g4['time_ymd']}' and ( it_id = '{$it['it_id']}' or cp_target = '2' ) and mb_id in ( '{$member['mb_id']}', '전체회원' ) and ca_id in ( '{$it['ca_id']}', '{$it['ca_id2']}', '{$it['ca_id3']}', '전체카테고리' ) order by cp_no asc "; $result = sql_query($sql); if(!mysql_num_rows($result)) { alert_close('쿠폰 정보가 존재하지 않습니다.'); } $coupon_list = '
  • 적용안함
  • '; $cnt = 0; for($i=0; $row=sql_fetch_array($result); $i++) { // 정액할인쿠폰에서 할인금액이 상품주문금액보다 크다면 if(!$row['cp_method'] && $row['cp_amount'] > $item_amount) { continue; } // 쿠폰사용내역체크 $sql = " select ch_no from {$g4['yc4_coupon_history_table']} where cp_id = '{$row['cp_id']}' and it_id = '$it_id' and mb_id = '{$member['mb_id']}' and uq_id <> '$uq_id' "; $ch = sql_fetch($sql); if($ch['ch_no']) { // 이미 사용한 쿠폰 continue; } else { $cnt++; } $cp_limit = $row['cp_limit']; if($row['cp_id'] == $coupon) { $checked = ' checked="checked"'; } else { $checked = ''; } $coupon_list .= '
  • '."\n"; $coupon_list .= ''."\n"; $coupon_list .= ''."\n"; $coupon_list .= ''."\n"; $coupon_list .= ''."\n"; $coupon_list .= ''."\n".$row['cp_subject']."\n"; $coupon_list .= '
  • '."\n"; } if(!$cnt) { alert_close('사용할 수 있는 쿠폰이 없습니다.'); } $g4['title'] = '쿠폰적용'; include_once ($g4['path'].'/head.sub.php'); ?>
    쿠폰선택
    상품금액 할인금액 최종결제금액
    0