diff --git a/lib/shop.lib.php b/lib/shop.lib.php index 366f6e97e..f4e8ff25e 100644 --- a/lib/shop.lib.php +++ b/lib/shop.lib.php @@ -1161,6 +1161,20 @@ function array_add_callback($func, $array) return $array; } + +// 상품포인트 +function get_item_point($it) +{ + $it_point = 0; + + if($it['it_point_type']) { + $it_point = floor(($it['it_price'] * ($it['it_point'] / 100) / 10)) * 10; + } else { + $it_point = $it['it_point']; + } + + return $it_point; +} //============================================================================== // 쇼핑몰 함수 모음 끝 //============================================================================== diff --git a/mobile/shop/cart.php b/mobile/shop/cart.php index 8e248075c..1923a2a89 100644 --- a/mobile/shop/cart.php +++ b/mobile/shop/cart.php @@ -3,18 +3,257 @@ include_once('./_common.php'); $g4['title'] = '장바구니'; include_once(G4_MSHOP_PATH.'/_head.php'); +$s_uq_id = get_session('ss_uq_id'); ?> + +
+
+ + + + + + + + + + + + + '$ctime' "; + } + $sql .= " order by a.ct_id "; + $result = sql_query($sql); + + $good_info = ''; + + for ($i=0; $row=mysql_fetch_array($result); $i++) + { + // 합계금액 계산 + $sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price, + SUM(ct_point * ct_qty) as point, + SUM(ct_qty) as qty + from {$g4['shop_cart_table']} + where it_id = '{$row['it_id']}' + and uq_id = '$s_uq_id' "; + $sum = sql_fetch($sql); + + if ($i==0) { // 계속쇼핑 + $continue_ca_id = $row['ca_id']; + } + + $a1 = ''; + $a2 = ''; + $image = get_it_image($row['it_id'], 70, 70); + + $it_name = $a1 . stripslashes($row['it_name']) . $a2; + $it_options = print_item_options($row['it_id'], $s_uq_id); + if($it_options) { + $mod_options = '
'; + $it_name .= '
'.$it_options.'
'; + } + + $point = $sum['point']; + $sell_amount = $sum['price']; ?> + + + + + + + + + + + + '; + } else { + // 배송비 계산 + if ($default['de_send_cost_case'] == '없음') + $send_cost = 0; + else { + // 배송비 상한 : 여러단계의 배송비 적용 가능 + $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 + +
상품이미지상품명총수량판매가소계포인트
+ + + +
장바구니에 담긴 상품이 없습니다.
+ + 0) + { + ?> + +
+ 배송비 + +
+ + + + 0) { + ?> + +
+ 총계 + +
+ + + +
+ + 쇼핑 계속하기 + + + + +

장바구니의 상품을 주문하시려면 주문하기를 클릭하세요. 비우기는 장바구니의 상품을 모두 비웁니다.

+ 쇼핑 계속하기 + 주문하기 + 선택삭제 + 비우기 + +
+ +
+
+ + \ No newline at end of file diff --git a/mobile/shop/item.php b/mobile/shop/item.php index 3b38ac2e5..52e80e3eb 100644 --- a/mobile/shop/item.php +++ b/mobile/shop/item.php @@ -334,12 +334,7 @@ else diff --git a/mobile/shop/orderform.php b/mobile/shop/orderform.php index aba6ed038..554be528b 100644 --- a/mobile/shop/orderform.php +++ b/mobile/shop/orderform.php @@ -13,9 +13,6 @@ else { if (get_cart_count($tmp_uq_id) == 0) alert('장바구니가 비어 있습니다.', G4_SHOP_URL.'/cart.php'); -// 포인트 결제 대기 필드 추가 -//sql_query(" ALTER TABLE `$g4[shop_order_table]` ADD `od_temp_point` INT NOT NULL AFTER `od_temp_card` ", false); - $g4['title'] = '주문서 작성'; include_once(G4_MSHOP_PATH.'/_head.php'); @@ -24,35 +21,214 @@ include_once(G4_MSHOP_PATH.'/_head.php'); $od_id = get_uniqid(); set_session('ss_order_uniqid', $od_id); +$s_uq_id = $tmp_uq_id; +$order_action_url = G4_HTTPS_MSHOP_URL.'/orderformupdate.php'; +if (file_exists('./settle_'.$default['de_card_pg'].'.inc.php')) { + include './settle_'.$default['de_card_pg'].'.inc.php'; +} + // 결제등록 요청시 사용할 입금마감일 $ipgm_date = date("Ymd", (G4_SERVER_TIME + 86400 * 5)); $tablet_size = "1.0"; // 화면 사이즈 조정 - 기기화면에 맞게 수정(갤럭시탭,아이패드 - 1.85, 스마트폰 - 1.0) ?> -
+
+ +

주문하실 상품을 확인하세요.

+ + + + + + + + + + + + + + + '$ctime' "; + } + $sql .= " order by a.ct_id "; + $result = sql_query($sql); + + $good_info = ''; + + for ($i=0; $row=mysql_fetch_array($result); $i++) + { + // 합계금액 계산 + $sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price, + SUM(ct_point * ct_qty) as point, + SUM(ct_qty) as qty + from {$g4['shop_cart_table']} + where it_id = '{$row['it_id']}' + and uq_id = '$s_uq_id' "; + $sum = sql_fetch($sql); + + if (!$goods) + { + //$goods = addslashes($row[it_name]); + //$goods = get_text($row[it_name]); + $goods = preg_replace("/\'|\"|\||\,|\&|\;/", "", $row['it_name']); + $goods_it_id = $row['it_id']; + } + $goods_count++; + + // 에스크로 상품정보 + if($default['de_escrow_use']) { + if ($i>0) + $good_info .= chr(30); + $good_info .= "seq=".($i+1).chr(31); + $good_info .= "ordr_numb={$od_id}_".sprintf("%04d", $i).chr(31); + $good_info .= "good_name=".addslashes($row['it_name']).chr(31); + $good_info .= "good_cntx=".$row['ct_qty'].chr(31); + $good_info .= "good_amtx=".$row['ct_price'].chr(31); + } + + $a1 = ''; + $a2 = ''; + $image = get_it_image($row['it_id'], 50, 50); + + $it_name = $a1 . stripslashes($row['it_name']) . $a2; + $it_options = print_item_options($row['it_id'], $s_uq_id); + if($it_options) { + $it_name .= '
'.$it_options.'
'; + } + + $point = $sum['point']; + $sell_amount = $sum['price']; + + // 쿠폰 + if($is_member) { + $cp_button = ''; + + $sql = " select count(*) as cnt + from {$g4['shop_coupon_table']} + where mb_id = '{$member['mb_id']}' + and cp_used = '0' + and cp_start <= '".G4_TIME_YMD."' + and cp_end >= '".G4_TIME_YMD."' + and ( + ( cp_method = '0' and cp_target = '{$row['it_id']}' ) + OR + ( cp_method = '1' and ( cp_target IN ( '{$row['ca_id']}', '{$row['ca_id2']}', '{$row['ca_id3']}' ) ) ) + ) "; + $cp = sql_fetch($sql); + + if($cp['cnt']) + $cp_button = ''; + } + ?> + + + + + + + + + + 주문하실 상품을 확인하세요.

'; - include_once(G4_MSHOP_PATH.'/cartsub.inc.php'); - - if (file_exists(G4_MSHOP_PATH.'/settle_'.$default['de_card_pg'].'.inc.php')) { - include G4_MSHOP_PATH.'/settle_'.$default['de_card_pg'].'.inc.php'; + if ($i == 0) { + echo ''; + } else { + // 배송비 계산 + if ($default['de_send_cost_case'] == '없음') + $send_cost = 0; + else { + // 배송비 상한 : 여러단계의 배송비 적용 가능 + $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 + +
상품이미지상품명총수량판매가쿠폰소계포인트
+ + + + + + +
장바구니에 담긴 상품이 없습니다.
+ + + + 0) + { + ?> + +
+ 배송비 + +
+ + + + 0) { + ?> + +
+ 총계 + +
+ + +
- + @@ -108,10 +284,16 @@ $tablet_size = "1.0"; // 화면 사이즈 조정 - 기기화면에 맞게 수정 */ -->
+
+
+ + + +

주문하시는 분

@@ -240,9 +422,64 @@ $tablet_size = "1.0"; // 화면 사이즈 조정 - 기기화면에 맞게 수정
+ = '".G4_TIME_YMD."' + and cp_used = '0' "; + $row = sql_fetch($sql); + $oc_cnt = $row['cnt']; + + if($send_cost > 0) { + // 배송비쿠폰 + $sql = " select count(*) as cnt + from {$g4['shop_coupon_table']} + where mb_id = '{$member['mb_id']}' + and cp_method = '3' + and cp_start <= '".G4_TIM_YMD."' + and cp_end >= '".G4_TIME_YMD."' + and cp_used = '0' "; + $row = sql_fetch($sql); + $sc_cnt = $row['cnt']; + } + } + ?> +

결제정보 입력

+ + + 0) { ?> + + + + + + 0) { ?> + + + + + + + + + + +
결제할인쿠폰 + + +
배송비할인쿠폰 + + +
총 주문금액
+ 결제포인트 : 점 (100점 단위로 입력하세요.)
'; - echo '
회원님의 보유포인트('.display_point($member['mb_mileage']).')중 '.display_point($temp_point).'(주문금액 '.$default['de_point_per'].'%) 내에서 결제가 가능합니다.
'; + echo '
회원님의 보유포인트('.display_point($member['mb_mileage']).')중 '.display_point($temp_point).'(주문금액 '.$default['de_point_per'].'%) 내에서 결제가 가능합니다.
'; $multi_settle++; } } @@ -358,8 +595,8 @@ $tablet_size = "1.0"; // 화면 사이즈 조정 - 기기화면에 맞게 수정 if ($temp_point > $member_point) $temp_point = $member_point; - echo '
결제포인트 : 점 (100점 단위로 입력하세요.)
'; - echo '
회원님의 보유포인트('.display_point($member['mb_point']).')중 '.display_point($temp_point).'(주문금액 '.$default['de_point_per'].'%) 내에서 결제가 가능합니다.
'; + echo '
결제포인트 : 점 (100점 단위로 입력하세요.)
'; + echo '
회원님의 보유포인트('.display_point($member['mb_point']).')중 '.display_point($temp_point).'(주문금액 '.$default['de_point_per'].'%) 내에서 결제가 가능합니다.
'; $multi_settle++; } } @@ -459,6 +696,279 @@ $tablet_size = "1.0"; // 화면 사이즈 조정 - 기기화면에 맞게 수정
= '".G4_TIME_YMD."' + and cp_used = '0' + and cp_method IN ( 0, 1 ) "; + $cp = sql_fetch($sql); + if(!$cp['cp_id']) + continue; + + // 분류할인인지 + if($cp['cp_method']) { + $sql2 = " select it_id, ca_id, ca_id2, ca_id3 + from {$g4['shop_item_table']} + where it_id = '$it_id' "; + $row2 = sql_fetch($sql2); + + if(!$row2['it_id']) + continue; + + if($row2['ca_id'] != $cp['cp_target'] && $row2['ca_id2'] != $cp['cp_target'] && $row2['ca_id3'] != $cp['cp_target']) + continue; + } else { + if($cp['cp_target'] != $it_id) + continue; + } + + // 상품금액 + $sql = " select SUM( IF(io_type = '1', io_price * ct_qty, (ct_price + io_price) * ct_qty)) as sum_price + from {$g4['shop_cart_table']} + where uq_id = '$tmp_uq_id' + and it_id = '$it_id' "; + $ct = sql_fetch($sql); + $item_price = $ct['sum_price']; + + if($cp['cp_minimum'] > $item_price) + continue; + + $dc = 0; + if($cp['cp_type']) { + $dc = floor(($item_price * ($cp['cp_amount'] / 100)) / $cp['cp_trunc']) * $cp['cp_trunc']; + } else { + $dc = $cp['cp_amount']; + } + + if($cp['cp_maximum'] && $dc > $cp['cp_maximum']) + $dc = $cp['cp_maximum']; + + $tot_it_cp_amount += $dc; + $arr_it_cp_amt[$it_id] = $dc; + } + + $tot_od_amount = $tot_ct_amount - $tot_it_cp_amount; + + // 주문쿠폰 + if($_POST['od_cp_id']) { + $sql = " select cp_id, cp_type, cp_amount, cp_trunc, cp_minimum, cp_maximum + from {$g4['shop_coupon_table']} + where cp_id = '{$_POST['od_cp_id']}' + and mb_id = '{$member['mb_id']}' + and cp_start <= '".G4_TIME_YMD."' + and cp_end >= '".G4_TIME_YMD."' + and cp_used = '0' + and cp_method = '2' "; + $cp = sql_fetch($sql); + + $dc = 0; + if($cp['cp_id'] && ($cp['cp_minimum'] <= $tot_od_amount)) { + if($cp['cp_type']) { + $dc = floor(($tot_od_amount * ($cp['cp_amount'] / 100)) / $cp['cp_trunc']) * $cp['cp_trunc']; + } else { + $dc = $cp['cp_amount']; + } + + if($cp['cp_maximum'] && $dc > $cp['cp_maximum']) + $dc = $cp['cp_maximum']; + + $tot_od_cp_amount = $dc; + $tot_od_amount -= $tot_od_cp_amount; + } + } + + $tot_cp_amount = $tot_it_cp_amount + $tot_od_cp_amount; +} + +if ((int)($row['od_amount'] - $tot_cp_amount) !== $i_amount) { die("Error."); } @@ -85,7 +188,41 @@ if ($default['de_send_cost_case'] == "없음") { } } } -if ((int)$send_cost !== $i_send_cost) { + +$tot_sc_cp_amount = 0; +if($is_member && $send_cost > 0) { + // 배송쿠폰 + if($_POST['sc_cp_id']) { + $sql = " select cp_id, cp_type, cp_amount, cp_trunc, cp_minimum, cp_maximum + from {$g4['shop_coupon_table']} + where cp_id = '{$_POST['sc_cp_id']}' + and mb_id = '{$member['mb_id']}' + and cp_start <= '".G4_TIME_YMD."' + and cp_end >= '".G4_TIME_YMD."' + and cp_used = '0' + and cp_method = '3' "; + $cp = sql_fetch($sql); + + $dc = 0; + if($cp['cp_id'] && ($cp['cp_minimum'] <= $tot_od_amount)) { + if($cp['cp_type']) { + $dc = floor(($tot_od_amount * ($cp['cp_amount'] / 100)) / $cp['cp_trunc']) * $cp['cp_trunc']; + } else { + $dc = $cp['cp_amount']; + } + + if($cp['cp_maximum'] && $dc > $cp['cp_maximum']) + $dc = $cp['cp_maximum']; + + if($dc > $send_cost) + $dc = $send_cost; + + $tot_sc_cp_amount = $dc; + } + } +} + +if ((int)($send_cost - $tot_sc_cp_amount) !== $i_send_cost) { die("Error.."); } @@ -259,6 +396,8 @@ $sql = " insert {$g4['shop_order_table']} od_deposit_name = '$od_deposit_name', od_memo = '$od_memo', od_send_cost = '$od_send_cost', + od_send_coupon = '$tot_sc_cp_amount', + od_coupon = '$tot_od_cp_amount', od_temp_bank = '$od_temp_bank', od_temp_card = '$od_receipt_card', od_temp_hp = '$od_receipt_hp', @@ -330,6 +469,54 @@ include_once(G4_MSHOP_PATH.'/kcp/pp_ax_hub_result.php'); $od_memo = nl2br(htmlspecialchars2(stripslashes($od_memo))) . " "; +// 쿠폰사용내역기록 +if($is_member) { + $it_cp_cnt = count($_POST['cp_id']); + for($i=0; $i<$it_cp_cnt; $i++) { + $cid = $_POST['cp_id'][$i]; + $cp_it_id = $_POST['it_id'][$i]; + $sql = " update {$g4['shop_coupon_table']} + set od_id = '$od_id', + cp_used = '1', + cp_used_time = '".G4_TIME_YMDHIS."' + where cp_id = '$cid' + and mb_id = '{$member['mb_id']}' + and cp_method IN ( 0, 1 ) "; + sql_query($sql); + + // 쿠폰사용금액 cart에 기록 + $cp_amt = (int)$arr_it_cp_amt[$cp_it_id]; + $sql = " update {$g4['shop_cart_table']} + set cp_amount = '$cp_amt' + where uq_id = '$tmp_uq_id' + and it_id = '$cp_it_id' + and ct_num = '0' "; + sql_query($sql); + } + + if($_POST['od_cp_id']) { + $sql = " update {$g4['shop_coupon_table']} + set od_id = '$od_id', + cp_used = '1', + cp_used_time = '".G4_TIME_YMDHIS."' + where cp_id = '{$_POST['od_cp_id']}' + and mb_id = '{$member['mb_id']}' + and cp_method = '2' "; + sql_query($sql); + } + + if($_POST['sc_cp_id']) { + $sql = " update {$g4['shop_coupon_table']} + set od_id = '$od_id', + cp_used = '1', + cp_used_time = '".G4_TIME_YMDHIS."' + where cp_id = '{$_POST['sc_cp_id']}' + and mb_id = '{$member['mb_id']}' + and cp_method = '3' "; + sql_query($sql); + } +} + include_once(G4_SHOP_PATH.'/ordermail1.inc.php'); include_once(G4_SHOP_PATH.'/ordermail2.inc.php'); diff --git a/mobile/shop/orderinquiry.sub.php b/mobile/shop/orderinquiry.sub.php index 89f4c097f..e48b8cb84 100644 --- a/mobile/shop/orderinquiry.sub.php +++ b/mobile/shop/orderinquiry.sub.php @@ -12,6 +12,7 @@ if (!defined("_ORDERINQUIRY_")) exit; // 개별 페이지 접근 불가 주문번호 주문일시 주문금액 + 쿠폰 입금액 @@ -37,6 +38,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++) () + diff --git a/mobile/shop/orderinquiryview.php b/mobile/shop/orderinquiryview.php index 6af7413fe..4bbc36946 100644 --- a/mobile/shop/orderinquiryview.php +++ b/mobile/shop/orderinquiryview.php @@ -44,7 +44,7 @@ include_once(G4_MSHOP_PATH.'/_head.php');
상품 배송이 완료되었습니다.
+ 0) - { + // 총계 = 주문상품금액합계 + 배송비 - 상품할인 - 결제할인 + $od_coupon = $od['od_coupon']; + $tot_amount = $tot_sell_amount + $send_cost - $tot_cp_amount - $od_coupon; ?>
- 배송비 - + 주문총액 +
+ 0) { ?> +
+ 상품할인 + +
- 0) { - ?> + 0) { ?> +
+ 결제할인 + +
+ + + 0) { ?> +
+ 배송비 + +
+ + + 0) { ?> +
+ 배송비할인 + +
+
총계 - +
- +
+ 포인트 + +
diff --git a/shop/cartoption.php b/shop/cartoption.php index 2044b375f..ec694239b 100644 --- a/shop/cartoption.php +++ b/shop/cartoption.php @@ -3,11 +3,12 @@ include_once('./_common.php'); $it_id = $_POST['it_id']; -$sql = " select it_id, it_option_subject, it_supply_subject +$sql = " select it_id, it_option_subject, it_supply_subject, it_price, it_point, it_point_type from {$g4['shop_item_table']} where it_id = '$it_id' and it_use = '1' "; $it = sql_fetch($sql); +$it_point = get_item_point($it); if(!$it['it_id']) die('no-item'); @@ -18,7 +19,7 @@ $sql = " select * from {$g4['shop_cart_table']} where uq_id = '$uq_id' and it_id $result = sql_query($sql); // 판매가격 -$sql2 = " select ct_price, it_name from {$g4['shop_cart_table']} where uq_id = '$uq_id' and it_id = '$it_id' and ct_num = '0' "; +$sql2 = " select ct_price, it_name, ct_point from {$g4['shop_cart_table']} where uq_id = '$uq_id' and it_id = '$it_id' and ct_num = '0' "; $row2 = sql_fetch($sql2); if(!mysql_num_rows($result)) @@ -30,6 +31,7 @@ if(!mysql_num_rows($result)) + 포인트 diff --git a/shop/orderform.php b/shop/orderform.php index 355428fd1..252cdcc09 100644 --- a/shop/orderform.php +++ b/shop/orderform.php @@ -131,7 +131,6 @@ setTimeout("init_pay_button();",300); 0) $good_info .= chr(30); $good_info .= "seq=".($i+1).chr(31); @@ -236,7 +235,7 @@ setTimeout("init_pay_button();",300); - + @@ -905,19 +904,20 @@ setTimeout("init_pay_button();",300);