From d8873271cd7cdc2001022db9ff695c9d0901b8fa Mon Sep 17 00:00:00 2001 From: gnuboard Date: Tue, 5 Nov 2013 15:23:33 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A3=BC=EB=AC=B8=EC=84=9C=20=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20=EC=88=98=EC=A0=95=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adm/shop_admin/orderform.php | 27 ++----------- adm/shop_admin/orderlist.php | 5 ++- lib/shop.lib.php | 75 +++++++++++++++++++++++++++++++++++- shop/orderinquiryview.php | 4 +- 4 files changed, 83 insertions(+), 28 deletions(-) diff --git a/adm/shop_admin/orderform.php b/adm/shop_admin/orderform.php index 1baf29f71..d8a727f53 100644 --- a/adm/shop_admin/orderform.php +++ b/adm/shop_admin/orderform.php @@ -21,31 +21,11 @@ sql_query($sql); //------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -// 주문포인트를 적립한다. -// 설정일이 지난 포인트 부여되지 않은 배송완료된 장바구니 자료에 포인트 부여 -// 설정일이 0 이면 주문서 완료 설정 시점에서 포인트를 바로 부여합니다. -//------------------------------------------------------------------------------ -function save_order_point($ct_status="완료") -{ - global $default; - - $beforedays = date("Y-m-d H:i:s", ( time() - (86400 * (int)$default['de_point_days']) ) ); // 86400초는 하루 - $sql = " select * from {$g5['g5_shop_cart_table']} where ct_status = '$ct_status' and ct_point_use = '0' and ct_time <= '$beforedays' "; - $result = sql_query($sql); - for ($i=0; $row=sql_fetch_array($result); $i++) { - // 회원 ID 를 얻는다. - $od_row = sql_fetch("select od_id, mb_id from {$g5['g5_shop_order_table']} where od_id = '{$row['od_id']}' "); - if ($od_row['mb_id'] && $row['ct_point'] > 0) { // 회원이면서 포인트가 0보다 크다면 - $po_point = $row['ct_point'] * $row['ct_qty']; - $po_content = "주문번호 {$od_row['od_id']} ({$row['ct_id']}) 배송완료"; - insert_point($od_row['mb_id'], $po_point, $po_content, "@delivery", $od_row['mb_id'], "{$od_row['od_id']},{$row['ct_id']}"); - } - sql_query("update {$g5['g5_shop_cart_table']} set ct_point_use = '1' where ct_id = '{$row['ct_id']}' "); - } -} +// 완료된 주문에 포인트를 적립한다. +save_order_point("완료"); +/* //------------------------------------------------------------------------------ // 주문완료 포인트 // 설정일이 지난 포인트 부여되지 않은 배송완료된 장바구니 자료에 포인트 부여 @@ -75,6 +55,7 @@ if (!isset($order_not_point)) { } } //------------------------------------------------------------------------------ +*/ //------------------------------------------------------------------------------ diff --git a/adm/shop_admin/orderlist.php b/adm/shop_admin/orderlist.php index afa9c0ab3..07c7e8c2c 100644 --- a/adm/shop_admin/orderlist.php +++ b/adm/shop_admin/orderlist.php @@ -65,7 +65,8 @@ if ($od_receipt_point) { } if ($od_coupon) { - $where[] = " od_coupon != 0 "; + // 개별상품쿠폰, 배송비쿠폰, 주문금액쿠폰 + $where[] = " (od_cart_coupon + od_send_coupon + od_coupon) != 0 "; } if ($fr_date && $to_date) { @@ -180,7 +181,7 @@ $listall = '전체목록> > - +
diff --git a/lib/shop.lib.php b/lib/shop.lib.php index b0ee68e3f..05f032033 100644 --- a/lib/shop.lib.php +++ b/lib/shop.lib.php @@ -389,6 +389,7 @@ function get_image($img, $width=0, $height=0, $img_id='') return $str; } + // 상품 이미지를 얻는다 function get_it_image($it_id, $width, $height=0, $anchor=false, $img_id='') { @@ -448,6 +449,8 @@ function get_it_image($it_id, $width, $height=0, $anchor=false, $img_id='') return $img; } + +// 상품이미지 썸네일 생성 function get_it_thumbnail($img, $width, $height=0, $id='') { $str = ''; @@ -481,7 +484,8 @@ function get_it_thumbnail($img, $width, $height=0, $id='') return $str; } -// + +// 이미지 URL 을 얻는다. function get_it_imageurl($it_id) { global $g5; @@ -513,6 +517,7 @@ function get_it_imageurl($it_id) return $str; } + // 상품의 재고 (창고재고수량 - 주문대기수량) function get_it_stock_qty($it_id) { @@ -535,6 +540,7 @@ function get_it_stock_qty($it_id) return $jaego - $daegi; } + // 옵션의 재고 (창고재고수량 - 주문대기수량) function get_option_stock_qty($it_id, $io_id, $type) { @@ -560,6 +566,7 @@ function get_option_stock_qty($it_id, $io_id, $type) return $jaego - $daegi; } + // 큰 이미지 function get_large_image($img, $it_id, $btn_image=true) { @@ -579,6 +586,7 @@ function get_large_image($img, $it_id, $btn_image=true) return $str; } + // 금액 표시 function display_price($price, $tel_inq=false) { @@ -590,6 +598,7 @@ function display_price($price, $tel_inq=false) return $price; } + // 금액표시 // $it : 상품 배열 function get_price($it) @@ -610,12 +619,14 @@ function display_point($point) return number_format($point, 0).'점'; } + // 포인트를 구한다 function get_point($amount, $point) { return (int)($amount * $point / 100); } + // HTML 특수문자 변환 htmlspecialchars function htmlspecialchars2($str) { @@ -624,6 +635,7 @@ function htmlspecialchars2($str) return $str; } + // 상품이미지 업로드 function it_img_upload($srcfile, $filename, $dir) { @@ -654,6 +666,7 @@ function it_img_upload($srcfile, $filename, $dir) return $file; } + // 파일을 업로드 함 function upload_file($srcfile, $destfile, $dir) { @@ -664,6 +677,7 @@ function upload_file($srcfile, $destfile, $dir) return true; } + function message($subject, $content, $align="left", $width="450") { $str = " @@ -689,6 +703,7 @@ function message($subject, $content, $align="left", $width="450") return $str; } + // 시간이 비어 있는지 검사 function is_null_time($datetime) { @@ -701,6 +716,7 @@ function is_null_time($datetime) return false; } + // 출력유형, 스킨파일, 1라인이미지수, 총라인수, 이미지폭, 이미지높이 // 1.02.01 $ca_id 추가 //function display_type($type, $skin_file, $list_mod, $list_row, $img_width, $img_height, $ca_id="") @@ -745,6 +761,7 @@ function display_type($type, $list_skin='', $list_mod='', $list_row='', $img_wid } } + // 모바일 유형별 상품 출력 function mobile_display_type($type, $skin_file, $list_row, $img_width, $img_height, $ca_id="") { @@ -774,6 +791,7 @@ function mobile_display_type($type, $skin_file, $list_row, $img_width, $img_heig } } + // 분류별 출력 // 스킨파일번호, 1라인이미지수, 총라인수, 이미지폭, 이미지높이 , 분류번호 function display_category($no, $list_mod, $list_row, $img_width, $img_height, $ca_id="") @@ -801,6 +819,7 @@ function display_category($no, $list_mod, $list_row, $img_width, $img_height, $c } } + // 별 function get_star($score) { @@ -814,6 +833,7 @@ function get_star($score) return $star; } + // 별 이미지 function get_star_image($it_id) { @@ -825,6 +845,7 @@ function get_star_image($it_id) return (int)get_star($row['score']); } + // 메일 보내는 내용을 HTML 형식으로 만든다. function email_content($str) { @@ -840,6 +861,7 @@ function email_content($str) return $s; } + // 타임스탬프 형식으로 넘어와야 한다. // 시작시간, 종료시간 function gap_time($begin_time, $end_time) @@ -864,6 +886,7 @@ function continue_cut_str($str, $len=80) return preg_replace($pattern, "\\0\n", $str); } + // 제목별로 컬럼 정렬하는 QUERY STRING // $type 이 1이면 반대 function title_sort($col, $type=0) @@ -903,6 +926,7 @@ function session_check() gotourl(G5_SHOP_URL); } + // 상품 선택옵션 function get_item_options($it_id, $subject) { @@ -990,6 +1014,7 @@ function get_item_options($it_id, $subject) return $str; } + // 상품 추가옵션 function get_item_supply($it_id, $subject) { @@ -1059,6 +1084,7 @@ function get_item_supply($it_id, $subject) return $str; } + function print_item_options($it_id, $cart_id) { global $g5; @@ -1079,6 +1105,7 @@ function print_item_options($it_id, $cart_id) return $str; } + // 일자형식변환 function date_conv($date, $case=1) { @@ -1091,6 +1118,7 @@ function date_conv($date, $case=1) return $date; } + // 배너출력 function display_banner($position, $num="") { @@ -1101,6 +1129,7 @@ function display_banner($position, $num="") include G5_SHOP_SKIN_PATH.'/boxbanner'.$num.'.skin.php'; } + // 1.00.02 // 파일번호, 이벤트번호, 1라인이미지수, 총라인수, 이미지폭, 이미지높이 // 1.02.01 $ca_id 추가 @@ -1130,6 +1159,7 @@ function display_event($no, $event, $list_mod, $list_row, $img_width, $img_heigh } } + function get_yn($val, $case='') { switch ($case) { @@ -1139,6 +1169,7 @@ function get_yn($val, $case='') return $result; } + // 상품명과 건수를 반환 function get_goods($cart_id) { @@ -1213,6 +1244,7 @@ function check_datetime($datetime) return false; } + // 경고메세지를 경고창으로 function alert_opener($msg='', $url='') { @@ -1229,6 +1261,7 @@ function alert_opener($msg='', $url='') exit; } + // option 리스트에 selected 추가 function conv_selected_option($options, $value) { @@ -1240,6 +1273,7 @@ function conv_selected_option($options, $value) return $options; } + // 주문서 번호를 얻는다. function get_new_od_id() { @@ -1266,6 +1300,7 @@ function get_new_od_id() return $od_id; } + // cart id 설정 function set_cart_id($direct) { @@ -1314,6 +1349,7 @@ function set_cart_id($direct) } } + // 상품 목록 : 관련 상품 출력 function relation_item($it_id, $width, $height, $rows=3) { @@ -1349,6 +1385,7 @@ function relation_item($it_id, $width, $height, $rows=3) return $str; } + // 상품이미지에 유형 아이콘 출력 function item_icon($it) { @@ -1378,6 +1415,7 @@ function item_icon($it) return $icon; } + // sns 공유하기 function get_sns_share_link($sns, $url, $title, $img) { @@ -1399,6 +1437,7 @@ function get_sns_share_link($sns, $url, $title, $img) return $str; } + // 상품이미지 썸네일 삭제 function delete_item_thumbnail($dir, $file) { @@ -1416,6 +1455,7 @@ function delete_item_thumbnail($dir, $file) } } + // 쿠폰번호 생성함수 function get_coupon_id() { @@ -1439,6 +1479,7 @@ function get_coupon_id() return $str; } + // array_map() 대체 function array_add_callback($func, $array) { @@ -1461,6 +1502,7 @@ function array_add_callback($func, $array) return $array; } + // 주문의 금액, 배송비 과세금액 등의 정보를 가져옴 function get_order_info($od_id) { @@ -1605,6 +1647,7 @@ function get_order_info($od_id) return $info; } + // 상품포인트 function get_item_point($it) { @@ -1619,6 +1662,7 @@ function get_item_point($it) return $it_point; } + // 배송비 구함 function get_sendcost($cart_id, $selected=1) { @@ -1672,6 +1716,7 @@ function get_sendcost($cart_id, $selected=1) return ($total_send_cost + $send_cost); } + // 상품별 배송비 function get_item_sendcost($it_id, $price, $qty) { @@ -1708,6 +1753,7 @@ function get_item_sendcost($it_id, $price, $qty) return $sendcost; } + // 쿠폰 사용체크 function is_used_coupon($mb_id, $cp_id) { @@ -1723,6 +1769,33 @@ function is_used_coupon($mb_id, $cp_id) return $used; } + + +//------------------------------------------------------------------------------ +// 주문포인트를 적립한다. +// 설정일이 지난 포인트 부여되지 않은 배송완료된 장바구니 자료에 포인트 부여 +// 설정일이 0 이면 주문서 완료 설정 시점에서 포인트를 바로 부여합니다. +//------------------------------------------------------------------------------ +function save_order_point($ct_status="완료") +{ + global $default; + + $beforedays = date("Y-m-d H:i:s", ( time() - (86400 * (int)$default['de_point_days']) ) ); // 86400초는 하루 + $sql = " select * from {$g5['g5_shop_cart_table']} where ct_status = '$ct_status' and ct_point_use = '0' and ct_time <= '$beforedays' "; + $result = sql_query($sql); + for ($i=0; $row=sql_fetch_array($result); $i++) { + // 회원 ID 를 얻는다. + $od_row = sql_fetch("select od_id, mb_id from {$g5['g5_shop_order_table']} where od_id = '{$row['od_id']}' "); + if ($od_row['mb_id'] && $row['ct_point'] > 0) { // 회원이면서 포인트가 0보다 크다면 + $po_point = $row['ct_point'] * $row['ct_qty']; + $po_content = "주문번호 {$od_row['od_id']} ({$row['ct_id']}) 배송완료"; + insert_point($od_row['mb_id'], $po_point, $po_content, "@delivery", $od_row['mb_id'], "{$od_row['od_id']},{$row['ct_id']}"); + } + sql_query("update {$g5['g5_shop_cart_table']} set ct_point_use = '1' where ct_id = '{$row['ct_id']}' "); + } +} + + //============================================================================== // 쇼핑몰 라이브러리 모음 끝 //============================================================================== diff --git a/shop/orderinquiryview.php b/shop/orderinquiryview.php index 66f8f2012..18acb3575 100644 --- a/shop/orderinquiryview.php +++ b/shop/orderinquiryview.php @@ -147,12 +147,12 @@ if(openwin != null) {
0) { ?> -
상품할인
+
개별상품 쿠폰할인
0) { ?> -
결제할인
+
주문금액 쿠폰할인