정보통신망법 23조 2항(주민등록번호의 사용제한)에 따라 기존 주민등록번호 기반의 인증서비스 이용이 불가합니다. 주민등록번호 대체수단으로 최소한의 정보(생년월일, 휴대폰번호, 성별)를 입력받아 본인임을 확인하는 인증수단 입니다
-

-
아이핀 본인확인 서비스
-
정부가 주관하는 주민등록번호 대체 수단으로 본인의 개인정보를 아이핀 사이트에 한번만 발급해 놓고, 이후부터는 아이디와 패스워드 만으로
- 본인임을 확인하는 인증수단 입니다.
-

+
+
본인확인 서비스
+
+
+ 
+ 
+
-
-
-
-
SMS 문자 서비스
-
사이트 관리자 또는 회원이 다른 회원의
휴대폰으로 단문메세지(최대 한글 40자, 영문 80자)를 발송할 수 있습니다.
-
-
+
+
+
+
+
SMS 문자 서비스
+
주문이나 배송시에 상점운영자 또는 고객에게 휴대폰으로 단문메세지 (최대 한글 40자, 영문 80자)를 발송합니다.
+
+
쇼핑몰 설치 후 이용해 주십시오.');
+
+include_once(G5_ADMIN_PATH.'/admin.lib.php');
+include_once('./admin.shop.lib.php');
+
+run_event('admin_common');
+
+check_order_inicis_tmps();
\ No newline at end of file
diff --git a/adm/shop_admin/admin.shop.lib.php b/adm/shop_admin/admin.shop.lib.php
new file mode 100644
index 000000000..02225e029
--- /dev/null
+++ b/adm/shop_admin/admin.shop.lib.php
@@ -0,0 +1,221 @@
+'.PHP_EOL;
+ $msg .= 'alert("PHP SOAP 확장모듈이 설치되어 있지 않습니다.\n모바일 쇼핑몰 결제 때 사용되오니 SOAP 확장 모듈을 설치하여 주십시오.\nNHN_KCP (네이버페이) 모바일결제가 되지 않습니다.");'.PHP_EOL;
+ $msg .= ''.PHP_EOL;
+ }
+ }
+
+ if( $pg_msg ){
+ $pg_test_conf_link = G5_ADMIN_URL.'/shop_admin/configform.php#de_card_test1';
+ $msg .= '
(주의!) '.$pg_msg.' 결제의 결제 설정이 현재 테스트결제 로 되어 있습니다.
테스트결제시 실제 결제가 되지 않으므로, 쇼핑몰 운영중이면 반드시 실결제로 설정하여 운영하셔야 합니다.
아래 링크를 클릭하여 실결제로 설정하여 운영해 주세요.
'.$pg_test_conf_link.'';
+ }
+
+ if( $is_print ){
+ echo $msg;
+ } else{
+ return $msg;
+ }
+}
+
+function check_order_inicis_tmps(){
+ global $g5, $config, $default, $member;
+
+ $admin_cookie_time = get_cookie('admin_visit_time');
+
+ if( ! $admin_cookie_time ){
+
+ if( $default['de_pg_service'] === 'inicis' && empty($default['de_card_test']) ){
+ $sql = " select * from {$g5['g5_shop_inicis_log_table']} where P_TID <> '' and P_TYPE in ('CARD', 'ISP', 'BANK') and P_MID <> '' and P_STATUS = '00' and is_mail_send = 0 and substr(P_AUTH_DT, 1, 14) < '".date('YmdHis', strtotime('-3 minutes', G5_SERVER_TIME))."' ";
+
+ $result = sql_query($sql, false);
+
+ if( !$result ){
+ return;
+ }
+
+ $mail_msg = '';
+
+ for($i=0;$row=sql_fetch_array($result);$i++){
+
+ $oid = $row['oid'];
+ $p_tid = $row['P_TID'];
+ $p_mid = strtolower($tmps['P_MID']);
+
+ if( in_array($p_mid, array('iniescrow0', 'inipaytest')) ) continue;
+
+ $sql = "update {$g5['g5_shop_inicis_log_table']} set is_mail_send = 1 where oid = '".$oid."' and P_TID = '".$p_tid."' ";
+ sql_query($sql);
+
+ $sql = " select od_id from {$g5['g5_shop_order_table']} where od_id = '$oid' and od_tno = '$p_tid' ";
+ $tmp = sql_fetch($sql);
+
+ if( $tmp['od_id'] ) continue;
+
+ $sql = " select pp_id from {$g5['g5_shop_personalpay_table']} where pp_id = '$oid' and pp_tno = '$p_tid' ";
+ $tmp = sql_fetch($sql);
+
+ if( $tmp['pp_id'] ) continue;
+
+ $mail_msg .= '
미완료 발생 주문번호 : '.$oid.'';
+
+ }
+
+ if( $mail_msg ){
+ include_once(G5_LIB_PATH.'/mailer.lib.php');
+
+ $mails = array_unique(array($member['mb_email'], $config['cf_admin_email']));
+
+ foreach($mails as $mail_address){
+ if (!preg_match("/([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/", $mail_address)) continue;
+
+ mailer($member['mb_nick'], $member['mb_email'], $mail_address, $config['cf_title'].' 사이트 미완료 주문 알림', '이니시스를 통해 결제한 주문건 중에서 미완료 주문이 발생했습니다.
발생된 원인으로는 장바구니 금액와 실결제 금액이 맞지 않는 경우, 네트워크 오류, 프로그램 오류, 알수 없는 오류 등이 있습니다.
아래 내용과 실제 주문내역, 이니시스 상점 관리자 에서 결제된 내용을 확인하여 조치를 취해 주세요.
'.$mail_msg, 0);
+ }
+ }
+ }
+
+ if( $default['de_pg_service'] == 'lg' && function_exists('check_log_folder') ){
+ check_log_folder(G5_LGXPAY_PATH.'/lgdacom/log');
+ }
+
+ set_cookie('admin_visit_time', G5_SERVER_TIME, 3600); //1시간 간격으로 체크
+ }
+} //end function check_order_inicis_tmps;
\ No newline at end of file
diff --git a/adm/shop_admin/ajax.ca_id.php b/adm/shop_admin/ajax.ca_id.php
new file mode 100644
index 000000000..972eafed4
--- /dev/null
+++ b/adm/shop_admin/ajax.ca_id.php
@@ -0,0 +1,16 @@
+주문정보가 존재하지 않습니다.
');
+
+// 상품목록
+$sql = " select it_id,
+ it_name,
+ cp_price,
+ ct_notax,
+ ct_send_cost,
+ it_sc_type
+ from {$g5['g5_shop_cart_table']}
+ where od_id = '$od_id'
+ group by it_id
+ order by ct_id ";
+$result = sql_query($sql);
+?>
+
+
+ 주문상품 목록
+
+
+
+ 주문 상품 목록
+
+
+ | 상품명 |
+ 옵션항목 |
+ 상태 |
+ 수량 |
+ 판매가 |
+ 소계 |
+ 쿠폰 |
+ 포인트 |
+ 배송비 |
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/adm/shop_admin/ajax.skinfile.php b/adm/shop_admin/ajax.skinfile.php
new file mode 100644
index 000000000..608c1d6f8
--- /dev/null
+++ b/adm/shop_admin/ajax.skinfile.php
@@ -0,0 +1,18 @@
+0,
+'bn_alt'=>'',
+'bn_device'=>'',
+'bn_position'=>'',
+'bn_border'=>'',
+'bn_new_win'=>'',
+'bn_order'=>''
+);
+
+$html_title = '배너';
+$g5['title'] = $html_title.'관리';
+
+if ($w=="u")
+{
+ $html_title .= ' 수정';
+ $sql = " select * from {$g5['g5_shop_banner_table']} where bn_id = '$bn_id' ";
+ $bn = sql_fetch($sql);
+}
+else
+{
+ $html_title .= ' 입력';
+ $bn['bn_url'] = "http://";
+ $bn['bn_begin_time'] = date("Y-m-d 00:00:00", time());
+ $bn['bn_end_time'] = date("Y-m-d 00:00:00", time()+(60*60*24*31));
+}
+
+// 접속기기 필드 추가
+if(!sql_query(" select bn_device from {$g5['g5_shop_banner_table']} limit 0, 1 ")) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_banner_table']}`
+ ADD `bn_device` varchar(10) not null default '' AFTER `bn_url` ", true);
+ sql_query(" update {$g5['g5_shop_banner_table']} set bn_device = 'pc' ", true);
+}
+
+include_once (G5_ADMIN_PATH.'/admin.head.php');
+?>
+
+
+
+ 16){
+ alert("이미지 파일만 업로드 할수 있습니다.");
+ }
+}
+
+if ($w=="")
+{
+ if (!$bn_bimg_name) alert('배너 이미지를 업로드 하세요.');
+
+ sql_query(" alter table {$g5['g5_shop_banner_table']} auto_increment=1 ");
+
+ $sql = " insert into {$g5['g5_shop_banner_table']}
+ set bn_alt = '$bn_alt',
+ bn_url = '$bn_url',
+ bn_device = '$bn_device',
+ bn_position = '$bn_position',
+ bn_border = '$bn_border',
+ bn_new_win = '$bn_new_win',
+ bn_begin_time = '$bn_begin_time',
+ bn_end_time = '$bn_end_time',
+ bn_time = '".G5_TIME_YMDHIS."',
+ bn_hit = '0',
+ bn_order = '$bn_order' ";
+ sql_query($sql);
+
+ $bn_id = sql_insert_id();
+}
+else if ($w=="u")
+{
+ $sql = " update {$g5['g5_shop_banner_table']}
+ set bn_alt = '$bn_alt',
+ bn_url = '$bn_url',
+ bn_device = '$bn_device',
+ bn_position = '$bn_position',
+ bn_border = '$bn_border',
+ bn_new_win = '$bn_new_win',
+ bn_begin_time = '$bn_begin_time',
+ bn_end_time = '$bn_end_time',
+ bn_time = '".G5_TIME_YMDHIS."',
+ bn_order = '$bn_order'
+ where bn_id = '$bn_id' ";
+ sql_query($sql);
+}
+else if ($w=="d")
+{
+ @unlink(G5_DATA_PATH."/banner/$bn_id");
+
+ $sql = " delete from {$g5['g5_shop_banner_table']} where bn_id = $bn_id ";
+ $result = sql_query($sql);
+}
+
+
+if ($w == "" || $w == "u")
+{
+ if ($_FILES['bn_bimg']['name']) upload_file($_FILES['bn_bimg']['tmp_name'], $bn_id, G5_DATA_PATH."/banner");
+
+ goto_url("./bannerform.php?w=u&bn_id=$bn_id");
+} else {
+ goto_url("./bannerlist.php");
+}
\ No newline at end of file
diff --git a/adm/shop_admin/bannerlist.php b/adm/shop_admin/bannerlist.php
new file mode 100644
index 000000000..d7868aebb
--- /dev/null
+++ b/adm/shop_admin/bannerlist.php
@@ -0,0 +1,187 @@
+
+
+
+ 된 배너 개
+
+
+
+
+
+
+
+
+
+ 목록
+
+
+ | ID |
+ 접속기기 |
+ 위치 |
+ 시작일시 |
+ 종료일시 |
+ 출력순서 |
+ 조회 |
+ 관리 |
+
+
+ | 이미지 |
+
+
+
+ 800)
+ $width = 800;
+ else
+ $width = $size[0];
+
+ $bn_img = "";
+
+ $bn_img .= '
';
+ }
+
+ switch($row['bn_device']) {
+ case 'pc':
+ $bn_device = 'PC';
+ break;
+ case 'mobile':
+ $bn_device = '모바일';
+ break;
+ default:
+ $bn_device = 'PC와 모바일';
+ break;
+ }
+
+ $bn_begin_time = substr($row['bn_begin_time'], 2, 14);
+ $bn_end_time = substr($row['bn_end_time'], 2, 14);
+
+ $bg = 'bg'.($i%2);
+ ?>
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+ 수정
+ 삭제
+ |
+
+
+ |
+
+
+ |
+
+
+ 자료가 없습니다. | ';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+'',
+'ca_mobile_skin_dir'=>'',
+'ca_name'=>'',
+'ca_order'=>'',
+'ca_mb_id'=>'',
+'ca_skin_dir'=>'',
+'ca_cert_use'=>0,
+'ca_adult_use'=>0,
+'ca_sell_email'=>'',
+'ca_nocoupon'=>0,
+'ca_include_head'=>'',
+'ca_include_tail'=>'',
+'ca_head_html'=>'',
+'ca_tail_html'=>'',
+'ca_mobile_head_html'=>'',
+'ca_mobile_tail_html'=>'',
+);
+
+for($i=0;$i<=10;$i++){
+ $ca['ca_'.$i.'_subj'] = '';
+ $ca['ca_'.$i] = '';
+}
+
+$sql_common = " from {$g5['g5_shop_category_table']} ";
+if ($is_admin != 'super')
+ $sql_common .= " where ca_mb_id = '{$member['mb_id']}' ";
+
+if ($w == "")
+{
+ if ($is_admin != 'super' && !$ca_id)
+ alert("최고관리자만 1단계 분류를 추가할 수 있습니다.");
+
+ $len = strlen($ca_id);
+ if ($len == 10)
+ alert("분류를 더 이상 추가할 수 없습니다.\\n\\n5단계 분류까지만 가능합니다.");
+
+ $len2 = $len + 1;
+
+ $sql = " select MAX(SUBSTRING(ca_id,$len2,2)) as max_subid from {$g5['g5_shop_category_table']}
+ where SUBSTRING(ca_id,1,$len) = '$ca_id' ";
+ $row = sql_fetch($sql);
+
+ $subid = base_convert($row['max_subid'], 36, 10);
+ $subid += 36;
+ if ($subid >= 36 * 36)
+ {
+ //alert("분류를 더 이상 추가할 수 없습니다.");
+ // 빈상태로
+ $subid = " ";
+ }
+ $subid = base_convert($subid, 10, 36);
+ $subid = substr("00" . $subid, -2);
+ $subid = $ca_id . $subid;
+
+ $sublen = strlen($subid);
+
+ if ($ca_id) // 2단계이상 분류
+ {
+ $sql = " select * from {$g5['g5_shop_category_table']} where ca_id = '$ca_id' ";
+ $ca = sql_fetch($sql);
+ $html_title = $ca['ca_name'] . " 하위분류추가";
+ $ca['ca_name'] = "";
+ }
+ else // 1단계 분류
+ {
+ $html_title = "1단계분류추가";
+ $ca['ca_use'] = 1;
+ $ca['ca_explan_html'] = 1;
+ $ca['ca_img_width'] = $default['de_simg_width'];
+ $ca['ca_img_height'] = $default['de_simg_height'];
+ $ca['ca_mobile_img_width'] = $default['de_simg_width'];
+ $ca['ca_mobile_img_height'] = $default['de_simg_height'];
+ $ca['ca_list_mod'] = 3;
+ $ca['ca_list_row'] = 5;
+ $ca['ca_mobile_list_mod'] = 3;
+ $ca['ca_mobile_list_row'] = 5;
+ $ca['ca_stock_qty'] = 99999;
+ }
+ $ca['ca_skin'] = "list.10.skin.php";
+ $ca['ca_mobile_skin'] = "list.10.skin.php";
+}
+else if ($w == "u")
+{
+ $sql = " select * from {$g5['g5_shop_category_table']} where ca_id = '$ca_id' ";
+ $ca = sql_fetch($sql);
+ if (! (isset($ca['ca_id']) && $ca['ca_id']))
+ alert("자료가 없습니다.");
+
+ $html_title = $ca['ca_name'] . " 수정";
+ $ca['ca_name'] = get_text($ca['ca_name']);
+}
+
+$g5['title'] = $html_title;
+include_once (G5_ADMIN_PATH.'/admin.head.php');
+
+$pg_anchor ='
';
+
+// 쿠폰 적용 불가 설정 필드 추가
+if(!sql_query(" select ca_nocoupon from {$g5['g5_shop_category_table']} limit 1 ", false)) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_category_table']}`
+ ADD `ca_nocoupon` tinyint(4) NOT NULL DEFAULT '0' AFTER `ca_adult_use` ", true);
+}
+
+// 스킨 디렉토리 필드 추가
+if(!sql_query(" select ca_skin_dir from {$g5['g5_shop_category_table']} limit 1 ", false)) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_category_table']}`
+ ADD `ca_skin_dir` varchar(255) NOT NULL DEFAULT '' AFTER `ca_name`,
+ ADD `ca_mobile_skin_dir` varchar(255) NOT NULL DEFAULT '' AFTER `ca_skin_dir` ", true);
+}
+
+// 분류 출력순서 필드 추가
+if(!sql_query(" select ca_order from {$g5['g5_shop_category_table']} limit 1 ", false)) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_category_table']}`
+ ADD `ca_order` int(11) NOT NULL DEFAULT '0' AFTER `ca_name` ", true);
+ sql_query(" ALTER TABLE `{$g5['g5_shop_category_table']}` ADD INDEX(`ca_order`) ", true);
+}
+
+// 모바일 상품 출력줄수 필드 추가
+if(!sql_query(" select ca_mobile_list_row from {$g5['g5_shop_category_table']} limit 1 ", false)) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_category_table']}`
+ ADD `ca_mobile_list_row` int(11) NOT NULL DEFAULT '0' AFTER `ca_mobile_list_mod` ", true);
+}
+
+// 스킨 Path
+if(!$ca['ca_skin_dir'])
+ $g5_shop_skin_path = G5_SHOP_SKIN_PATH;
+else {
+ if(preg_match('#^theme/(.+)$#', $ca['ca_skin_dir'], $match))
+ $g5_shop_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/shop/'.$match[1];
+ else
+ $g5_shop_skin_path = G5_PATH.'/'.G5_SKIN_DIR.'/shop/'.$ca['ca_skin_dir'];
+}
+
+if(!$ca['ca_mobile_skin_dir'])
+ $g5_mshop_skin_path = G5_MSHOP_SKIN_PATH;
+else {
+ if(preg_match('#^theme/(.+)$#', $ca['ca_mobile_skin_dir'], $match))
+ $g5_mshop_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/shop/'.$match[1];
+ else
+ $g5_mshop_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/shop/'.$ca['ca_mobile_skin_dir'];
+}
+?>
+
+
+
+
+
+'int',
+'ca_img_width'=>'int',
+'ca_img_height'=>'int',
+'ca_name'=>'str',
+'ca_mb_id'=>'str',
+'ca_nocoupon'=>'str',
+'ca_mobile_skin_dir'=>'str',
+'ca_skin'=>'str',
+'ca_mobile_skin'=>'str',
+'ca_list_mod'=>'int',
+'ca_list_row'=>'int',
+'ca_mobile_img_width'=>'int',
+'ca_mobile_img_height'=>'int',
+'ca_mobile_list_mod'=>'int',
+'ca_mobile_list_row'=>'int',
+'ca_sell_email'=>'str',
+'ca_use'=>'int',
+'ca_stock_qty'=>'int',
+'ca_explan_html'=>'int',
+'ca_cert_use'=>'int',
+'ca_adult_use'=>'int',
+'ca_skin_dir'=>'str'
+);
+
+for($i=0;$i<=10;$i++){
+ $check_str_keys['ca_'.$i.'_subj'] = 'str';
+ $check_str_keys['ca_'.$i] = 'str';
+}
+
+foreach( $check_str_keys as $key=>$val ){
+ if( $val === 'int' ){
+ $value = isset($_POST[$key]) ? (int) $_POST[$key] : 0;
+ } else {
+ $value = isset($_POST[$key]) ? clean_xss_tags($_POST[$key], 1, 1) : '';
+ }
+ $$key = $_POST[$key] = $value;
+}
+
+$ca_head_html = isset($_POST['ca_head_html']) ? $_POST['ca_head_html'] : '';
+$ca_tail_html = isset($_POST['ca_tail_html']) ? $_POST['ca_tail_html'] : '';
+$ca_mobile_head_html = isset($_POST['ca_mobile_head_html']) ? $_POST['ca_mobile_head_html'] : '';
+$ca_mobile_tail_html = isset($_POST['ca_mobile_tail_html']) ? $_POST['ca_mobile_tail_html'] : '';
+
+if(!is_include_path_check($ca_include_head, 1)) {
+ alert('상단 파일 경로에 포함시킬수 없는 문자열이 있습니다.');
+}
+
+if(!is_include_path_check($ca_include_tail, 1)) {
+ alert('하단 파일 경로에 포함시킬수 없는 문자열이 있습니다.');
+}
+
+$check_keys = array('ca_skin_dir', 'ca_mobile_skin_dir', 'ca_skin', 'ca_mobile_skin');
+
+foreach( $check_keys as $key ){
+ if( isset($$key) && preg_match('#\.+(\/|\\\)#', $$key) ){
+ alert('스킨명 또는 경로에 포함시킬수 없는 문자열이 있습니다.');
+ }
+}
+
+if( function_exists('filter_input_include_path') ){
+ $ca_include_head = filter_input_include_path($ca_include_head);
+ $ca_include_tail = filter_input_include_path($ca_include_tail);
+}
+
+if ($w == "u" || $w == "d")
+ check_demo();
+
+auth_check_menu($auth, $sub_menu, "d");
+
+check_admin_token();
+
+if ($w == 'd' && $is_admin != 'super')
+ alert("최고관리자만 분류를 삭제할 수 있습니다.");
+
+if ($w == "" || $w == "u")
+{
+ if ($ca_mb_id)
+ {
+ $sql = " select mb_id from {$g5['member_table']} where mb_id = '$ca_mb_id' ";
+ $row = sql_fetch($sql);
+ if (!$row['mb_id'])
+ alert("\'$ca_mb_id\' 은(는) 존재하는 회원아이디가 아닙니다.");
+ }
+}
+
+if( $ca_skin && ! is_include_path_check($ca_skin) ){
+ alert('오류 : 데이터폴더가 포함된 path 를 포함할수 없습니다.');
+}
+
+$sql_common = " ca_order = '$ca_order',
+ ca_skin_dir = '$ca_skin_dir',
+ ca_mobile_skin_dir = '$ca_mobile_skin_dir',
+ ca_skin = '$ca_skin',
+ ca_mobile_skin = '$ca_mobile_skin',
+ ca_img_width = '$ca_img_width',
+ ca_img_height = '$ca_img_height',
+ ca_list_mod = '$ca_list_mod',
+ ca_list_row = '$ca_list_row',
+ ca_mobile_img_width = '$ca_mobile_img_width',
+ ca_mobile_img_height = '$ca_mobile_img_height',
+ ca_mobile_list_mod = '$ca_mobile_list_mod',
+ ca_mobile_list_row = '$ca_mobile_list_row',
+ ca_sell_email = '$ca_sell_email',
+ ca_use = '$ca_use',
+ ca_stock_qty = '$ca_stock_qty',
+ ca_explan_html = '$ca_explan_html',
+ ca_head_html = '$ca_head_html',
+ ca_tail_html = '$ca_tail_html',
+ ca_mobile_head_html = '$ca_mobile_head_html',
+ ca_mobile_tail_html = '$ca_mobile_tail_html',
+ ca_include_head = '$ca_include_head',
+ ca_include_tail = '$ca_include_tail',
+ ca_mb_id = '$ca_mb_id',
+ ca_cert_use = '$ca_cert_use',
+ ca_adult_use = '$ca_adult_use',
+ ca_nocoupon = '$ca_nocoupon',
+ ca_1_subj = '$ca_1_subj',
+ ca_2_subj = '$ca_2_subj',
+ ca_3_subj = '$ca_3_subj',
+ ca_4_subj = '$ca_4_subj',
+ ca_5_subj = '$ca_5_subj',
+ ca_6_subj = '$ca_6_subj',
+ ca_7_subj = '$ca_7_subj',
+ ca_8_subj = '$ca_8_subj',
+ ca_9_subj = '$ca_9_subj',
+ ca_10_subj = '$ca_10_subj',
+ ca_1 = '$ca_1',
+ ca_2 = '$ca_2',
+ ca_3 = '$ca_3',
+ ca_4 = '$ca_4',
+ ca_5 = '$ca_5',
+ ca_6 = '$ca_6',
+ ca_7 = '$ca_7',
+ ca_8 = '$ca_8',
+ ca_9 = '$ca_9',
+ ca_10 = '$ca_10' ";
+
+
+if ($w == "")
+{
+ if (!trim($ca_id))
+ alert("분류 코드가 없으므로 분류를 추가하실 수 없습니다.");
+
+ // 소문자로 변환
+ $ca_id = strtolower($ca_id);
+
+ $sql = " insert {$g5['g5_shop_category_table']}
+ set ca_id = '$ca_id',
+ ca_name = '$ca_name',
+ $sql_common ";
+ sql_query($sql);
+}
+else if ($w == "u")
+{
+ $sql = " update {$g5['g5_shop_category_table']}
+ set ca_name = '$ca_name',
+ $sql_common
+ where ca_id = '$ca_id' ";
+ sql_query($sql);
+
+ // 하위분류를 똑같은 설정으로 반영
+ if (isset($_POST['sub_category']) && $_POST['sub_category']) {
+ $len = strlen($ca_id);
+ $sql = " update {$g5['g5_shop_category_table']}
+ set $sql_common
+ where SUBSTRING(ca_id,1,$len) = '$ca_id' ";
+ if ($is_admin != 'super')
+ $sql .= " and ca_mb_id = '{$member['mb_id']}' ";
+ sql_query($sql);
+ }
+}
+else if ($w == "d")
+{
+ // 분류의 길이
+ $len = strlen($ca_id);
+
+ $sql = " select COUNT(*) as cnt from {$g5['g5_shop_category_table']}
+ where SUBSTRING(ca_id,1,$len) = '$ca_id'
+ and ca_id <> '$ca_id' ";
+ $row = sql_fetch($sql);
+ if ($row['cnt'] > 0)
+ alert("이 분류에 속한 하위 분류가 있으므로 삭제 할 수 없습니다.\\n\\n하위분류를 우선 삭제하여 주십시오.");
+
+ $str = $comma = "";
+ $sql = " select it_id from {$g5['g5_shop_item_table']} where ca_id = '$ca_id' ";
+ $result = sql_query($sql);
+ $i=0;
+ while ($row = sql_fetch_array($result))
+ {
+ $i++;
+ if ($i % 10 == 0) $str .= "\\n";
+ $str .= "$comma{$row['it_id']}";
+ $comma = " , ";
+ }
+
+ if ($str)
+ alert("이 분류와 관련된 상품이 총 {$i} 건 존재하므로 상품을 삭제한 후 분류를 삭제하여 주십시오.\\n\\n$str");
+
+ // 분류 삭제
+ $sql = " delete from {$g5['g5_shop_category_table']} where ca_id = '$ca_id' ";
+ sql_query($sql);
+}
+
+if(function_exists('get_admin_captcha_by'))
+ get_admin_captcha_by('remove');
+
+if ($w == "" || $w == "u")
+{
+ goto_url("./categoryform.php?w=u&ca_id=$ca_id&$qstr");
+} else {
+ goto_url("./categorylist.php?$qstr");
+}
\ No newline at end of file
diff --git a/adm/shop_admin/categorylist.php b/adm/shop_admin/categorylist.php
new file mode 100644
index 000000000..0ab194a90
--- /dev/null
+++ b/adm/shop_admin/categorylist.php
@@ -0,0 +1,290 @@
+전체목록';
+?>
+
+
+
+ 생성된 분류 수 개
+
+
+
+
+
+
+
+
+
+
+'');
+if ($config['cf_sms_use'] && $config['cf_icode_id'] && $config['cf_icode_pw']) {
+ $userinfo = get_icode_userinfo($config['cf_icode_id'], $config['cf_icode_pw']);
+}
+
+check_log_folder(G5_SHOP_PATH.'/inicis/key', false);
+
+$g5['title'] = '쇼핑몰설정';
+include_once (G5_ADMIN_PATH.'/admin.head.php');
+
+$pg_anchor = '
';
+
+// 무이자 할부 사용설정 필드 추가
+if(!isset($default['de_card_noint_use'])) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
+ ADD `de_card_noint_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `de_card_use` ", true);
+}
+
+// 모바일 관련상품 설정 필드추가
+if(!isset($default['de_mobile_rel_list_use'])) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
+ ADD `de_mobile_rel_list_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `de_rel_img_height`,
+ ADD `de_mobile_rel_list_skin` varchar(255) NOT NULL DEFAULT '' AFTER `de_mobile_rel_list_use`,
+ ADD `de_mobile_rel_img_width` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_rel_list_skin`,
+ ADD `de_mobile_rel_img_height` int(11) NOT NULL DEFAULT ' 0' AFTER `de_mobile_rel_img_width`", true);
+}
+
+// 신규회원 쿠폰 설정 필드 추가
+if(!isset($default['de_member_reg_coupon_use'])) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
+ ADD `de_member_reg_coupon_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `de_tax_flag_use`,
+ ADD `de_member_reg_coupon_term` int(11) NOT NULL DEFAULT '0' AFTER `de_member_reg_coupon_use`,
+ ADD `de_member_reg_coupon_price` int(11) NOT NULL DEFAULT '0' AFTER `de_member_reg_coupon_term` ", true);
+}
+
+// 신규회원 쿠폰 주문 최소금액 필드추가
+if(!isset($default['de_member_reg_coupon_minimum'])) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
+ ADD `de_member_reg_coupon_minimum` int(11) NOT NULL DEFAULT '0' AFTER `de_member_reg_coupon_price` ", true);
+}
+
+// lg 결제관련 필드 추가
+if(!isset($default['de_pg_service'])) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
+ ADD `de_pg_service` varchar(255) NOT NULL DEFAULT '' AFTER `de_sms_hp` ", true);
+}
+
+
+// inicis 필드 추가
+if(!isset($default['de_inicis_mid'])) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
+ ADD `de_inicis_mid` varchar(255) NOT NULL DEFAULT '' AFTER `de_kcp_site_key`,
+ ADD `de_inicis_admin_key` varchar(255) NOT NULL DEFAULT '' AFTER `de_inicis_mid` ", true);
+}
+
+// 모바일 초기화면 이미지 줄 수 필드 추가
+if(!isset($default['de_mobile_type1_list_row'])) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
+ ADD `de_mobile_type1_list_row` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_type1_list_mod`,
+ ADD `de_mobile_type2_list_row` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_type2_list_mod`,
+ ADD `de_mobile_type3_list_row` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_type3_list_mod`,
+ ADD `de_mobile_type4_list_row` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_type4_list_mod`,
+ ADD `de_mobile_type5_list_row` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_type5_list_mod` ", true);
+}
+
+// 모바일 관련상품 이미지 줄 수 필드 추가
+if(!isset($default['de_mobile_rel_list_mod'])) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
+ ADD `de_mobile_rel_list_mod` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_rel_list_skin` ", true);
+}
+
+// 모바일 검색상품 이미지 줄 수 필드 추가
+if(!isset($default['de_mobile_search_list_row'])) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
+ ADD `de_mobile_search_list_row` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_search_list_mod` ", true);
+}
+
+// PG 간펼결제 사용여부 필드 추가
+if(!isset($default['de_easy_pay_use'])) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
+ ADD `de_easy_pay_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `de_iche_use` ", true);
+}
+
+// 이니시스 삼성페이 사용여부 필드 추가
+if(!isset($default['de_samsung_pay_use'])) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
+ ADD `de_samsung_pay_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `de_easy_pay_use` ", true);
+}
+
+// 이니시스
+if(!isset($default['de_inicis_cartpoint_use'])) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
+ ADD `de_inicis_cartpoint_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `de_samsung_pay_use` ", true);
+}
+
+// 이니시스 lpay 사용여부 필드 추가
+if(!isset($default['de_inicis_lpay_use'])) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
+ ADD `de_inicis_lpay_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `de_samsung_pay_use` ", true);
+}
+
+// 이니시스 kakaopay 사용여부 필드 추가
+if(!isset($default['de_inicis_kakaopay_use'])) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
+ ADD `de_inicis_kakaopay_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `de_inicis_lpay_use` ", true);
+}
+
+// 카카오페이 필드 추가
+if(!isset($default['de_kakaopay_mid'])) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
+ ADD `de_kakaopay_mid` varchar(255) NOT NULL DEFAULT '' AFTER `de_tax_flag_use`,
+ ADD `de_kakaopay_key` varchar(255) NOT NULL DEFAULT '' AFTER `de_kakaopay_mid`,
+ ADD `de_kakaopay_enckey` varchar(255) NOT NULL DEFAULT '' AFTER `de_kakaopay_key`,
+ ADD `de_kakaopay_hashkey` varchar(255) NOT NULL DEFAULT '' AFTER `de_kakaopay_enckey`,
+ ADD `de_kakaopay_cancelpwd` varchar(255) NOT NULL DEFAULT '' AFTER `de_kakaopay_hashkey` ", true);
+}
+
+// 이니시스 웹결제 사인키 필드 추가
+if(!isset($default['de_inicis_sign_key'])) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
+ ADD `de_inicis_sign_key` varchar(255) NOT NULL DEFAULT '' AFTER `de_inicis_admin_key` ", true);
+}
+
+// 네이버페이 필드추가
+if(!isset($default['de_naverpay_mid'])) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
+ ADD `de_naverpay_mid` varchar(255) NOT NULL DEFAULT '' AFTER `de_kakaopay_cancelpwd`,
+ ADD `de_naverpay_cert_key` varchar(255) NOT NULL DEFAULT '' AFTER `de_naverpay_mid`,
+ ADD `de_naverpay_button_key` varchar(255) NOT NULL DEFAULT '' AFTER `de_naverpay_cert_key`,
+ ADD `de_naverpay_test` tinyint(4) NOT NULL DEFAULT '0' AFTER `de_naverpay_button_key`,
+ ADD `de_naverpay_mb_id` varchar(255) NOT NULL DEFAULT '' AFTER `de_naverpay_test`,
+ ADD `de_naverpay_sendcost` varchar(255) NOT NULL DEFAULT '' AFTER `de_naverpay_mb_id`", true);
+}
+
+// 유형별상품리스트 설정필드 추가
+if(!isset($default['de_listtype_list_skin'])) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
+ ADD `de_listtype_list_skin` varchar(255) NOT NULL DEFAULT '' AFTER `de_mobile_search_img_height`,
+ ADD `de_listtype_list_mod` int(11) NOT NULL DEFAULT '0' AFTER `de_listtype_list_skin`,
+ ADD `de_listtype_list_row` int(11) NOT NULL DEFAULT '0' AFTER `de_listtype_list_mod`,
+ ADD `de_listtype_img_width` int(11) NOT NULL DEFAULT '0' AFTER `de_listtype_list_row`,
+ ADD `de_listtype_img_height` int(11) NOT NULL DEFAULT '0' AFTER `de_listtype_img_width`,
+ ADD `de_mobile_listtype_list_skin` varchar(255) NOT NULL DEFAULT '' AFTER `de_listtype_img_height`,
+ ADD `de_mobile_listtype_list_mod` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_listtype_list_skin`,
+ ADD `de_mobile_listtype_list_row` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_listtype_list_mod`,
+ ADD `de_mobile_listtype_img_width` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_listtype_list_row`,
+ ADD `de_mobile_listtype_img_height` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_listtype_img_width` ", true);
+}
+
+// 임시저장 테이블이 없을 경우 생성
+if(!sql_query(" DESC {$g5['g5_shop_post_log_table']} ", false)) {
+ sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['g5_shop_post_log_table']}` (
+ `log_id` int(11) NOT NULL AUTO_INCREMENT,
+ `oid` bigint(20) unsigned NOT NULL,
+ `mb_id` varchar(255) NOT NULL DEFAULT '',
+ `post_data` text NOT NULL,
+ `ol_code` varchar(255) NOT NULL DEFAULT '',
+ `ol_msg` text NOT NULL,
+ `ol_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `ol_ip` varchar(25) NOT NULL DEFAULT '',
+ PRIMARY KEY (`log_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8; ", false);
+}
+
+
+// 현금영수증 발급 조건 추가
+if(!isset($default['de_taxsave_types'])) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
+ ADD `de_taxsave_types` set('account','vbank','transfer') NOT NULL DEFAULT 'account' AFTER `de_taxsave_use` ", true);
+}
+
+// 아이코드 토큰키 추가
+if( ! isset($config['cf_icode_token_key']) ){
+ $sql = "ALTER TABLE `{$g5['config_table']}`
+ ADD COLUMN `cf_icode_token_key` VARCHAR(100) NOT NULL DEFAULT '' AFTER `cf_icode_server_port`; ";
+ sql_query($sql, false);
+}
+
+// PG 간편결제 추가 ( NHN_KCP 네이버페이, 카카오페이 )
+if( ! isset($default['de_easy_pay_services']) ){
+ $sql = "ALTER TABLE `{$g5['g5_shop_default_table']}`
+ ADD COLUMN `de_easy_pay_services` VARCHAR(255) NOT NULL DEFAULT '' AFTER `de_easy_pay_use`; ";
+ sql_query($sql, false);
+}
+
+if( function_exists('pg_setting_check') ){
+ pg_setting_check(true);
+}
+
+if(!$default['de_kakaopay_cancelpwd']){
+ $default['de_kakaopay_cancelpwd'] = '1111';
+}
+?>
+
+
+
+
+
+'.PHP_EOL;
+ echo 'alert("PHP openssl 확장모듈이 설치되어 있지 않습니다.\n모바일 쇼핑몰 결제 때 사용되오니 openssl 확장 모듈을 설치하여 주십시오.");'.PHP_EOL;
+ echo ''.PHP_EOL;
+ }
+
+ if(!extension_loaded('soap') || !class_exists('SOAPClient')) {
+ echo ''.PHP_EOL;
+ }
+
+ $is_linux = true;
+ if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
+ $is_linux = false;
+
+ $exe = '/kcp/bin/';
+ if($is_linux) {
+ if(PHP_INT_MAX == 2147483647) // 32-bit
+ $exe .= 'pp_cli';
+ else
+ $exe .= 'pp_cli_x64';
+ } else {
+ $exe .= 'pp_cli_exe.exe';
+ }
+
+ echo module_exec_check(G5_SHOP_PATH.$exe, 'pp_cli');
+
+ // shop/kcp/log 디렉토리 체크 후 있으면 경고
+ if(is_dir(G5_SHOP_PATH.'/kcp/log') && is_writable(G5_SHOP_PATH.'/kcp/log')) {
+ echo ''.PHP_EOL;
+ }
+ }
+
+ // LG의 경우 log 디렉토리 체크
+ if($default['de_pg_service'] == 'lg') {
+ $log_path = G5_LGXPAY_PATH.'/lgdacom/log';
+
+ try {
+ if( ! is_dir($log_path) && is_writable(G5_LGXPAY_PATH.'/lgdacom/') ){
+ @mkdir($log_path, G5_DIR_PERMISSION);
+ @chmod($log_path, G5_DIR_PERMISSION);
+ }
+ } catch(Exception $e) {
+ }
+
+ if(!is_dir($log_path)) {
+
+ if( is_writable(G5_LGXPAY_PATH.'/lgdacom/') ){
+ // 디렉토리가 없다면 생성합니다. (퍼미션도 변경하구요.)
+ @mkdir($log_path, G5_DIR_PERMISSION);
+ @chmod($log_path, G5_DIR_PERMISSION);
+ }
+
+ if(!is_dir($log_path)){
+ echo ''.PHP_EOL;
+ }
+ }
+
+ if(is_writable($log_path)) {
+ if( function_exists('check_log_folder') ){
+ check_log_folder($log_path);
+ }
+ } else {
+ echo ''.PHP_EOL;
+ }
+ }
+
+ // 이니시스의 경우 log 디렉토리 체크
+ if($default['de_pg_service'] == 'inicis') {
+ if (!function_exists('xml_set_element_handler')) {
+ echo ''.PHP_EOL;
+ }
+
+ if (!function_exists('openssl_get_publickey')) {
+ echo ''.PHP_EOL;
+ }
+
+ if (!function_exists('socket_create')) {
+ echo ''.PHP_EOL;
+ }
+
+ $log_path = G5_SHOP_PATH.'/inicis/log';
+
+ try {
+ if( ! is_dir($log_path) && is_writable(G5_SHOP_PATH.'/inicis/') ){
+ @mkdir($log_path, G5_DIR_PERMISSION);
+ @chmod($log_path, G5_DIR_PERMISSION);
+ }
+ } catch(Exception $e) {
+ }
+
+ if(!is_dir($log_path)) {
+ echo ''.PHP_EOL;
+ } else {
+ if(!is_writable($log_path)) {
+ echo ''.PHP_EOL;
+ } else {
+ if( function_exists('check_log_folder') && is_writable($log_path) ){
+ check_log_folder($log_path);
+ }
+ }
+ }
+ }
+
+ // 카카오페이의 경우 log 디렉토리 체크
+ if($default['de_kakaopay_mid'] && $default['de_kakaopay_key'] && $default['de_kakaopay_enckey'] && $default['de_kakaopay_hashkey'] && $default['de_kakaopay_cancelpwd']) {
+ $log_path = G5_SHOP_PATH.'/kakaopay/log';
+
+ if(!is_dir($log_path)) {
+ echo ''.PHP_EOL;
+ } else {
+ if(!is_writable($log_path)) {
+ echo ''.PHP_EOL;
+ } else {
+ if( function_exists('check_log_folder') && is_writable($log_path) ){
+ check_log_folder($log_path);
+ }
+ }
+ }
+ }
+}
+
+include_once (G5_ADMIN_PATH.'/admin.tail.php');
\ No newline at end of file
diff --git a/adm/shop_admin/configformupdate.php b/adm/shop_admin/configformupdate.php
new file mode 100644
index 000000000..be2128bef
--- /dev/null
+++ b/adm/shop_admin/configformupdate.php
@@ -0,0 +1,467 @@
+ 포인트 사용
+sql_query(" update {$g5['config_table']} set cf_use_point = '{$cf_use_point}' ");
+
+// LG, 아이코드 설정
+$sql = " update {$g5['config_table']}
+ set cf_sms_use = '{$cf_sms_use}',
+ cf_sms_type = '{$cf_sms_type}',
+ cf_icode_id = '{$cf_icode_id}',
+ cf_icode_pw = '{$cf_icode_pw}',
+ cf_icode_server_ip = '{$_POST['cf_icode_server_ip']}',
+ cf_icode_server_port = '{$_POST['cf_icode_server_port']}',
+ cf_icode_token_key = '{$cf_icode_token_key}',
+ cf_lg_mid = '{$cf_lg_mid}',
+ cf_lg_mert_key = '{$cf_lg_mert_key}' ";
+sql_query($sql);
+
+run_event('shop_admin_configformupdate');
+
+if( $warning_msg ){
+ alert($warning_msg, "./configform.php");
+} else {
+ goto_url("./configform.php");
+}
\ No newline at end of file
diff --git a/adm/shop_admin/couponform.php b/adm/shop_admin/couponform.php
new file mode 100644
index 000000000..be26be6f3
--- /dev/null
+++ b/adm/shop_admin/couponform.php
@@ -0,0 +1,295 @@
+'',
+'cp_subject'=>'',
+'cp_target'=>'',
+'mb_id'=>'',
+'cp_type'=>'',
+'cp_price'=>'',
+'cp_trunc'=>'',
+'cp_minimum'=>'',
+'cp_maximum'=>'',
+);
+
+$g5['title'] = '쿠폰관리';
+
+if ($w == 'u') {
+ $html_title = '쿠폰 수정';
+
+ $sql = " select * from {$g5['g5_shop_coupon_table']} where cp_id = '$cp_id' ";
+ $cp = sql_fetch($sql);
+ if (!$cp['cp_id']) alert('등록된 자료가 없습니다.');
+}
+else
+{
+ $html_title = '쿠폰 입력';
+ $cp['cp_start'] = G5_TIME_YMD;
+ $cp['cp_end'] = date('Y-m-d', (G5_SERVER_TIME + 86400 * 7));
+}
+
+if($cp['cp_method'] == 1) {
+ $cp_target_label = '적용분류';
+ $cp_target_btn = '분류검색';
+} else {
+ $cp_target_label = '적용상품';
+ $cp_target_btn = '상품검색';
+}
+
+include_once (G5_ADMIN_PATH.'/admin.head.php');
+include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');
+?>
+
+
+
+
+
+ $_POST['cp_end'])
+ alert('사용 시작일은 종료일 이전으로 입력해 주십시오.');
+
+if($_POST['cp_end'] < G5_TIME_YMD)
+ alert('종료일은 오늘('.G5_TIME_YMD.')이후로 입력해 주십시오.');
+
+if(!$_POST['cp_price']) {
+ if($_POST['cp_type'])
+ alert('할인비율을 입력해 주십시오.');
+ else
+ alert('할인금액을 입력해 주십시오.');
+}
+
+if( (int) $_POST['cp_price'] < 0 ){
+ alert('할인금액 또는 할인비율은 음수를 입력할수 없습니다.');
+}
+
+if($_POST['cp_type'] && ($_POST['cp_price'] < 1 || $_POST['cp_price'] > 99))
+ alert('할인비율을 1과 99사이 값으로 입력해 주십시오.');
+
+if($_POST['cp_method'] == 0) {
+ $sql = " select count(*) as cnt from {$g5['g5_shop_item_table']} where it_id = '$cp_target' and it_nocoupon = '0' ";
+ $row = sql_fetch($sql);
+ if(!$row['cnt'])
+ alert('입력하신 상품코드는 존재하지 않는 코드이거나 쿠폰적용안함으로 설정된 상품입니다.');
+} else if($_POST['cp_method'] == 1) {
+ $sql = " select count(*) as cnt from {$g5['g5_shop_category_table']} where ca_id = '$cp_target' and ca_nocoupon = '0' ";
+ $row = sql_fetch($sql);
+ if(!$row['cnt'])
+ alert('입력하신 분류코드는 존재하지 않는 분류코드이거나 쿠폰적용안함으로 설정된 분류입니다.');
+}
+
+if($w == '') {
+ if($_POST['chk_all_mb']) {
+ $mb_id = '전체회원';
+ } else {
+ $sql = " select mb_id from {$g5['member_table']} where mb_id = '{$_POST['mb_id']}' and mb_leave_date = '' and mb_intercept_date = '' ";
+ $row = sql_fetch($sql);
+ if(!$row['mb_id'])
+ alert('입력하신 회원아이디는 존재하지 않거나 탈퇴 또는 차단된 회원아이디입니다.');
+
+ $mb_id = $_POST['mb_id'];
+ }
+
+ $j = 0;
+ do {
+ $cp_id = get_coupon_id();
+
+ $sql3 = " select count(*) as cnt from {$g5['g5_shop_coupon_table']} where cp_id = '$cp_id' ";
+ $row3 = sql_fetch($sql3);
+
+ if(!$row3['cnt'])
+ break;
+ else {
+ if($j > 20)
+ die('Coupon ID Error');
+ }
+
+ $j++;
+
+ } while(1);
+
+ $sql = " INSERT INTO {$g5['g5_shop_coupon_table']}
+ ( cp_id, cp_subject, cp_method, cp_target, mb_id, cp_start, cp_end, cp_type, cp_price, cp_trunc, cp_minimum, cp_maximum, cp_datetime )
+ VALUES
+ ( '$cp_id', '$cp_subject', '$cp_method', '$cp_target', '$mb_id', '$cp_start', '$cp_end', '$cp_type', '$cp_price', '$cp_trunc', '$cp_minimum', '$cp_maximum', '".G5_TIME_YMDHIS."' ) ";
+
+ sql_query($sql);
+} else if($w == 'u') {
+ $sql = " select * from {$g5['g5_shop_coupon_table']} where cp_id = '$cp_id' ";
+ $cp = sql_fetch($sql);
+
+ if(!$cp['cp_id'])
+ alert('쿠폰정보가 존재하지 않습니다.', './couponlist.php');
+
+ if($_POST['chk_all_mb']) {
+ $mb_id = '전체회원';
+ }
+
+ $sql = " update {$g5['g5_shop_coupon_table']}
+ set cp_subject = '$cp_subject',
+ cp_method = '$cp_method',
+ cp_target = '$cp_target',
+ mb_id = '$mb_id',
+ cp_start = '$cp_start',
+ cp_end = '$cp_end',
+ cp_type = '$cp_type',
+ cp_price = '$cp_price',
+ cp_trunc = '$cp_trunc',
+ cp_maximum = '$cp_maximum',
+ cp_minimum = '$cp_minimum'
+ where cp_id = '$cp_id' ";
+ sql_query($sql);
+}
+
+// 쿠폰생성알림 발송
+if($w == '' && ($_POST['cp_sms_send'] || $_POST['cp_email_send'])) {
+ include_once(G5_LIB_PATH.'/mailer.lib.php');
+
+ $sms_count = 0;
+ $arr_send_list = array();
+ $sms_messages = array();
+
+ if($_POST['chk_all_mb']) {
+ $sql = " select mb_id, mb_name, mb_hp, mb_email, mb_mailling, mb_sms
+ from {$g5['member_table']}
+ where mb_leave_date = ''
+ and mb_intercept_date = ''
+ and ( mb_mailling = '1' or mb_sms = '1' )
+ and mb_id <> '{$config['cf_admin']}' ";
+ } else {
+ $sql = " select mb_id, mb_name, mb_hp, mb_email, mb_mailling, mb_sms
+ from {$g5['member_table']}
+ where mb_id = '$mb_id' ";
+ }
+
+ $result = sql_query($sql);
+
+ for($i=0; $row = sql_fetch_array($result); $i++) {
+ $arr_send_list[] = $row;
+ }
+
+ $count = count($arr_send_list);
+
+ for($i=0; $i<$count; $i++) {
+ if(!$arr_send_list[$i]['mb_id'])
+ continue;
+
+ // SMS
+ if($config['cf_sms_use'] == 'icode' && $_POST['cp_sms_send'] && $arr_send_list[$i]['mb_hp'] && $arr_send_list[$i]['mb_sms']) {
+ $sms_contents = $cp_subject.' 쿠폰이 '.get_text($arr_send_list[$i]['mb_name']).'님께 발행됐습니다. 쿠폰만료 : '.$cp_end.' '.str_replace('http://', '', G5_URL);
+
+ if($sms_contents) {
+ $receive_number = preg_replace("/[^0-9]/", "", $arr_send_list[$i]['mb_hp']); // 수신자번호
+ $send_number = preg_replace("/[^0-9]/", "", $default['de_admin_company_tel']); // 발신자번호
+
+ if($receive_number)
+ $sms_messages[] = array('recv' => $receive_number, 'send' => $send_number, 'cont' => $sms_contents);
+ }
+ }
+
+ // E-MAIL
+ if($config['cf_email_use'] && $_POST['cp_email_send'] && $arr_send_list[$i]['mb_email'] && $arr_send_list[$i]['mb_mailling']) {
+ $mb_name = get_text($arr_send_list[$i]['mb_name']);
+ switch($cp_method) {
+ case 2:
+ $coupon_method = '결제금액할인';
+ break;
+ case 3:
+ $coupon_method = '배송비할인';
+ break;
+ default:
+ $coupon_method = '개별상품할인';
+ break;
+ }
+ $contents = '쿠폰명 : '.$cp_subject.'
';
+ $contents .= '적용대상 : '.$coupon_method.'
';
+ $contents .= '쿠폰만료 : '.$cp_end;
+
+ $title = $config['cf_title'].' - 쿠폰발행알림 메일';
+ $email = $arr_send_list[$i]['mb_email'];
+
+ ob_start();
+ include G5_SHOP_PATH.'/mail/couponmail.mail.php';
+ $content = ob_get_contents();
+ ob_end_clean();
+
+ mailer($config['cf_admin_email_name'], $config['cf_admin_email'], $email, $title, $content, 1);
+ }
+ }
+
+ // SMS발송
+ $sms_count = count($sms_messages);
+ if($sms_count > 0) {
+ if($config['cf_sms_type'] == 'LMS') {
+ include_once(G5_LIB_PATH.'/icode.lms.lib.php');
+
+ $port_setting = get_icode_port_type($config['cf_icode_id'], $config['cf_icode_pw']);
+
+ // SMS 모듈 클래스 생성
+ if($port_setting !== false) {
+ $SMS = new LMS;
+ $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $port_setting);
+
+ for($s=0; $s<$sms_count; $s++) {
+ $strDest = array();
+ $strDest[] = $sms_messages[$s]['recv'];
+ $strCallBack = $sms_messages[$s]['send'];
+ $strCaller = iconv_euckr(trim($default['de_admin_company_name']));
+ $strSubject = '';
+ $strURL = '';
+ $strData = iconv_euckr($sms_messages[$s]['cont']);
+ $strDate = '';
+ $nCount = count($strDest);
+
+ $res = $SMS->Add($strDest, $strCallBack, $strCaller, $strSubject, $strURL, $strData, $strDate, $nCount);
+
+ $SMS->Send();
+ $SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
+ }
+ }
+ } else {
+ include_once(G5_LIB_PATH.'/icode.sms.lib.php');
+
+ $SMS = new SMS; // SMS 연결
+ $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']);
+
+ for($s=0; $s<$sms_count; $s++) {
+ $recv_number = $sms_messages[$s]['recv'];
+ $send_number = $sms_messages[$s]['send'];
+ $sms_content = iconv_euckr($sms_messages[$s]['cont']);
+
+ $SMS->Add($recv_number, $send_number, $config['cf_icode_id'], $sms_content, "");
+ }
+
+ $SMS->Send();
+ $SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
+ }
+ }
+}
+
+goto_url('./couponlist.php');
\ No newline at end of file
diff --git a/adm/shop_admin/couponlist.php b/adm/shop_admin/couponlist.php
new file mode 100644
index 000000000..e50153ef6
--- /dev/null
+++ b/adm/shop_admin/couponlist.php
@@ -0,0 +1,187 @@
+
+
+ 전체 개
+
+
+
+
+
+
+
+
+
+
+
+ '{$config['cf_admin']}' and mb_leave_date = '' and mb_intercept_date ='' ";
+
+if($mb_name){
+ $mb_name = preg_replace('/\!\?\*$#<>()\[\]\{\}/i', '', strip_tags($mb_name));
+ $sql_where .= " and mb_name like '%".sql_real_escape_string($mb_name)."%' ";
+}
+
+// 테이블의 전체 레코드수만 얻음
+$sql = " select count(*) as cnt " . $sql_common . $sql_where;
+$row = sql_fetch($sql);
+$total_count = $row['cnt'];
+
+$rows = $config['cf_page_rows'];
+$total_page = ceil($total_count / $rows); // 전체 페이지 계산
+if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
+$from_record = ($page - 1) * $rows; // 시작 열을 구함
+
+$sql = " select mb_id, mb_name
+ $sql_common
+ $sql_where
+ order by mb_id
+ limit $from_record, $rows ";
+$result = sql_query($sql);
+
+$qstr1 = 'mb_name='.urlencode($mb_name);
+?>
+
+
+
쿠폰 적용 회원선택
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
쿠폰 적용 선택
+
+
+
+ 쿠폰을 적용할 선택하세요.
+ 많을 경우에는 검색 기능을 이용하세요.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+'',
+'cz_subject'=>'',
+'cp_target'=>'',
+'cp_price'=>'',
+'cp_trunc'=>'',
+'cp_type'=>'',
+'mb_id'=>'',
+'cz_type'=>'',
+'cz_point'=>'',
+'cp_price'=>'',
+'cz_file'=>'',
+'cp_minimum'=>'',
+'cp_maximum'=>'',
+);
+
+auth_check_menu($auth, $sub_menu, "w");
+
+$g5['title'] = '쿠폰존 쿠폰관리';
+
+if ($w == 'u') {
+ $html_title = '쿠폰 수정';
+
+ $sql = " select * from {$g5['g5_shop_coupon_zone_table']} where cz_id = '$cz_id' ";
+ $cp = sql_fetch($sql);
+ if (!$cp['cz_id']) alert('등록된 자료가 없습니다.');
+}
+else
+{
+ $html_title = '쿠폰 입력';
+ $cp['cz_start'] = G5_TIME_YMD;
+ $cp['cz_end'] = date('Y-m-d', (G5_SERVER_TIME + 86400 * 15));
+ $cp['cz_period'] = 15;
+}
+
+if($cp['cp_method'] == 1) {
+ $cp_target_label = '적용분류';
+ $cp_target_btn = '분류검색';
+} else {
+ $cp_target_label = '적용상품';
+ $cp_target_btn = '상품검색';
+}
+
+include_once (G5_ADMIN_PATH.'/admin.head.php');
+include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');
+?>
+
+
+
+
+
+ $_POST['cz_end'])
+ alert('사용 시작일은 종료일 이전으로 입력해 주십시오.');
+
+if($_POST['cz_end'] < G5_TIME_YMD)
+ alert('종료일은 오늘('.G5_TIME_YMD.')이후로 입력해 주십시오.');
+
+if($_POST['cz_type'] && !$_POST['cz_point'])
+ alert('쿠폰교환 포인트를 입력해 주십시오.');
+
+if(!$_POST['cz_period'])
+ alert('쿠폰사용기한을 입력해 주십시오.');
+
+if( isset($_FILES['cp_img']) && !empty($_FILES['cp_img']['name']) ){
+ if( !preg_match('/\.(gif|jpe?g|bmp|png)$/i', $_FILES['cp_img']['name']) ){
+ alert("이미지 파일만 업로드 할수 있습니다.");
+ }
+
+ $timg = @getimagesize($_FILES['cp_img']['tmp_name']);
+ if ($timg['2'] < 1 || $timg['2'] > 16){
+ alert("이미지 파일만 업로드 할수 있습니다.");
+ }
+}
+
+if($_POST['cp_method'] == 0 && !$_POST['cp_target'])
+ alert('적용상품을 입력해 주십시오.');
+
+if($_POST['cp_method'] == 1 && !$_POST['cp_target'])
+ alert('적용분류를 입력해 주십시오.');
+
+if(!$_POST['cp_price']) {
+ if($_POST['cp_type'])
+ alert('할인비율을 입력해 주십시오.');
+ else
+ alert('할인금액을 입력해 주십시오.');
+}
+
+if( (int) $_POST['cp_price'] < 0 ){
+ alert('할인금액 또는 할인비율은 음수를 입력할수 없습니다.');
+}
+
+if($_POST['cp_type'] && ($_POST['cp_price'] < 1 || $_POST['cp_price'] > 99))
+ alert('할인비율을은 1과 99사이 값으로 입력해 주십시오.');
+
+if($_POST['cp_method'] == 0) {
+ $sql = " select count(*) as cnt from {$g5['g5_shop_item_table']} where it_id = '$cp_target' and it_nocoupon = '0' ";
+ $row = sql_fetch($sql);
+ if(!$row['cnt'])
+ alert('입력하신 상품코드는 존재하지 않는 코드이거나 쿠폰적용안함으로 설정된 상품입니다.');
+} else if($_POST['cp_method'] == 1) {
+ $sql = " select count(*) as cnt from {$g5['g5_shop_category_table']} where ca_id = '$cp_target' and ca_nocoupon = '0' ";
+ $row = sql_fetch($sql);
+ if(!$row['cnt'])
+ alert('입력하신 분류코드는 존재하지 않는 분류코드이거나 쿠폰적용안함으로 설정된 분류입니다.');
+}
+
+$sql_common = " cz_subject = '{$_POST['cz_subject']}',
+ cz_type = '{$_POST['cz_type']}',
+ cz_start = '{$_POST['cz_start']}',
+ cz_end = '{$_POST['cz_end']}',
+ cz_period = '{$_POST['cz_period']}',
+ cz_point = '{$_POST['cz_point']}',
+ cp_method = '{$_POST['cp_method']}',
+ cp_target = '{$_POST['cp_target']}',
+ cp_price = '{$_POST['cp_price']}',
+ cp_type = '{$_POST['cp_type']}',
+ cp_trunc = '{$_POST['cp_trunc']}',
+ cp_minimum = '{$_POST['cp_minimum']}',
+ cp_maximum = '{$_POST['cp_maximum']}' ";
+
+if($w == '') {
+ if(!$_FILES['cp_img']['name'])
+ alert('쿠폰이미지를 업로드해 주십시오.');
+
+ $sql = " INSERT INTO {$g5['g5_shop_coupon_zone_table']}
+ set $sql_common,
+ cz_datetime = '".G5_TIME_YMDHIS."' ";
+ sql_query($sql, true);
+
+ $cz_id = sql_insert_id();
+} else if($w == 'u') {
+ $sql = " select * from {$g5['g5_shop_coupon_zone_table']} where cz_id = '$cz_id' ";
+ $cp = sql_fetch($sql);
+
+ if(! (isset($cp['cz_id']) && $cp['cz_id']))
+ alert('쿠폰정보가 존재하지 않습니다.', './couponzonelist.php');
+
+ if ((isset($_POST['cp_img_del']) && $_POST['cp_img_del']) && $cp['cz_file']) {
+ @unlink(G5_DATA_PATH."/coupon/{$cp['cz_file']}");
+ $cp['cz_file'] = '';
+ }
+
+ if(!$cp['cz_file'] && !$_FILES['cp_img']['name'])
+ alert('쿠폰이미지를 업로드해 주십시오.');
+
+ $sql = " update {$g5['g5_shop_coupon_zone_table']}
+ set $sql_common
+ where cz_id = '$cz_id' ";
+ sql_query($sql);
+}
+
+// 이미지업로드
+if($_FILES['cp_img']['tmp_name']) {
+ preg_match('#.+\.([a-z]+)$#', $_FILES['cp_img']['name'], $m);
+ $filename = date('YmdHis').(microtime(true) * 10000).'.'.strtolower($m[1]);
+
+ upload_file($_FILES['cp_img']['tmp_name'], $filename, G5_DATA_PATH."/coupon");
+
+ $sql = " update {$g5['g5_shop_coupon_zone_table']}
+ set cz_file = '$filename'
+ where cz_id = '$cz_id' ";
+ sql_query($sql);
+}
+
+goto_url('./couponzonelist.php?'.$qstr);
\ No newline at end of file
diff --git a/adm/shop_admin/couponzonelist.php b/adm/shop_admin/couponzonelist.php
new file mode 100644
index 000000000..f4200540c
--- /dev/null
+++ b/adm/shop_admin/couponzonelist.php
@@ -0,0 +1,177 @@
+
+
+
+ 전체 개
+
+
+
+
+
+
+
+
+
+
+
+
주문현황
+
입금완료미배송내역
+
미입금주문내역
+
사용후기
+
상품문의
+';
+
+// 주문상태에 따른 합계 금액
+function get_order_status_sum($status)
+{
+ global $g5;
+
+ $sql = " select count(*) as cnt,
+ sum(od_cart_price + od_send_cost + od_send_cost2 - od_cancel_price) as price
+ from {$g5['g5_shop_order_table']}
+ where od_status = '$status' ";
+ $row = sql_fetch($sql);
+
+ $info = array();
+ $info['count'] = (int)$row['cnt'];
+ $info['price'] = (int)$row['price'];
+ $info['href'] = './orderlist.php?od_status='.urlencode($status);
+
+ return $info;
+}
+
+// 일자별 주문 합계 금액
+function get_order_date_sum($date)
+{
+ global $g5;
+
+ $sql = " select sum(od_cart_price + od_send_cost + od_send_cost2) as orderprice,
+ sum(od_cancel_price) as cancelprice
+ from {$g5['g5_shop_order_table']}
+ where SUBSTRING(od_time, 1, 10) = '$date' ";
+ $row = sql_fetch($sql);
+
+ $info = array();
+ $info['order'] = (int)$row['orderprice'];
+ $info['cancel'] = (int)$row['cancelprice'];
+
+ return $info;
+}
+
+// 일자별 결제수단 주문 합계 금액
+function get_order_settle_sum($date)
+{
+ global $g5, $default;
+
+ $case = array('신용카드', '계좌이체', '가상계좌', '무통장', '휴대폰');
+ $info = array();
+
+ // 결제수단별 합계
+ foreach($case as $val)
+ {
+ $sql = " select sum(od_cart_price + od_send_cost + od_send_cost2 - od_receipt_point - od_cart_coupon - od_coupon - od_send_coupon) as price,
+ count(*) as cnt
+ from {$g5['g5_shop_order_table']}
+ where SUBSTRING(od_time, 1, 10) = '$date'
+ and od_settle_case = '$val' ";
+ $row = sql_fetch($sql);
+
+ $info[$val]['price'] = (int)$row['price'];
+ $info[$val]['count'] = (int)$row['cnt'];
+ }
+
+ // 포인트 합계
+ $sql = " select sum(od_receipt_point) as price,
+ count(*) as cnt
+ from {$g5['g5_shop_order_table']}
+ where SUBSTRING(od_time, 1, 10) = '$date'
+ and od_receipt_point > 0 ";
+ $row = sql_fetch($sql);
+ $info['포인트']['price'] = (int)$row['price'];
+ $info['포인트']['count'] = (int)$row['cnt'];
+
+ // 쿠폰 합계
+ $sql = " select sum(od_cart_coupon + od_coupon + od_send_coupon) as price,
+ count(*) as cnt
+ from {$g5['g5_shop_order_table']}
+ where SUBSTRING(od_time, 1, 10) = '$date'
+ and ( od_cart_coupon > 0 or od_coupon > 0 or od_send_coupon > 0 ) ";
+ $row = sql_fetch($sql);
+ $info['쿠폰']['price'] = (int)$row['price'];
+ $info['쿠폰']['count'] = (int)$row['cnt'];
+
+ return $info;
+}
+
+function get_max_value($arr)
+{
+ foreach($arr as $key => $val)
+ {
+ if(is_array($val))
+ {
+ $arr[$key] = get_max_value($val);
+ }
+ }
+
+ sort($arr);
+
+ return array_pop($arr);
+}
+?>
+
+
+
+ 주문현황
+
+
+ =0; $i--) {
+ $date = date('Y-m-d', strtotime('-'.$i.' days', G5_SERVER_TIME));
+
+ $x_val[] = $date;
+ $arr_order[] = get_order_date_sum($date);
+ }
+
+ $max_y = get_max_value($arr_order);
+ $max_y = ceil(($max_y) / 1000) * 1000;
+ $y_val = array();
+ $y_val[] = $max_y;
+
+ for($i=4; $i>=1; $i--) {
+ $y_val[] = $max_y * (($i * 2) / 10);
+ }
+
+ $max_height = 230;
+ $h_val = array();
+ $js_val = array();
+ $offset = 10; // 금액이 상대적으로 작아 높이가 0일 때 기본 높이로 사용
+ foreach($arr_order as $val) {
+ if($val['order'] > 0)
+ $h1 = intval(($max_height * $val['order']) / $max_y) + $offset;
+ else
+ $h1 = 0;
+
+ if($val['cancel'] > 0)
+ $h2 = intval(($max_height * $val['cancel']) / $max_y) + $offset;
+ else
+ $h2 = 0 ;
+
+ $h_val['order'][] = $h1;
+ $h_val['cancel'][] = $h2;
+ }
+ ?>
+
+
+
+
+
+
+ 처리할 주문
+
+
+
+
+
+
+ | 상태변경 |
+ 건수 |
+ 금액 |
+
+
+
+
+
+ | 주문 -> 입금 |
+ |
+ |
+
+
+
+ | 입금 -> 준비 |
+ |
+ |
+
+
+
+ | 준비 -> 배송 |
+ |
+ |
+
+
+
+ | 배송 -> 완료 |
+ |
+ |
+
+
+
+
+
+
+
+ 재고현황
+
+
+ 0);
+ if ($config['cf_sms_use'] && $config['cf_icode_id'] && $config['cf_icode_pw']) {
+ $userinfo = get_icode_userinfo($config['cf_icode_id'], $config['cf_icode_pw']);
+ }
+ ?>
+
+
+
+
+ | 재고부족 상품 |
+ 재고부족 옵션 |
+ SMS 잔여금액 |
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+ 결제수단별 주문현황
+
+
+
+
+
+
+ | 구분 |
+ =0; $i--) {
+ $date = date("Y-m-d", strtotime('-'.$i.' days', G5_SERVER_TIME));
+ $info[$date] = get_order_settle_sum($date);
+
+ $day = substr($date, 5, 5).' ('.get_yoil($date).')';
+ $info_key[] = $date;
+ ?>
+ |
+
+
+
+
+ | 건수 |
+ 금액 |
+
+
+
+
+
+
+ |
+
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+ 1:1문의
+
+
+
+
+
+ -
+
+
+
+
+ 자료가 없습니다.';
+ ?>
+
+
+
+
+
+
+
+ 상품문의
+
+
+
+
+
+ -
+
+
+
+ 자료가 없습니다.';
+ ?>
+
+
+
+
+
+
+
+ 사용후기
+
+
+
+
+
+ -
+
+
+
+ 자료가 없습니다.';
+ ?>
+
+
+
+
+
+
+
+
+
+ $item_price)
+ continue;
+
+ $dc = 0;
+ if($cp['cp_type']) {
+ $dc = floor(($item_price * ($cp['cp_price'] / 100)) / $cp['cp_trunc']) * $cp['cp_trunc'];
+ } else {
+ $dc = $cp['cp_price'];
+ }
+
+ if($cp['cp_maximum'] && $dc > $cp['cp_maximum'])
+ $dc = $cp['cp_maximum'];
+
+ if($item_price < $dc)
+ continue;
+
+ $tot_it_cp_price += $dc;
+ $arr_it_cp_prc[$it_id] = $dc;
+ }
+
+ $tot_od_price -= $tot_it_cp_price;
+
+ // 주문쿠폰
+ if(isset($data['od_cp_id']) && $data['od_cp_id']) {
+ $sql = " select cp_id, cp_type, cp_price, cp_trunc, cp_minimum, cp_maximum
+ from {$g5['g5_shop_coupon_table']}
+ where cp_id = '{$data['od_cp_id']}'
+ and mb_id IN ( '{$od['mb_id']}', '전체회원' )
+ and cp_method = '2' ";
+ $cp = sql_fetch($sql);
+
+ // 사용한 쿠폰인지
+ $cp_used = is_used_coupon($od['mb_id'], $cp['cp_id']);
+
+ $dc = 0;
+ if(!$cp_used && $cp['cp_id'] && ($cp['cp_minimum'] <= $tot_od_price)) {
+ if($cp['cp_type']) {
+ $dc = floor(($tot_od_price * ($cp['cp_price'] / 100)) / $cp['cp_trunc']) * $cp['cp_trunc'];
+ } else {
+ $dc = $cp['cp_price'];
+ }
+
+ if($cp['cp_maximum'] && $dc > $cp['cp_maximum'])
+ $dc = $cp['cp_maximum'];
+
+ $tot_od_cp_price = $dc;
+ $tot_od_price -= $tot_od_cp_price;
+ }
+ }
+
+ $tot_cp_price = $tot_it_cp_price + $tot_od_cp_price;
+}
+
+// 배송비
+$od_send_cost = get_sendcost($od['cart_id']);
+
+$tot_sc_cp_price = 0;
+if($od['mb_id'] && $od_send_cost > 0) {
+ // 배송쿠폰
+ if($data['sc_cp_id']) {
+ $sql = " select cp_id, cp_type, cp_price, cp_trunc, cp_minimum, cp_maximum
+ from {$g5['g5_shop_coupon_table']}
+ where cp_id = '{$data['sc_cp_id']}'
+ and mb_id IN ( '{$od['mb_id']}', '전체회원' )
+ and cp_method = '3' ";
+ $cp = sql_fetch($sql);
+
+ // 사용한 쿠폰인지
+ $cp_used = is_used_coupon($od['mb_id'], $cp['cp_id']);
+
+ $dc = 0;
+ if(!$cp_used && $cp['cp_id'] && ($cp['cp_minimum'] <= $tot_od_price)) {
+ if($cp['cp_type']) {
+ $dc = floor(($send_cost * ($cp['cp_price'] / 100)) / $cp['cp_trunc']) * $cp['cp_trunc'];
+ } else {
+ $dc = $cp['cp_price'];
+ }
+
+ if($cp['cp_maximum'] && $dc > $cp['cp_maximum'])
+ $dc = $cp['cp_maximum'];
+
+ if($dc > $send_cost)
+ $dc = $send_cost;
+
+ $tot_sc_cp_price = $dc;
+ }
+ }
+}
+
+// 추가배송비
+$od_send_cost2 = isset($data['od_send_cost2']) ? (int) $data['od_send_cost2'] : 0;
+
+// 포인트
+$od_temp_point = isset($data['od_temp_point']) ? (int) $data['od_temp_point'] : 0;
+
+$order_price = $tot_od_price + $od_send_cost + $od_send_cost2 - $tot_sc_cp_price - $od_temp_point;
+
+// 상품목록
+$sql = " select it_id, it_name, ct_notax, ct_send_cost, it_sc_type $sql_common group by it_id order by ct_id ";
+$result = sql_query($sql);
+
+$pg_anchor = '
';
+?>
+
+
+ 주문상품 목록
+
+
+
+ 주문일시 ()
+ |
+ 주문합계 원
+
+
+
+
+
+ 주문 상품 목록
+
+
+ | 상품명 |
+ 옵션항목 |
+ 상태 |
+ 수량 |
+ 판매가 |
+ 소계 |
+ 쿠폰 |
+ 포인트 |
+ 배송비 |
+ 포인트반영 |
+ 재고반영 |
+
+
+
+
+
+
+ |
+
+
+ |
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+ 주문결제 내역
+
+
+ 0)
+ $s_receipt_way .= "+포인트";
+ ?>
+
+
+
+
+
+
+
+
+ '' and P_TYPE in ('CARD', 'ISP', 'BANK') and P_MID <> '' and P_STATUS = '00' and oid = '".$od['od_id']."' ";
+ $results = sql_query($sql);
+
+ $tmps = array();
+
+ while( $tmp=sql_fetch_array($results) ){
+
+ $sql = " select od_id from {$g5['g5_shop_order_table']} where od_id = '".$tmp['oid']."' and od_tno = '".$tmp['P_TID']."' ";
+ $exist_od = sql_fetch($sql);
+
+ if( $exist_od['od_id'] ) continue;
+
+ $sql = " select pp_id from {$g5['g5_shop_personalpay_table']} where pp_id = '".$tmp['oid']."' and pp_tno = '".$tmp['P_TID']."' ";
+ $exist_od = sql_fetch($sql);
+
+ if( $exist_od['od_id'] ) continue;
+
+ $tmps[] = $tmp;
+ }
+
+ if( $tmps ) {
+ ?>
+ 이니시스 결제 로그
+
+
실결제로 결제된 경우 반드시 이니시스 상점 관리자에서 해당 결제건을 확인 후에 주문을 처리해 주세요.
+
+
+
+ 이니시스 결제 로그
+
+
+
+ | 주문번호 |
+ |
+
+
+ | 결제 TID |
+ |
+
+
+ | 결제 MID |
+ |
+
+
+ | 결제 시간 |
+ |
+
+
+ | 결제 수단 |
+ |
+
+
+ | 결제된 금액 |
+ |
+
+
+
+
+
+
+
+ 주문자/배송지 정보
+
+
+
+
+
+ 주문하신 분
+
+
+
+ 주문자/배송지 정보
+
+
+
+
+
+
+ | 주문하신 분 이름 |
+ |
+
+
+ | 주문하신 분 전화번호 |
+ |
+
+
+ | 주문하신 분 핸드폰 |
+ |
+
+
+ | 주문하시는 분 주소 |
+
+
+
+
+
+ |
+
+
+ | 주문하신 분 E-mail |
+ |
+
+
+
+
+
+
+
+ 받으시는 분
+
+
+
+ 받으시는 분 정보
+
+
+
+
+
+
+ | 받으시는 분 이름 |
+ |
+
+
+ | 받으시는 분 전화번호 |
+ |
+
+
+ | 받으시는 분 핸드폰 |
+ |
+
+
+ | 받으시는 분 주소 |
+
+
+
+
+
+ |
+
+
+
+
+ | 희망배송일 |
+ () |
+
+
+
+ | 전달 메세지 |
+ |
+
+
+
+
+
+
+
+
+
+
+ $item_price)
+ continue;
+
+ $dc = 0;
+ if($cp['cp_type']) {
+ $dc = floor(($item_price * ($cp['cp_price'] / 100)) / $cp['cp_trunc']) * $cp['cp_trunc'];
+ } else {
+ $dc = $cp['cp_price'];
+ }
+
+ if($cp['cp_maximum'] && $dc > $cp['cp_maximum'])
+ $dc = $cp['cp_maximum'];
+
+ if($item_price < $dc)
+ continue;
+
+ $tot_it_cp_price += $dc;
+ $arr_it_cp_prc[$it_id] = $dc;
+ }
+
+ $tot_od_price -= $tot_it_cp_price;
+
+ // 주문쿠폰
+ if(isset($data['od_cp_id']) && $data['od_cp_id']) {
+ $sql = " select cp_id, cp_type, cp_price, cp_trunc, cp_minimum, cp_maximum
+ from {$g5['g5_shop_coupon_table']}
+ where cp_id = '{$data['od_cp_id']}'
+ and mb_id IN ( '{$od['mb_id']}', '전체회원' )
+ and cp_method = '2' ";
+ $cp = sql_fetch($sql);
+
+ // 사용한 쿠폰인지
+ $cp_used = is_used_coupon($od['mb_id'], $cp['cp_id']);
+
+ $dc = 0;
+ if(!$cp_used && $cp['cp_id'] && ($cp['cp_minimum'] <= $tot_od_price)) {
+ if($cp['cp_type']) {
+ $dc = floor(($tot_od_price * ($cp['cp_price'] / 100)) / $cp['cp_trunc']) * $cp['cp_trunc'];
+ } else {
+ $dc = $cp['cp_price'];
+ }
+
+ if($cp['cp_maximum'] && $dc > $cp['cp_maximum'])
+ $dc = $cp['cp_maximum'];
+
+ $tot_od_cp_price = $dc;
+ $tot_od_price -= $tot_od_cp_price;
+ }
+ }
+
+ $tot_cp_price = $tot_it_cp_price + $tot_od_cp_price;
+}
+
+// 배송비
+$od_send_cost = get_sendcost($od['cart_id']);
+
+$tot_sc_cp_price = 0;
+if($od['mb_id'] && $od_send_cost > 0) {
+ // 배송쿠폰
+ if($data['sc_cp_id']) {
+ $sql = " select cp_id, cp_type, cp_price, cp_trunc, cp_minimum, cp_maximum
+ from {$g5['g5_shop_coupon_table']}
+ where cp_id = '{$data['sc_cp_id']}'
+ and mb_id IN ( '{$od['mb_id']}', '전체회원' )
+ and cp_method = '3' ";
+ $cp = sql_fetch($sql);
+
+ // 사용한 쿠폰인지
+ $cp_used = is_used_coupon($od['mb_id'], $cp['cp_id']);
+
+ $dc = 0;
+ if(!$cp_used && $cp['cp_id'] && ($cp['cp_minimum'] <= $tot_od_price)) {
+ if($cp['cp_type']) {
+ $dc = floor(($send_cost * ($cp['cp_price'] / 100)) / $cp['cp_trunc']) * $cp['cp_trunc'];
+ } else {
+ $dc = $cp['cp_price'];
+ }
+
+ if($cp['cp_maximum'] && $dc > $cp['cp_maximum'])
+ $dc = $cp['cp_maximum'];
+
+ if($dc > $send_cost)
+ $dc = $send_cost;
+
+ $tot_sc_cp_price = $dc;
+ }
+ }
+}
+
+// 추가배송비
+$od_send_cost2 = isset($data['od_send_cost2']) ? (int) $data['od_send_cost2'] : 0;
+
+// 포인트
+$od_temp_point = isset($data['od_temp_point']) ? (int) $data['od_temp_point'] : 0;
+
+$i_price = $i_price + $i_send_cost + $i_send_cost2 - $i_temp_point - $i_send_coupon;
+$order_price = $tot_od_price + $od_send_cost + $od_send_cost2 - $tot_sc_cp_price - $od_temp_point;
+
+if ($od['mb_id']) {
+ $mb = get_member($od['mb_id']);
+ $od_pwd = $mb['mb_password'];
+} else {
+ $od_pwd = get_encrypt_string($data['od_pwd']);
+}
+
+$od_escrow = 0;
+
+// 복합과세 금액
+$od_tax_mny = round($i_price / 1.1);
+$od_vat_mny = $i_price - $od_tax_mny;
+$od_free_mny = 0;
+if($default['de_tax_flag_use']) {
+ $od_tax_mny = (int)$data['comm_tax_mny'];
+ $od_vat_mny = (int)$data['comm_vat_mny'];
+ $od_free_mny = (int)$data['comm_free_mny'];
+}
+
+$od_pg = $default['de_pg_service'];
+if($data['od_settle_case'] == 'KAKAOPAY')
+ $od_pg = 'KAKAOPAY';
+
+$od_email = get_email_address($data['od_email']);
+$od_name = clean_xss_tags($data['od_name']);
+$od_tel = clean_xss_tags($data['od_tel']);
+$od_hp = clean_xss_tags($data['od_hp']);
+$od_zip = preg_replace('/[^0-9]/', '', $data['od_zip']);
+$od_zip1 = substr($od_zip, 0, 3);
+$od_zip2 = substr($od_zip, 3);
+$od_addr1 = clean_xss_tags($data['od_addr1']);
+$od_addr2 = clean_xss_tags($data['od_addr2']);
+$od_addr3 = clean_xss_tags($data['od_addr3']);
+$od_addr_jibeon = preg_match("/^(N|R)$/", $data['od_addr_jibeon']) ? $data['od_addr_jibeon'] : '';
+$od_b_name = clean_xss_tags($data['od_b_name']);
+$od_b_tel = clean_xss_tags($data['od_b_tel']);
+$od_b_hp = clean_xss_tags($data['od_b_hp']);
+$od_b_zip = preg_replace('/[^0-9]/', '', $data['od_b_zip']);
+$od_b_zip1 = substr($od_b_zip, 0, 3);
+$od_b_zip2 = substr($od_b_zip, 3);
+$od_b_addr1 = clean_xss_tags($data['od_b_addr1']);
+$od_b_addr2 = clean_xss_tags($data['od_b_addr2']);
+$od_b_addr3 = clean_xss_tags($data['od_b_addr3']);
+$od_b_addr_jibeon = preg_match("/^(N|R)$/", $data['od_b_addr_jibeon']) ? $data['od_b_addr_jibeon'] : '';
+$od_memo = clean_xss_tags($data['od_memo']);
+$od_deposit_name = clean_xss_tags($data['od_deposit_name']);
+$od_tax_flag = $default['de_tax_flag_use'];
+$od_receipt_price = $tot_ct_price + $od_send_cost + $od_send_cost2 - ($od_temp_point + $tot_cp_price + $tot_sc_cp_price);
+$od_receipt_point = $od_temp_point;
+$od_receipt_time = $od['dt_time'];
+$od_misu = 0;
+$od_status = '입금';
+$od_bank_account = isset($data['od_bank_account']) ? clean_xss_tags($data['od_bank_account'], 1, 1) : '';
+$od_tno = '';
+$od_app_no = '';
+$od_hope_date = isset($data['od_hope_date']) ? clean_xss_tags($data['od_hope_date'], 1, 1) : '';
+
+// 주문서에 입력
+$sql = " insert {$g5['g5_shop_order_table']}
+ set od_id = '$od_id',
+ mb_id = '{$od['mb_id']}',
+ od_pwd = '$od_pwd',
+ od_name = '$od_name',
+ od_email = '$od_email',
+ od_tel = '$od_tel',
+ od_hp = '$od_hp',
+ od_zip1 = '$od_zip1',
+ od_zip2 = '$od_zip2',
+ od_addr1 = '$od_addr1',
+ od_addr2 = '$od_addr2',
+ od_addr3 = '$od_addr3',
+ od_addr_jibeon = '$od_addr_jibeon',
+ od_b_name = '$od_b_name',
+ od_b_tel = '$od_b_tel',
+ od_b_hp = '$od_b_hp',
+ od_b_zip1 = '$od_b_zip1',
+ od_b_zip2 = '$od_b_zip2',
+ od_b_addr1 = '$od_b_addr1',
+ od_b_addr2 = '$od_b_addr2',
+ od_b_addr3 = '$od_b_addr3',
+ od_b_addr_jibeon = '$od_b_addr_jibeon',
+ od_deposit_name = '$od_deposit_name',
+ od_memo = '$od_memo',
+ od_cart_count = '$cart_count',
+ od_cart_price = '$tot_ct_price',
+ od_cart_coupon = '$tot_it_cp_price',
+ od_send_cost = '$od_send_cost',
+ od_send_coupon = '$tot_sc_cp_price',
+ od_send_cost2 = '$od_send_cost2',
+ od_coupon = '$tot_od_cp_price',
+ od_receipt_price = '$od_receipt_price',
+ od_receipt_point = '$od_receipt_point',
+ od_bank_account = '$od_bank_account',
+ od_receipt_time = '$od_receipt_time',
+ od_misu = '$od_misu',
+ od_pg = '$od_pg',
+ od_tno = '$od_tno',
+ od_app_no = '$od_app_no',
+ od_escrow = '$od_escrow',
+ od_tax_flag = '$od_tax_flag',
+ od_tax_mny = '$od_tax_mny',
+ od_vat_mny = '$od_vat_mny',
+ od_free_mny = '$od_free_mny',
+ od_status = '$od_status',
+ od_shop_memo = '',
+ od_hope_date = '{$od_hope_date}',
+ od_time = '{$od['dt_time']}',
+ od_ip = '{$data['od_ip']}',
+ od_settle_case = '{$data['od_settle_case']}',
+ od_test = '{$data['od_test']}'
+ ";
+$result = sql_query($sql, true);
+
+$sql_card_point = "";
+if ($od_receipt_price > 0 && !$default['de_card_point']) {
+ $sql_card_point = " , ct_point = '0' ";
+}
+$sql = "update {$g5['g5_shop_cart_table']}
+ set od_id = '$od_id',
+ ct_status = '입금'
+ $sql_card_point
+ where od_id = '{$od['cart_id']}'
+ and ct_select = '1' ";
+$result = sql_query($sql, true);
+
+// 회원이면서 포인트를 사용했다면 테이블에 사용을 추가
+if ($od['mb_id'] && $od_receipt_point)
+ insert_point($od['mb_id'], (-1) * $od_receipt_point, "주문번호 $od_id 결제");
+
+// 쿠폰사용내역기록
+if($od['mb_id']) {
+ $it_cp_cnt = (isset($data['cp_id']) && is_array($data['cp_id'])) ? count($data['cp_id']) : 0;
+ for($i=0; $i<$it_cp_cnt; $i++) {
+ $cid = $data['cp_id'][$i];
+ $cp_it_id = $data['it_id'][$i];
+ $cp_prc = isset($arr_it_cp_prc[$cp_it_id]) ? (int) $arr_it_cp_prc[$cp_it_id] : 0;
+
+ if(trim($cid)) {
+ $sql = " insert into {$g5['g5_shop_coupon_log_table']}
+ set cp_id = '$cid',
+ mb_id = '{$od['mb_id']}',
+ od_id = '$od_id',
+ cp_price = '$cp_prc',
+ cl_datetime = '{$od['dt_time']}' ";
+ sql_query($sql);
+ }
+
+ // 쿠폰사용금액 cart에 기록
+ $sql = " update {$g5['g5_shop_cart_table']}
+ set cp_price = '$cp_prc'
+ where od_id = '$od_id'
+ and it_id = '$cp_it_id'
+ and ct_select = '1'
+ order by ct_id asc
+ limit 1 ";
+ sql_query($sql);
+ }
+
+ if(isset($data['od_cp_id']) && $data['od_cp_id']) {
+ $sql = " insert into {$g5['g5_shop_coupon_log_table']}
+ set cp_id = '{$data['od_cp_id']}',
+ mb_id = '{$od['mb_id']}',
+ od_id = '$od_id',
+ cp_price = '$tot_od_cp_price',
+ cl_datetime = '{$od['dt_time']}' ";
+ sql_query($sql);
+ }
+
+ if(isset($data['sc_cp_id']) && $data['sc_cp_id']) {
+ $sql = " insert into {$g5['g5_shop_coupon_log_table']}
+ set cp_id = '{$data['sc_cp_id']}',
+ mb_id = '{$od['mb_id']}',
+ od_id = '$od_id',
+ cp_price = '$tot_sc_cp_price',
+ cl_datetime = '{$od['dt_time']}' ";
+ sql_query($sql);
+ }
+}
+
+// 주문정보
+$info = get_order_info($od_id);
+
+// 미수금 정보 등 반영
+$sql = " update {$g5['g5_shop_order_table']}
+ set od_misu = '{$info['od_misu']}',
+ od_tax_mny = '{$info['od_tax_mny']}',
+ od_vat_mny = '{$info['od_vat_mny']}',
+ od_free_mny = '{$info['od_free_mny']}',
+ od_status = '$od_status'
+ where od_id = '$od_id' ";
+sql_query($sql);
+
+// 임시 주문정보 삭제
+$sql = " delete from {$g5['g5_shop_order_data_table']} where od_id = '$od_id' and dt_pg = '$od_pg' ";
+sql_query($sql, true);
+
+echo '
'.PHP_EOL;
+echo ''.PHP_EOL;
\ No newline at end of file
diff --git a/adm/shop_admin/inorderlist.php b/adm/shop_admin/inorderlist.php
new file mode 100644
index 000000000..8ecbdc8e7
--- /dev/null
+++ b/adm/shop_admin/inorderlist.php
@@ -0,0 +1,175 @@
+ '0' ";
+if ($stx) {
+ $sql_search .= " and ( ";
+ switch ($sfl) {
+ case 'od_id' :
+ $sql_search .= " ({$sfl} = '{$stx}') ";
+ break;
+ default :
+ $sql_search .= " ({$sfl} like '%{$stx}%') ";
+ break;
+ }
+ $sql_search .= " ) ";
+}
+
+if (!$sst) {
+ $sst = "od_id";
+ $sod = "desc";
+}
+$sql_order = " order by {$sst} {$sod} ";
+
+$sql = " select count(*) as cnt
+ {$sql_common}
+ {$sql_search}
+ {$sql_order} ";
+$row = sql_fetch($sql);
+$total_count = $row['cnt'];
+
+$rows = $config['cf_page_rows'];
+$total_page = ceil($total_count / $rows); // 전체 페이지 계산
+if ($page < 1) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
+$from_record = ($page - 1) * $rows; // 시작 열을 구함
+
+$sql = " select *
+ {$sql_common}
+ {$sql_search}
+ {$sql_order}
+ limit {$from_record}, {$rows} ";
+$result = sql_query($sql);
+
+$g5['title'] = '미완료주문';
+include_once (G5_ADMIN_PATH.'/admin.head.php');
+
+$colspan = 10;
+?>
+
+
+ 전체 건
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 전체 이벤트 건
+
+
+
+
+
+
+
+ 목록
+
+
+ | 이벤트번호 |
+ 제목 |
+ 연결상품 |
+ 사용 |
+ 관리 |
+
+
+
+ ';
+ $href_close = '';
+ }
+ if ($row['ev_subject_strong']) $subject = ''.$row['ev_subject'].'';
+ else $subject = $row['ev_subject'];
+ ?>
+
+
+ |
+ |
+ |
+ 예' : '아니오'; ?> |
+
+ 수정
+ 보기
+ 삭제
+ |
+
+
+ 자료가 없습니다. | ';
+ }
+ ?>
+
+
+
+
+
+
+'',
+'ev_subject_strong'=>'',
+'ev_id'=>'',
+'ev_head_html'=>'',
+'ev_tail_html'=>''
+);
+
+$res_item = null;
+
+$html_title = "이벤트";
+$g5['title'] = $html_title.' 관리';
+
+if ($w == "u")
+{
+ $html_title .= " 수정";
+ $readonly = " readonly";
+
+ $sql = " select * from {$g5['g5_shop_event_table']} where ev_id = '$ev_id' ";
+ $ev = sql_fetch($sql);
+ if (! (isset($ev['ev_id']) && $ev['ev_id']))
+ alert("등록된 자료가 없습니다.");
+
+ // 등록된 이벤트 상품
+ $sql = " select b.it_id, b.it_name
+ from {$g5['g5_shop_event_item_table']} a left join {$g5['g5_shop_item_table']} b on ( a.it_id = b.it_id )
+ where a.ev_id = '$ev_id' ";
+ $res_item = sql_query($sql);
+}
+else
+{
+ $html_title .= " 입력";
+ $ev['ev_skin'] = 'list.10.skin.php';
+ $ev['ev_mobile_skin'] = 'list.10.skin.php';
+ $ev['ev_use'] = 1;
+
+ $ev['ev_img_width'] = 230;
+ $ev['ev_img_height'] = 230;
+ $ev['ev_list_mod'] = 3;
+ $ev['ev_list_row'] = 5;
+ $ev['ev_mobile_img_width'] = 230;
+ $ev['ev_mobile_img_height'] = 230;
+ $ev['ev_mobile_list_mod'] = 3;
+ $ev['ev_mobile_list_row'] = 5;
+}
+
+// 분류리스트
+$category_select = '';
+$sql = " select * from {$g5['g5_shop_category_table']} ";
+if ($is_admin != 'super')
+ $sql .= " where ca_mb_id = '{$member['mb_id']}' ";
+$sql .= " order by ca_order, ca_id ";
+$result = sql_query($sql);
+for ($i=0; $row=sql_fetch_array($result); $i++)
+{
+ $len = strlen($row['ca_id']) / 2 - 1;
+
+ $nbsp = "";
+ for ($i=0; $i<$len; $i++)
+ $nbsp .= " ";
+
+ $category_select .= "
\n";
+}
+
+// 모바일 1줄당 이미지수 필드 추가
+if(!sql_query(" select ev_mobile_list_row from {$g5['g5_shop_event_table']} limit 1 ", false)) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_event_table']}`
+ ADD `ev_mobile_list_row` int(11) NOT NULL DEFAULT '0' AFTER `ev_mobile_list_mod` ", true);
+}
+
+include_once (G5_ADMIN_PATH.'/admin.head.php');
+?>
+
+
+
+
+
+
+전체목록';
+
+// 이벤트제목
+if($ev_id) {
+ $tmp = sql_fetch(" select ev_subject from {$g5['g5_shop_event_table']} where ev_id = '$ev_id' ");
+ $ev_title = $tmp['ev_subject'];
+}
+?>
+
+
+
+ 전체 이벤트 건
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+상품의 분류를 선택하시거나 상품명을 입력하신 후 검색하여 주십시오.');
+
+$sql = " select it_id, it_name
+ from {$g5['g5_shop_item_table']}
+ where (1) ";
+if($ca_id)
+ $sql .= " and ( ca_id like '$ca_id%' or ca_id2 like '$ca_id%' or ca_id3 like '$ca_id%' ) ";
+
+if($it_name)
+ $sql .= " and it_name like '%$it_name%' ";
+
+$sql .= " order by ca_id, it_name ";
+$result = sql_query($sql);
+
+$list = '';
+for($i=0;$row=sql_fetch_array($result);$i++) {
+ if($w == 'u') {
+ $sql2 = " select count(*) as cnt from {$g5['g5_shop_event_item_table']} where ev_id = '$ev_id' and it_id = '{$row['it_id']}' ";
+ $row2 = sql_fetch($sql2);
+ if ($row2['cnt'])
+ continue;
+ }
+
+ $it_name = get_it_image($row['it_id'], 50, 50).' '.$row['it_name'];
+
+ $list .= '
';
+ $list .= '';
+ $list .= ''.$it_name.'
';
+ $list .= '';
+ $list .= ''.PHP_EOL;
+}
+
+if($list)
+ $list = '
';
+else
+ $list = '
등록된 상품이 없습니다.
';
+
+echo $list;
\ No newline at end of file
diff --git a/adm/shop_admin/itemeventwin.php b/adm/shop_admin/itemeventwin.php
new file mode 100644
index 000000000..4a128fc89
--- /dev/null
+++ b/adm/shop_admin/itemeventwin.php
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+ 입력
+
+
+ | 상품명 |
+ 사용 |
+ 삭제 |
+
+
+
+
+
+ |
+
+
+
+
+ |
+ |
+ 삭제 |
+
+ | 자료가 없습니다. |
';
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 엑셀파일을 이용하여 상품을 일괄등록할 수 있습니다.
+ 형식은 상품일괄등록용 엑셀파일을 다운로드하여 상품 정보를 입력하시면 됩니다.
+ 수정 완료 후 엑셀파일을 업로드하시면 상품이 일괄등록됩니다.
+ 엑셀파일을 저장하실 때는 Excel 97 - 2003 통합문서 (*.xls) 로 저장하셔야 합니다.
+
+
+
+ 상품일괄등록용 엑셀파일 다운로드
+
+
+
+
+
+
+
+getSheet(0);
+
+ $num_rows = $sheet->getHighestRow();
+ $highestColumn = $sheet->getHighestColumn();
+
+ $dup_it_id = array();
+ $fail_it_id = array();
+ $dup_count = 0;
+ $total_count = 0;
+ $fail_count = 0;
+ $succ_count = 0;
+
+ for ($i = 3; $i <= $num_rows; $i++) {
+ $total_count++;
+
+ $j = 0;
+
+ $rowData = $sheet->rangeToArray('A' . $i . ':' . $highestColumn . $i,
+ NULL,
+ TRUE,
+ FALSE);
+
+ $it_id = (string) $rowData[0][$j++];
+ $it_id = preg_match('/[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)/', $it_id) ? addslashes(sprintf("%.0f", $it_id)) : preg_replace('/[^0-9a-z_\-]/i', '', $it_id);
+ $ca_id = addslashes($rowData[0][$j++]);
+ $ca_id2 = addslashes($rowData[0][$j++]);
+ $ca_id3 = addslashes($rowData[0][$j++]);
+ $it_name = addslashes($rowData[0][$j++]);
+ $it_maker = addslashes($rowData[0][$j++]);
+ $it_origin = addslashes($rowData[0][$j++]);
+ $it_brand = addslashes($rowData[0][$j++]);
+ $it_model = addslashes($rowData[0][$j++]);
+ $it_type1 = addslashes($rowData[0][$j++]);
+ $it_type2 = addslashes($rowData[0][$j++]);
+ $it_type3 = addslashes($rowData[0][$j++]);
+ $it_type4 = addslashes($rowData[0][$j++]);
+ $it_type5 = addslashes($rowData[0][$j++]);
+ $it_basic = addslashes($rowData[0][$j++]);
+ $it_explan = addslashes($rowData[0][$j++]);
+ $it_mobile_explan = addslashes($rowData[0][$j++]);
+ $it_cust_price = addslashes(only_number($rowData[0][$j++]));
+ $it_price = addslashes(only_number($rowData[0][$j++]));
+ $it_tel_inq = addslashes($rowData[0][$j++]);
+ $it_point = addslashes(only_number($rowData[0][$j++]));
+ $it_point_type = addslashes(only_number($rowData[0][$j++]));
+ $it_sell_email = addslashes($rowData[0][$j++]);
+ $it_use = addslashes($rowData[0][$j++]);
+ $it_stock_qty = addslashes(only_number($rowData[0][$j++]));
+ $it_noti_qty = addslashes(only_number($rowData[0][$j++]));
+ $it_buy_min_qty = addslashes(only_number($rowData[0][$j++]));
+ $it_buy_max_qty = addslashes(only_number($rowData[0][$j++]));
+ $it_notax = addslashes(only_number($rowData[0][$j++]));
+ $it_order = addslashes(only_number($rowData[0][$j++]));
+ $it_img1 = addslashes($rowData[0][$j++]);
+ $it_img2 = addslashes($rowData[0][$j++]);
+ $it_img3 = addslashes($rowData[0][$j++]);
+ $it_img4 = addslashes($rowData[0][$j++]);
+ $it_img5 = addslashes($rowData[0][$j++]);
+ $it_img6 = addslashes($rowData[0][$j++]);
+ $it_img7 = addslashes($rowData[0][$j++]);
+ $it_img8 = addslashes($rowData[0][$j++]);
+ $it_img9 = addslashes($rowData[0][$j++]);
+ $it_img10 = addslashes($rowData[0][$j++]);
+ $it_explan2 = strip_tags(trim($it_explan));
+
+ if(!$it_id || !$ca_id || !$it_name) {
+ $fail_count++;
+ continue;
+ }
+
+ // it_id 중복체크
+ $sql2 = " select count(*) as cnt from {$g5['g5_shop_item_table']} where it_id = '$it_id' ";
+ $row2 = sql_fetch($sql2);
+ if(isset($row2['cnt']) && $row2['cnt']) {
+ $fail_it_id[] = $it_id;
+ $dup_it_id[] = $it_id;
+ $dup_count++;
+ $fail_count++;
+ continue;
+ }
+
+ // 기본분류체크
+ $sql2 = " select count(*) as cnt from {$g5['g5_shop_category_table']} where ca_id = '$ca_id' ";
+ $row2 = sql_fetch($sql2);
+ if(! (isset($row2['cnt']) && $row2['cnt'])) {
+ $fail_it_id[] = $it_id;
+ $fail_count++;
+ continue;
+ }
+
+ $sql = " INSERT INTO {$g5['g5_shop_item_table']}
+ SET it_id = '$it_id',
+ ca_id = '$ca_id',
+ ca_id2 = '$ca_id2',
+ ca_id3 = '$ca_id3',
+ it_name = '$it_name',
+ it_maker = '$it_maker',
+ it_origin = '$it_origin',
+ it_brand = '$it_brand',
+ it_model = '$it_model',
+ it_type1 = '$it_type1',
+ it_type2 = '$it_type2',
+ it_type3 = '$it_type3',
+ it_type4 = '$it_type4',
+ it_type5 = '$it_type5',
+ it_basic = '$it_basic',
+ it_explan = '$it_explan',
+ it_explan2 = '$it_explan2',
+ it_mobile_explan = '$it_mobile_explan',
+ it_cust_price = '$it_cust_price',
+ it_price = '$it_price',
+ it_point = '$it_point',
+ it_point_type = '$it_point_type',
+ it_stock_qty = '$it_stock_qty',
+ it_noti_qty = '$it_noti_qty',
+ it_buy_min_qty = '$it_buy_min_qty',
+ it_buy_max_qty = '$it_buy_max_qty',
+ it_notax = '$it_notax',
+ it_use = '$it_use',
+ it_time = '".G5_TIME_YMDHIS."',
+ it_ip = '{$_SERVER['REMOTE_ADDR']}',
+ it_order = '$it_order',
+ it_tel_inq = '$it_tel_inq',
+ it_img1 = '$it_img1',
+ it_img2 = '$it_img2',
+ it_img3 = '$it_img3',
+ it_img4 = '$it_img4',
+ it_img5 = '$it_img5',
+ it_img6 = '$it_img6',
+ it_img7 = '$it_img7',
+ it_img8 = '$it_img8',
+ it_img9 = '$it_img9',
+ it_img10 = '$it_img10' ";
+
+ sql_query($sql);
+
+ $succ_count++;
+ }
+}
+
+$g5['title'] = '상품 엑셀일괄등록 결과';
+include_once(G5_PATH.'/head.sub.php');
+?>
+
+
+
+
+
+
+
+ - 총상품수
+
+ - 완료건수
+
+ - 실패건수
+
+ 0) { ?>
+ - 실패상품코드
+
+
+ 0) { ?>
+ - 상품코드중복건수
+
+ - 중복상품코드
+
+
+
+
+
+
+
+
+
+
+'',
+'it_skin'=>'',
+'it_mobile_skin'=>'',
+'it_name'=>'',
+'it_basic'=>'',
+'it_order'=>0,
+'it_type1'=>0,
+'it_type2'=>0,
+'it_type3'=>0,
+'it_type4'=>0,
+'it_type5'=>0,
+'it_brand'=>'',
+'it_model'=>'',
+'it_tel_inq'=>0,
+'it_use'=>0,
+'it_nocoupon'=>0,
+'ec_mall_pid'=>'',
+'it_mobile_explan'=>'',
+'it_sell_email'=>'',
+'it_shop_memo'=>'',
+'it_info_gubun'=>'',
+'it_explan'=>'',
+'it_point_type'=>0,
+'it_cust_price'=>0,
+'it_option_subject'=>'',
+'it_price'=>0,
+'it_point'=>0,
+'it_supply_point'=>0,
+'it_soldout'=>0,
+'it_stock_sms'=>0,
+'it_stock_qty'=>0,
+'it_noti_qty'=>0,
+'it_buy_min_qty'=>0,
+'it_buy_max_qty'=>0,
+'it_notax'=>0,
+'it_supply_subject'=>'',
+'it_sc_type'=>0,
+'it_sc_method'=>0,
+'it_sc_price'=>0,
+'it_sc_minimum'=>0,
+'it_sc_qty'=>0,
+'it_img1'=>'',
+'it_img2'=>'',
+'it_img3'=>'',
+'it_img4'=>'',
+'it_img5'=>'',
+'it_img6'=>'',
+'it_img7'=>'',
+'it_img8'=>'',
+'it_img9'=>'',
+'it_img10'=>'',
+'it_head_html'=>'',
+'it_tail_html'=>'',
+'it_mobile_head_html'=>'',
+'it_mobile_tail_html'=>'',
+);
+
+for($i=0;$i<=10;$i++){
+ $it['it_'.$i.'_subj'] = '';
+ $it['it_'.$i] = '';
+}
+
+if ($w == "")
+{
+ $html_title .= "입력";
+
+ // 옵션은 쿠키에 저장된 값을 보여줌. 다음 입력을 위한것임
+ //$it[ca_id] = _COOKIE[ck_ca_id];
+ $it['ca_id'] = get_cookie("ck_ca_id");
+ $it['ca_id2'] = get_cookie("ck_ca_id2");
+ $it['ca_id3'] = get_cookie("ck_ca_id3");
+ if (!$it['ca_id'])
+ {
+ $sql = " select ca_id from {$g5['g5_shop_category_table']} order by ca_order, ca_id limit 1 ";
+ $row = sql_fetch($sql);
+ if (! (isset($row['ca_id']) && $row['ca_id']))
+ alert("등록된 분류가 없습니다. 우선 분류를 등록하여 주십시오.", './categorylist.php');
+ $it['ca_id'] = $row['ca_id'];
+ }
+ //$it[it_maker] = stripslashes($_COOKIE[ck_maker]);
+ //$it[it_origin] = stripslashes($_COOKIE[ck_origin]);
+ $it['it_maker'] = stripslashes(get_cookie("ck_maker"));
+ $it['it_origin'] = stripslashes(get_cookie("ck_origin"));
+}
+else if ($w == "u")
+{
+ $html_title .= "수정";
+
+ if ($is_admin != 'super')
+ {
+ $sql = " select it_id from {$g5['g5_shop_item_table']} a, {$g5['g5_shop_category_table']} b
+ where a.it_id = '$it_id'
+ and a.ca_id = b.ca_id
+ and b.ca_mb_id = '{$member['mb_id']}' ";
+ $row = sql_fetch($sql);
+ if (!$row['it_id'])
+ alert("\'{$member['mb_id']}\' 님께서 수정 할 권한이 없는 상품입니다.");
+ }
+
+ $it = get_shop_item($it_id);
+
+ if(!$it)
+ alert('상품정보가 존재하지 않습니다.');
+
+ if (! (isset($ca_id) && $ca_id))
+ $ca_id = $it['ca_id'];
+
+ $sql = " select * from {$g5['g5_shop_category_table']} where ca_id = '$ca_id' ";
+ $ca = sql_fetch($sql);
+}
+else
+{
+ alert();
+}
+
+$qstr = $qstr.'&sca='.$sca.'&page='.$page;
+
+$g5['title'] = $html_title;
+include_once (G5_ADMIN_PATH.'/admin.head.php');
+
+// 분류리스트
+$category_select = '';
+$script = '';
+$sql = " select * from {$g5['g5_shop_category_table']} ";
+if ($is_admin != 'super')
+ $sql .= " where ca_mb_id = '{$member['mb_id']}' ";
+$sql .= " order by ca_order, ca_id ";
+$result = sql_query($sql);
+for ($i=0; $row=sql_fetch_array($result); $i++)
+{
+ $len = strlen($row['ca_id']) / 2 - 1;
+
+ $nbsp = "";
+ for ($i=0; $i<$len; $i++)
+ $nbsp .= " ";
+
+ $category_select .= "
\n";
+
+ $script .= "ca_use['{$row['ca_id']}'] = {$row['ca_use']};\n";
+ $script .= "ca_stock_qty['{$row['ca_id']}'] = {$row['ca_stock_qty']};\n";
+ //$script .= "ca_explan_html['$row[ca_id]'] = $row[ca_explan_html];\n";
+ $script .= "ca_sell_email['{$row['ca_id']}'] = '{$row['ca_sell_email']}';\n";
+}
+
+// 재입고알림 설정 필드 추가
+if(!sql_query(" select it_stock_sms from {$g5['g5_shop_item_table']} limit 1 ", false)) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
+ ADD `it_stock_sms` tinyint(4) NOT NULL DEFAULT '0' AFTER `it_stock_qty` ", true);
+}
+
+// 추가옵션 포인트 설정 필드 추가
+if(!sql_query(" select it_supply_point from {$g5['g5_shop_item_table']} limit 1 ", false)) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
+ ADD `it_supply_point` int(11) NOT NULL DEFAULT '0' AFTER `it_point_type` ", true);
+}
+
+// 상품메모 필드 추가
+if(!sql_query(" select it_shop_memo from {$g5['g5_shop_item_table']} limit 1 ", false)) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
+ ADD `it_shop_memo` text NOT NULL AFTER `it_use_avg` ", true);
+}
+
+// 지식쇼핑 PID 필드추가
+// 상품메모 필드 추가
+if(!sql_query(" select ec_mall_pid from {$g5['g5_shop_item_table']} limit 1 ", false)) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
+ ADD `ec_mall_pid` varchar(255) NOT NULL AFTER `it_shop_memo` ", true);
+}
+
+$pg_anchor ='
+';
+
+
+// 쿠폰적용안함 설정 필드 추가
+if(!sql_query(" select it_nocoupon from {$g5['g5_shop_item_table']} limit 1", false)) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
+ ADD `it_nocoupon` tinyint(4) NOT NULL DEFAULT '0' AFTER `it_use` ", true);
+}
+
+// 스킨필드 추가
+if(!sql_query(" select it_skin from {$g5['g5_shop_item_table']} limit 1", false)) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
+ ADD `it_skin` varchar(255) NOT NULL DEFAULT '' AFTER `ca_id3`,
+ ADD `it_mobile_skin` varchar(255) NOT NULL DEFAULT '' AFTER `it_skin` ", true);
+}
+?>
+
+
+
+
+
+
+상품의 분류를 선택하시거나 상품명을 입력하신 후 검색하여 주십시오.');
+
+$sql = " select ca_id, it_id, it_name, it_price
+ from {$g5['g5_shop_item_table']}
+ where it_id <> '$it_id' ";
+if($ca_id)
+ $sql .= " and ( ca_id like '$ca_id%' or ca_id2 like '$ca_id%' or ca_id3 like '$ca_id%' ) ";
+
+if($it_name)
+ $sql .= " and it_name like '%$it_name%' ";
+
+$sql .= " order by ca_id, it_name ";
+$result = sql_query($sql);
+
+$list = '';
+
+for($i=0;$row=sql_fetch_array($result);$i++) {
+ $sql2 = " select count(*) as cnt from {$g5['g5_shop_item_relation_table']} where it_id = '$it_id' and it_id2 = '{$row['it_id']}' ";
+ $row2 = sql_fetch($sql2);
+ if ($row2['cnt'])
+ continue;
+
+ $it_name = get_it_image($row['it_id'], 50, 50).' '.$row['it_name'];
+
+ $list .= '
';
+ $list .= '';
+ $list .= ''.$it_name.'
';
+ $list .= '';
+ $list .= ''.PHP_EOL;
+}
+
+if($list)
+ $list = '
';
+else
+ $list = '
등록된 상품이 없습니다.';
+
+echo $list;
\ No newline at end of file
diff --git a/adm/shop_admin/itemformupdate.php b/adm/shop_admin/itemformupdate.php
new file mode 100644
index 000000000..73e4c790a
--- /dev/null
+++ b/adm/shop_admin/itemformupdate.php
@@ -0,0 +1,655 @@
+ 99))
+ alert("포인트 비율을 0과 99 사이의 값으로 입력해 주십시오.");
+
+// 관련상품을 우선 삭제함
+sql_query(" delete from {$g5['g5_shop_item_relation_table']} where it_id = '$it_id' ");
+
+// 관련상품의 반대도 삭제
+sql_query(" delete from {$g5['g5_shop_item_relation_table']} where it_id2 = '$it_id' ");
+
+// 이벤트상품을 우선 삭제함
+sql_query(" delete from {$g5['g5_shop_event_item_table']} where it_id = '$it_id' ");
+
+// 선택옵션
+sql_query(" delete from {$g5['g5_shop_item_option_table']} where io_type = '0' and it_id = '$it_id' "); // 기존선택옵션삭제
+
+$option_count = (isset($_POST['opt_id']) && is_array($_POST['opt_id'])) ? count($_POST['opt_id']) : array();
+$it_option_subject = '';
+$it_supply_subject = '';
+
+if($option_count) {
+ // 옵션명
+ $opt1_cnt = $opt2_cnt = $opt3_cnt = 0;
+ for($i=0; $i<$option_count; $i++) {
+ $post_opt_id = isset($_POST['opt_id'][$i]) ? preg_replace(G5_OPTION_ID_FILTER, '', strip_tags($_POST['opt_id'][$i])) : '';
+
+ $opt_val = explode(chr(30), $post_opt_id);
+ if(isset($opt_val[0]) && $opt_val[0])
+ $opt1_cnt++;
+ if(isset($opt_val[1]) && $opt_val[1])
+ $opt2_cnt++;
+ if(isset($opt_val[2]) && $opt_val[2])
+ $opt3_cnt++;
+ }
+
+ if($opt1_subject && $opt1_cnt) {
+ $it_option_subject = $opt1_subject;
+ if($opt2_subject && $opt2_cnt)
+ $it_option_subject .= ','.$opt2_subject;
+ if($opt3_subject && $opt3_cnt)
+ $it_option_subject .= ','.$opt3_subject;
+ }
+}
+
+// 추가옵션
+sql_query(" delete from {$g5['g5_shop_item_option_table']} where io_type = '1' and it_id = '$it_id' "); // 기존추가옵션삭제
+
+$supply_count = (isset($_POST['spl_id']) && is_array($_POST['spl_id'])) ? count($_POST['spl_id']) : array();
+if($supply_count) {
+ // 추가옵션명
+ $arr_spl = array();
+ for($i=0; $i<$supply_count; $i++) {
+ $post_spl_id = isset($_POST['spl_id'][$i]) ? preg_replace(G5_OPTION_ID_FILTER, '', strip_tags($_POST['spl_id'][$i])) : '';
+
+ $spl_val = explode(chr(30), $post_spl_id);
+ if(!in_array($spl_val[0], $arr_spl))
+ $arr_spl[] = $spl_val[0];
+ }
+
+ $it_supply_subject = implode(',', $arr_spl);
+}
+
+// 상품요약정보
+$value_array = array();
+$count_ii_article = (isset($_POST['ii_article']) && is_array($_POST['ii_article'])) ? count($_POST['ii_article']) : 0;
+for($i=0; $i<$count_ii_article; $i++) {
+ $key = isset($_POST['ii_article'][$i]) ? strip_tags($_POST['ii_article'][$i], '
') : '';
+ $val = isset($_POST['ii_value'][$i]) ? strip_tags($_POST['ii_value'][$i], '
') : '';
+ $value_array[$key] = $val;
+}
+$it_info_value = addslashes(serialize($value_array));
+
+$it_name = isset($_POST['it_name']) ? strip_tags(clean_xss_attributes(trim($_POST['it_name']))) : '';
+
+// KVE-2019-0708
+$check_sanitize_keys = array(
+'it_order', // 출력순서
+'it_maker', // 제조사
+'it_origin', // 원산지
+'it_brand', // 브랜드
+'it_model', // 모델
+'it_tel_inq', // 전화문의
+'it_use', // 판매가능
+'it_nocoupon', // 쿠폰적용안함
+'ec_mall_pid', // 네이버쇼핑 상품ID
+'it_sell_email', // 판매자 e-mail
+'it_price', // 판매가격
+'it_cust_price', // 시중가격
+'it_point_type', // 포인트 유형
+'it_point', // 포인트
+'it_supply_point', // 추가옵션상품 포인트
+'it_soldout', // 상품품절
+'it_stock_sms', // 재입고SMS 알림
+'it_stock_qty', // 재고수량
+'it_noti_qty', // 재고 통보수량
+'it_buy_min_qty', // 최소구매수량
+'it_notax', // 상품과세 유형
+'it_sc_type', // 배송비 유형
+'it_sc_method', // 배송비 결제
+'it_sc_price', // 기본배송비
+'it_sc_minimum', // 배송비 상세조건
+'it_type1', // 상품유형(히트)
+'it_type2', // 상품유형(추천)
+'it_type3', // 상품유형(신상품)
+'it_type4', // 상품유형(인기)
+'it_type5', // 상품유형(할인)
+);
+
+foreach( $check_sanitize_keys as $key ){
+ $$key = isset($_POST[$key]) ? strip_tags(clean_xss_attributes($_POST[$key])) : '';
+}
+
+$it_basic = preg_replace('#
diff --git a/adm/shop_admin/iteminfo.php b/adm/shop_admin/iteminfo.php
new file mode 100644
index 000000000..ea84c9458
--- /dev/null
+++ b/adm/shop_admin/iteminfo.php
@@ -0,0 +1,73 @@
+
+
+
\ No newline at end of file
diff --git a/adm/shop_admin/itemlist.php b/adm/shop_admin/itemlist.php
new file mode 100644
index 000000000..288b1a18f
--- /dev/null
+++ b/adm/shop_admin/itemlist.php
@@ -0,0 +1,299 @@
+선택'.PHP_EOL;
+$sql = " select * from {$g5['g5_shop_category_table']} ";
+if ($is_admin != 'super')
+ $sql .= " where ca_mb_id = '{$member['mb_id']}' ";
+$sql .= " order by ca_order, ca_id ";
+$result = sql_query($sql);
+for ($i=0; $row=sql_fetch_array($result); $i++)
+{
+ $len = strlen($row['ca_id']) / 2 - 1;
+ $nbsp = '';
+ for ($i=0; $i<$len; $i++) {
+ $nbsp .= ' ';
+ }
+ $ca_list .= ''.PHP_EOL;
+}
+
+$where = " and ";
+$sql_search = "";
+if ($stx != "") {
+ if ($sfl != "") {
+ $sql_search .= " $where $sfl like '%$stx%' ";
+ $where = " and ";
+ }
+ if ($save_stx != $stx)
+ $page = 1;
+}
+
+if ($sca != "") {
+ $sql_search .= " $where (a.ca_id like '$sca%' or a.ca_id2 like '$sca%' or a.ca_id3 like '$sca%') ";
+}
+
+if ($sfl == "") $sfl = "it_name";
+
+$sql_common = " from {$g5['g5_shop_item_table']} a ,
+ {$g5['g5_shop_category_table']} b
+ where (a.ca_id = b.ca_id";
+if ($is_admin != 'super')
+ $sql_common .= " and b.ca_mb_id = '{$member['mb_id']}'";
+$sql_common .= ") ";
+$sql_common .= $sql_search;
+
+// 테이블의 전체 레코드수만 얻음
+$sql = " select count(*) as cnt " . $sql_common;
+$row = sql_fetch($sql);
+$total_count = $row['cnt'];
+
+$rows = $config['cf_page_rows'];
+$total_page = ceil($total_count / $rows); // 전체 페이지 계산
+if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
+$from_record = ($page - 1) * $rows; // 시작 열을 구함
+
+if (!$sst) {
+ $sst = "it_id";
+ $sod = "desc";
+}
+$sql_order = "order by $sst $sod";
+
+
+$sql = " select *
+ $sql_common
+ $sql_order
+ limit $from_record, $rows ";
+$result = sql_query($sql);
+
+//$qstr = $qstr.'&sca='.$sca.'&page='.$page;
+$qstr = $qstr.'&sca='.$sca.'&page='.$page.'&save_stx='.$stx;
+
+$listall = '전체목록';
+?>
+
+
+
+ 등록된 상품 건
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $port_setting);
+
+ $strDest = array();
+ $strDest[] = $recv_number;
+ $strCallBack = $send_number;
+ $strCaller = iconv_euckr(trim($default['de_admin_company_name']));
+ $strSubject = '';
+ $strURL = '';
+ $strData = iconv_euckr($sms_content);
+ $strDate = '';
+ $nCount = count($strDest);
+
+ $res = $SMS->Add($strDest, $strCallBack, $strCaller, $strSubject, $strURL, $strData, $strDate, $nCount);
+
+ $SMS->Send();
+ $SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
+ }
+ } else {
+ include_once(G5_LIB_PATH.'/icode.sms.lib.php');
+
+ $SMS = new SMS; // SMS 연결
+ $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']);
+ $SMS->Add($recv_number, $send_number, $config['cf_icode_id'], iconv_euckr(stripslashes($sms_content)), "");
+ $SMS->Send();
+ }
+ }
+ }
+
+ // 답변 이메일전송
+ if(trim($row['iq_email'])) {
+ include_once(G5_LIB_PATH.'/mailer.lib.php');
+
+ $subject = $config['cf_title'].' '.$row['it_name'].' 상품문의 답변 알림 메일';
+ $content = conv_content($iq_answer, 1);
+
+ mailer($config['cf_title'], $config['cf_admin_email'], $row['iq_email'], $subject, $content, 1);
+ }
+ }
+
+ goto_url("./itemqaform.php?w=$w&iq_id=$iq_id&sca=$sca&$qstr");
+}
+else {
+ alert();
+}
\ No newline at end of file
diff --git a/adm/shop_admin/itemqalist.php b/adm/shop_admin/itemqalist.php
new file mode 100644
index 000000000..d1d14cfbb
--- /dev/null
+++ b/adm/shop_admin/itemqalist.php
@@ -0,0 +1,207 @@
+전체목록';
+?>
+
+
+
+ 전체 문의내역 건
+
+
+
+
+
+
+
+
+
+
+전체목록';
+?>
+
+
+
+ 등록상품 건
+
+
+
+
+
+
판매량을 합산하여 상품판매순위를 집계합니다.
+
+
+
+
+
+
+
+
+
+
+전체목록';
+?>
+
+
+
+ 전체 상품 개
+
+
+
+
+
+
재고수정의 수치를 수정하시면 창고재고의 수치가 변경됩니다.
+
+
+
+
+
+
+
+dbconfig.php 파일에 $g5[\'g5_shop_item_stocksms_table\'] = G5_SHOP_TABLE_PREFIX.\'item_stocksms\'; 를 추가해 주세요.');
+
+if(!sql_query(" select ss_id from {$g5['g5_shop_item_stocksms_table']} limit 1", false)) {
+ sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['g5_shop_item_stocksms_table']}` (
+ `ss_id` int(11) NOT NULL AUTO_INCREMENT,
+ `it_id` varchar(20) NOT NULL DEFAULT '',
+ `ss_hp` varchar(255) NOT NULL DEFAULT '',
+ `ss_send` tinyint(4) NOT NULL DEFAULT '0',
+ `ss_send_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `ss_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `ss_ip` varchar(25) NOT NULL DEFAULT '',
+ PRIMARY KEY (`ss_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", true);
+}
+
+$doc = isset($_GET['doc']) ? clean_xss_tags($_GET['doc'], 1, 1) : '';
+$sort1 = (isset($_GET['sort1']) && in_array($_GET['sort1'], array('it_id', 'ss_hp', 'ss_send', 'ss_send_time', 'ss_datetime'))) ? $_GET['sort1'] : 'ss_send';
+$sort2 = (isset($_GET['sort2']) && in_array($_GET['sort2'], array('desc', 'asc'))) ? $_GET['sort2'] : 'asc';
+$sel_field = (isset($_GET['sel_field']) && in_array($_GET['sel_field'], array('it_id', 'ss_hp', 'ss_send')) ) ? $_GET['sel_field'] : 'it_id';
+$search = isset($_GET['search']) ? get_search_string($_GET['search']) : '';
+
+$sql_search = " where 1 ";
+if ($search != "") {
+ if ($sel_field != "") {
+ $sql_search .= " and $sel_field like '%$search%' ";
+ }
+}
+
+$sql_common = " from {$g5['g5_shop_item_stocksms_table']} ";
+
+// 미전송 건수
+$sql = " select count(*) as cnt " . $sql_common . " where ss_send = '0' ";
+$row = sql_fetch($sql);
+$unsend_count = $row['cnt'];
+
+// 테이블의 전체 레코드수만 얻음
+$sql = " select count(*) as cnt " . $sql_common;
+$row = sql_fetch($sql);
+$total_count = $row['cnt'];
+
+$rows = $config['cf_page_rows'];
+$total_page = ceil($total_count / $rows); // 전체 페이지 계산
+if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
+$from_record = ($page - 1) * $rows; // 시작 열을 구함
+
+$sql = " select *
+ $sql_common
+ $sql_search
+ order by $sort1 $sort2
+ limit $from_record, $rows ";
+$result = sql_query($sql);
+
+$qstr1 = 'sel_field='.$sel_field.'&search='.$search;
+$qstr = $qstr1.'&sort1='.$sort1.'&sort2='.$sort2.'&page='.$page;
+
+$listall = '전체목록';
+?>
+
+
+
+ 전체 건
+ 미전송 건
+
+
+
+
+
+
+
+
+
+
+ $receive_number, 'send' => $send_number, 'cont' => $sms_contents);
+ }
+
+ // SMS 전송으로 변경함
+ $sql = " update {$g5['g5_shop_item_stocksms_table']}
+ set ss_send = '1',
+ ss_send_time = '".G5_TIME_YMDHIS."'
+ where ss_id = '{$ss_id}' ";
+ sql_query($sql);
+ }
+
+ // SMS
+ $sms_count = count($sms_messages);
+ if($sms_count > 0) {
+ if($config['cf_sms_type'] == 'LMS') {
+ include_once(G5_LIB_PATH.'/icode.lms.lib.php');
+
+ $port_setting = get_icode_port_type($config['cf_icode_id'], $config['cf_icode_pw']);
+
+ // SMS 모듈 클래스 생성
+ if($port_setting !== false) {
+ $SMS = new LMS;
+ $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $port_setting);
+
+ for($s=0; $s<$sms_count; $s++) {
+ $strDest = array();
+ $strDest[] = $sms_messages[$s]['recv'];
+ $strCallBack = $sms_messages[$s]['send'];
+ $strCaller = iconv_euckr(trim($default['de_admin_company_name']));
+ $strSubject = '';
+ $strURL = '';
+ $strData = iconv_euckr($sms_messages[$s]['cont']);
+ $strDate = '';
+ $nCount = count($strDest);
+
+ $res = $SMS->Add($strDest, $strCallBack, $strCaller, $strSubject, $strURL, $strData, $strDate, $nCount);
+
+ $SMS->Send();
+ $SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
+ }
+ }
+ } else {
+ include_once(G5_LIB_PATH.'/icode.sms.lib.php');
+
+ $SMS = new SMS; // SMS 연결
+ $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']);
+
+ for($s=0; $s<$sms_count; $s++) {
+ $recv_number = $sms_messages[$s]['recv'];
+ $send_number = $sms_messages[$s]['send'];
+ $sms_content = iconv_euckr($sms_messages[$s]['cont']);
+
+ $SMS->Add($recv_number, $send_number, $config['cf_icode_id'], $sms_content, "");
+ }
+
+ $SMS->Send();
+ $SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
+ }
+ }
+} else if ($_POST['act_button'] == "선택삭제") {
+
+ if ($is_admin != 'super')
+ alert('자료의 삭제는 최고관리자만 가능합니다.');
+
+ auth_check_menu($auth, $sub_menu, 'd');
+
+ for ($i=0; $i<$count_post_chk; $i++) {
+ // 실제 번호를 넘김
+ $k = isset($_POST['chk'][$i]) ? (int) $_POST['chk'][$i] : 0;
+ $ss_id = isset($_POST['ss_id'][$k]) ? (int) $_POST['ss_id'][$k] : 0;
+
+ $sql = " delete from {$g5['g5_shop_item_stocksms_table']} where ss_id = '{$ss_id}' ";
+ sql_query($sql);
+ }
+}
+
+
+$qstr1 = 'sel_field='.$sel_field.'&search='.$search;
+$qstr = $qstr1.'&sort1='.$sort1.'&sort2='.$sort2.'&page='.$page;
+
+goto_url('./itemstocksms.php?'.$qstr);
\ No newline at end of file
diff --git a/adm/shop_admin/itemsupply.php b/adm/shop_admin/itemsupply.php
new file mode 100644
index 000000000..7abd56334
--- /dev/null
+++ b/adm/shop_admin/itemsupply.php
@@ -0,0 +1,180 @@
+
+
+
+
+
+
+
+
+전체목록';
+?>
+
+
+
+ 전체 상품 개
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+전체목록';
+?>
+
+
+
+ 전체 후기내역 건
+
+
+
+
+
+
+
+
+
+
+전체목록';
+?>
+
+
+
+ 전체 옵션 개
+
+
+
+
+
+
+
+
+ 재고수정의 수치를 수정하시면 창고재고의 수치가 변경됩니다.
+ 창고재고가 부족한 경우 재고수량 뒤에 ! 혹은 재고부족으로 표시됩니다.
+
+
+
+
+
+
+
+
+
+= '5.2.0') {
+ include_once(G5_LIB_PATH.'/PHPExcel.php');
+
+ $headers = array('주문번호', '주문자명', '주문자전화1', '주문자전화2', '배송자명', '배송지전화1', '배송지전화2', '배송지주소', '배송회사', '운송장번호');
+ $widths = array(18, 15, 15, 15, 15, 15, 15, 50, 20, 20);
+ $header_bgcolor = 'FFABCDEF';
+ $last_char = column_char(count($headers) - 1);
+ $rows = array();
+
+ for($i=1; $row=sql_fetch_array($result); $i++) {
+ $rows[] =
+ array(' '.$row['od_id'],
+ $row['od_name'],
+ ' '.$row['od_tel'],
+ ' '.$row['od_hp'],
+ $row['od_b_name'],
+ ' '.$row['od_b_tel'],
+ ' '.$row['od_b_hp'],
+ print_address($row['od_b_addr1'], $row['od_b_addr2'], $row['od_b_addr3'], $row['od_b_addr_jibeon']),
+ $row['od_delivery_company'],
+ $row['od_invoice']);
+ }
+
+ $data = array_merge(array($headers), $rows);
+
+ $excel = new PHPExcel();
+ $excel->setActiveSheetIndex(0)->getStyle( "A1:${last_char}1" )->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB($header_bgcolor);
+ $excel->setActiveSheetIndex(0)->getStyle( "A:$last_char" )->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER)->setWrapText(true);
+ foreach($widths as $i => $w) $excel->setActiveSheetIndex(0)->getColumnDimension( column_char($i) )->setWidth($w);
+ $excel->getActiveSheet()->fromArray($data,NULL,'A1');
+
+ header("Content-Type: application/octet-stream");
+ header("Content-Disposition: attachment; filename=\"deliverylist-".date("ymd", time()).".xls\"");
+ header("Cache-Control: max-age=0");
+
+ $writer = PHPExcel_IOFactory::createWriter($excel, 'Excel5');
+ $writer->save('php://output');
+} else {
+ /*================================================================================
+ php_writeexcel http://www.bettina-attack.de/jonny/view.php/projects/php_writeexcel/
+ =================================================================================*/
+
+ include_once(G5_LIB_PATH.'/Excel/php_writeexcel/class.writeexcel_workbook.inc.php');
+ include_once(G5_LIB_PATH.'/Excel/php_writeexcel/class.writeexcel_worksheet.inc.php');
+
+ $fname = tempnam(G5_DATA_PATH, "tmp-deliverylist.xls");
+ $workbook = new writeexcel_workbook($fname);
+ $worksheet = $workbook->addworksheet();
+
+ // Put Excel data
+ $data = array('주문번호', '주문자명', '주문자전화1', '주문자전화2', '배송자명', '배송지전화1', '배송지전화2', '배송지주소', '배송회사', '운송장번호');
+ $data = array_map('iconv_euckr', $data);
+
+ $col = 0;
+ foreach($data as $cell) {
+ $worksheet->write(0, $col++, $cell);
+ }
+
+ for($i=1; $row=sql_fetch_array($result); $i++) {
+ $row = array_map('iconv_euckr', $row);
+
+ $worksheet->write($i, 0, ' '.$row['od_id']);
+ $worksheet->write($i, 1, $row['od_name']);
+ $worksheet->write($i, 2, ' '.$row['od_tel']);
+ $worksheet->write($i, 3, ' '.$row['od_hp']);
+ $worksheet->write($i, 4, $row['od_b_name']);
+ $worksheet->write($i, 5, ' '.$row['od_b_tel']);
+ $worksheet->write($i, 6, ' '.$row['od_b_hp']);
+ $worksheet->write($i, 7, print_address($row['od_b_addr1'], $row['od_b_addr2'], $row['od_b_addr3'], $row['od_b_addr_jibeon']));
+ $worksheet->write($i, 8, $row['od_delivery_company']);
+ $worksheet->write($i, 9, $row['od_invoice']);
+ }
+
+ $workbook->close();
+
+ header("Content-Type: application/x-msexcel; name=\"deliverylist-".date("ymd", time()).".xls\"");
+ header("Content-Disposition: inline; filename=\"deliverylist-".date("ymd", time()).".xls\"");
+ $fh=fopen($fname, "rb");
+ fpassthru($fh);
+ unlink($fname);
+}
\ No newline at end of file
diff --git a/adm/shop_admin/orderdeliveryupdate.php b/adm/shop_admin/orderdeliveryupdate.php
new file mode 100644
index 000000000..3030de506
--- /dev/null
+++ b/adm/shop_admin/orderdeliveryupdate.php
@@ -0,0 +1,184 @@
+getSheet(0);
+
+ $num_rows = $sheet->getHighestRow();
+ $highestColumn = $sheet->getHighestColumn();
+
+ $fail_od_id = array();
+ $total_count = 0;
+ $fail_count = 0;
+ $succ_count = 0;
+
+ // $i 사용시 ordermail.inc.php의 $i 때문에 무한루프에 빠짐
+ for ($k = 2; $k <= $num_rows; $k++) {
+ $total_count++;
+
+ $rowData = $sheet->rangeToArray('A' . $k . ':' . $highestColumn . $k,
+ NULL,
+ TRUE,
+ FALSE);
+
+ $od_id = isset($rowData[0][0]) ? addslashes(trim($rowData[0][0])) : '';
+ $od_delivery_company = isset($rowData[0][8]) ? addslashes($rowData[0][8]) : '';
+ $od_invoice = isset($rowData[0][9]) ? addslashes($rowData[0][9]) : '';
+
+ if(!$od_id || !$od_delivery_company || !$od_invoice) {
+ $fail_count++;
+ $fail_od_id[] = $od_id;
+ continue;
+ }
+
+ // 주문정보
+ $od = sql_fetch(" select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' ");
+ if (!$od) {
+ $fail_count++;
+ $fail_od_id[] = $od_id;
+ continue;
+ }
+
+ if($od['od_status'] != '준비') {
+ $fail_count++;
+ $fail_od_id[] = $od_id;
+ continue;
+ }
+
+ $delivery['invoice'] = $od_invoice;
+ $delivery['invoice_time'] = G5_TIME_YMDHIS;
+ $delivery['delivery_company'] = $od_delivery_company;
+
+ // 주문정보 업데이트
+ order_update_delivery($od_id, $od['mb_id'], '배송', $delivery);
+ change_status($od_id, '준비', '배송');
+
+ $succ_count++;
+
+ $send_sms = isset($_POST['send_sms']) ? clean_xss_tags($_POST['send_sms'], 1, 1) : '';
+ $od_send_mail = isset($_POST['od_send_mail']) ? clean_xss_tags($_POST['od_send_mail'], 1, 1) : '';
+ $send_escrow = isset($_POST['send_escrow']) ? clean_xss_tags($_POST['send_escrow'], 1, 1) : '';
+
+ // SMS
+ if($config['cf_sms_use'] == 'icode' && $send_sms && $default['de_sms_use5']) {
+ $sms_contents = conv_sms_contents($od_id, $default['de_sms_cont5']);
+ if($sms_contents) {
+ $receive_number = preg_replace("/[^0-9]/", "", $od['od_hp']); // 수신자번호
+ $send_number = preg_replace("/[^0-9]/", "", $default['de_admin_company_tel']); // 발신자번호
+
+ if($receive_number)
+ $sms_messages[] = array('recv' => $receive_number, 'send' => $send_number, 'cont' => $sms_contents);
+ }
+ }
+
+ // 메일
+ if($config['cf_email_use'] && $od_send_mail)
+ include './ordermail.inc.php';
+
+ // 에스크로 배송
+ if($send_escrow && $od['od_tno'] && $od['od_escrow']) {
+ $escrow_tno = $od['od_tno'];
+ $escrow_numb = $od_invoice;
+ $escrow_corp = $od_delivery_company;
+
+ include(G5_SHOP_PATH.'/'.$od['od_pg'].'/escrow.register.php');
+ }
+ }
+}
+
+// SMS
+$sms_count = count($sms_messages);
+if($sms_count > 0) {
+ if($config['cf_sms_type'] == 'LMS') {
+ include_once(G5_LIB_PATH.'/icode.lms.lib.php');
+
+ $port_setting = get_icode_port_type($config['cf_icode_id'], $config['cf_icode_pw']);
+
+ // SMS 모듈 클래스 생성
+ if($port_setting !== false) {
+ $SMS = new LMS;
+ $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $port_setting);
+
+ for($s=0; $s<$sms_count; $s++) {
+ $strDest = array();
+ $strDest[] = $sms_messages[$s]['recv'];
+ $strCallBack = $sms_messages[$s]['send'];
+ $strCaller = iconv_euckr(trim($default['de_admin_company_name']));
+ $strSubject = '';
+ $strURL = '';
+ $strData = iconv_euckr($sms_messages[$s]['cont']);
+ $strDate = '';
+ $nCount = count($strDest);
+
+ $res = $SMS->Add($strDest, $strCallBack, $strCaller, $strSubject, $strURL, $strData, $strDate, $nCount);
+
+ $SMS->Send();
+ $SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
+ }
+ }
+ } else {
+ include_once(G5_LIB_PATH.'/icode.sms.lib.php');
+
+ $SMS = new SMS; // SMS 연결
+ $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']);
+
+ for($s=0; $s<$sms_count; $s++) {
+ $recv_number = $sms_messages[$s]['recv'];
+ $send_number = $sms_messages[$s]['send'];
+ $sms_content = iconv_euckr($sms_messages[$s]['cont']);
+
+ $SMS->Add($recv_number, $send_number, $config['cf_icode_id'], $sms_content, "");
+ }
+
+ $SMS->Send();
+ $SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
+ }
+}
+
+$g5['title'] = '엑셀 배송일괄처리 결과';
+include_once(G5_PATH.'/head.sub.php');
+?>
+
+
+
+
+
+
+
+ - 총배송건수
+
+ - 완료건수
+
+ - 실패건수
+
+ 0) { ?>
+ - 실패주문코드
+
+
+
+
+
+
+
+
+
+
+
+주문상품 목록
+주문결제 내역
+결제상세정보 확인
+결제상세정보 수정
+상점메모
+주문하신 분
+받으시는 분
+';
+
+$html_receipt_chk = '
+
';
+
+$qstr1 = "od_status=".urlencode($od_status)."&od_settle_case=".urlencode($od_settle_case)."&od_misu=$od_misu&od_cancel_price=$od_cancel_price&od_refund_price=$od_refund_price&od_receipt_point=$od_receipt_point&od_coupon=$od_coupon&fr_date=$fr_date&to_date=$to_date&sel_field=$sel_field&search=$search&save_search=$search";
+if($default['de_escrow_use'])
+ $qstr1 .= "&od_escrow=$od_escrow";
+$qstr = "$qstr1&sort1=$sort1&sort2=$sort2&page=$page";
+
+// 상품목록
+$sql = " select it_id,
+ it_name,
+ cp_price,
+ ct_notax,
+ ct_send_cost,
+ it_sc_type
+ from {$g5['g5_shop_cart_table']}
+ where od_id = '{$od['od_id']}'
+ group by it_id
+ order by ct_id ";
+$result = sql_query($sql);
+
+// 주소 참고항목 필드추가
+if(!isset($od['od_addr3'])) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_order_table']}`
+ ADD `od_addr3` varchar(255) NOT NULL DEFAULT '' AFTER `od_addr2`,
+ ADD `od_b_addr3` varchar(255) NOT NULL DEFAULT '' AFTER `od_b_addr2` ", true);
+}
+
+// 배송목록에 참고항목 필드추가
+if(!sql_query(" select ad_addr3 from {$g5['g5_shop_order_address_table']} limit 1", false)) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_order_address_table']}`
+ ADD `ad_addr3` varchar(255) NOT NULL DEFAULT '' AFTER `ad_addr2` ", true);
+}
+
+// 결제 PG 필드 추가
+if(!sql_query(" select od_pg from {$g5['g5_shop_order_table']} limit 1 ", false)) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_order_table']}`
+ ADD `od_pg` varchar(255) NOT NULL DEFAULT '' AFTER `od_mobile`,
+ ADD `od_casseqno` varchar(255) NOT NULL DEFAULT '' AFTER `od_escrow` ", true);
+
+ // 주문 결제 PG kcp로 설정
+ sql_query(" update {$g5['g5_shop_order_table']} set od_pg = 'kcp' ");
+}
+
+// LG 현금영수증 JS
+if($od['od_pg'] == 'lg') {
+ if($default['de_card_test']) {
+ echo ''.PHP_EOL;
+ } else {
+ echo ''.PHP_EOL;
+ }
+}
+
+// add_javascript('js 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
+add_javascript(G5_POSTCODE_JS, 0); //다음 주소 js
+?>
+
+
+ 주문상품 목록
+
+
+
+ 현재 주문상태
+ |
+ 주문일시 ()
+ |
+ 주문총액 원
+
+
희망배송일은 () 입니다.
+
+
모바일 쇼핑몰의 주문입니다.
+
+
+
+
+
+
+
+ 주문 수량변경 및 주문 전체취소 처리 내역
+
+
+
+
+
+
+
+
+
+주의) 이 주문은 테스트용으로 실제 결제가 이루어지지 않았으므로 절대 배송하시면 안됩니다.
+
+
+주의) 이 주문은 결제취소된 내역이 있습니다. 이니시스 관리자 상점에서 반드시 재확인을 해 주세요.
+
+
+
+ 주문결제 내역
+
+
+ 0)
+ $s_receipt_way .= "+포인트";
+ ?>
+
+
+
미수금
+
+
+ 주문결제 내역
+
+
+ | 주문번호 |
+ 결제방법 |
+ 주문총액 |
+ 배송비 |
+ 포인트결제 |
+ 총결제액 |
+ 쿠폰 |
+ 주문취소 |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ 원 |
+ |
+ 원 |
+
+
+
+
+
+
+
+ 결제상세정보
+
+
+
+
+
+
+ 상점메모
+
+
+
+ 현재 열람 중인 주문에 대한 내용을 메모하는곳입니다.
+ 입금, 배송 내역을 메일로 발송할 경우 함께 기록됩니다.
+
+
+
+
+
+
+
+ 주문자/배송지 정보
+
+
+
+
+
+
+
+ '.$ct_qty."\n";
+ }
+
+ // 재고를 이미 사용했다면 (재고에서 이미 뺐다면)
+ $stock_use = $ct['ct_stock_use'];
+ if ($ct['ct_stock_use'])
+ {
+ if ($ct_status == '주문' || $ct_status == '취소' || $ct_status == '반품' || $ct_status == '품절')
+ {
+ $stock_use = 0;
+ // 재고에 다시 더한다.
+ if($ct['io_id']) {
+ $sql = " update {$g5['g5_shop_item_option_table']}
+ set io_stock_qty = io_stock_qty + '{$ct['ct_qty']}'
+ where it_id = '{$ct['it_id']}'
+ and io_id = '{$ct['io_id']}'
+ and io_type = '{$ct['io_type']}' ";
+ } else {
+ $sql = " update {$g5['g5_shop_item_table']}
+ set it_stock_qty = it_stock_qty + '{$ct['ct_qty']}'
+ where it_id = '{$ct['it_id']}' ";
+ }
+
+ sql_query($sql);
+ }
+ }
+ else
+ {
+ // 재고 오류로 인한 수정
+ if ($ct_status == '배송' || $ct_status == '완료')
+ {
+ $stock_use = 1;
+ // 재고에서 뺀다.
+ if($ct['io_id']) {
+ $sql = " update {$g5['g5_shop_item_option_table']}
+ set io_stock_qty = io_stock_qty - '{$ct['ct_qty']}'
+ where it_id = '{$ct['it_id']}'
+ and io_id = '{$ct['io_id']}'
+ and io_type = '{$ct['io_type']}' ";
+ } else {
+ $sql = " update {$g5['g5_shop_item_table']}
+ set it_stock_qty = it_stock_qty - '{$ct['ct_qty']}'
+ where it_id = '{$ct['it_id']}' ";
+ }
+
+ sql_query($sql);
+ }
+ /* 주문 수정에서 "품절" 선택시 해당 상품 자동 품절 처리하기
+ else if ($ct_status == '품절') {
+ $stock_use = 1;
+ // 재고에서 뺀다.
+ $sql =" update {$g5['g5_shop_item_table']} set it_stock_qty = 0 where it_id = '{$ct['it_id']}' ";
+ sql_query($sql);
+ } */
+ }
+
+ $point_use = $ct['ct_point_use'];
+ // 회원이면서 포인트가 0보다 크면
+ // 이미 포인트를 부여했다면 뺀다.
+ if ($mb_id && $ct['ct_point'] && $ct['ct_point_use'])
+ {
+ $point_use = 0;
+ //insert_point($mb_id, (-1) * ($ct[ct_point] * $ct[ct_qty]), "주문번호 $od_id ($ct_id) 취소");
+ delete_point($mb_id, "@delivery", $mb_id, "$od_id,$ct_id");
+ }
+
+ // 히스토리에 남김
+ // 히스토리에 남길때는 작업|아이디|시간|IP|그리고 나머지 자료
+ $now = G5_TIME_YMDHIS;
+ $ct_history="\n$ct_status|{$member['mb_id']}|$now|$REMOTE_ADDR";
+
+ $sql = " update {$g5['g5_shop_cart_table']}
+ set ct_point_use = '$point_use',
+ ct_stock_use = '$stock_use',
+ ct_status = '$ct_status',
+ ct_history = CONCAT(ct_history,'$ct_history')
+ where od_id = '$od_id'
+ and ct_id = '$ct_id' ";
+ sql_query($sql);
+
+ // it_id를 배열에 저장
+ if($ct_status == '주문' || $ct_status == '취소' || $ct_status == '반품' || $ct_status == '품절' || $ct_status == '완료')
+ $arr_it_id[] = $ct['it_id'];
+}
+
+// 상품 판매수량 반영
+if(is_array($arr_it_id) && !empty($arr_it_id)) {
+ $unq_it_id = array_unique($arr_it_id);
+
+ foreach($unq_it_id as $it_id) {
+ $sql2 = " select sum(ct_qty) as sum_qty from {$g5['g5_shop_cart_table']} where it_id = '$it_id' and ct_status = '완료' ";
+ $row2 = sql_fetch($sql2);
+
+ $sql3 = " update {$g5['g5_shop_item_table']} set it_sum_qty = '{$row2['sum_qty']}' where it_id = '$it_id' ";
+ sql_query($sql3);
+ }
+}
+
+// 장바구니 상품 모두 취소일 경우 주문상태 변경
+$cancel_change = false;
+if (in_array($_POST['ct_status'], $status_cancel)) {
+ $sql = " select count(*) as od_count1,
+ SUM(IF(ct_status = '취소' OR ct_status = '반품' OR ct_status = '품절', 1, 0)) as od_count2
+ from {$g5['g5_shop_cart_table']}
+ where od_id = '$od_id' ";
+ $row = sql_fetch($sql);
+
+ if($row['od_count1'] == $row['od_count2']) {
+ $cancel_change = true;
+
+ $pg_res_cd = '';
+ $pg_res_msg = '';
+ $pg_cancel_log = '';
+
+ // PG 신용카드 결제 취소일 때
+ if($pg_cancel == 1) {
+ $sql = " select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' ";
+ $od = sql_fetch($sql);
+
+ if($od['od_tno'] && ($od['od_settle_case'] == '신용카드' || $od['od_settle_case'] == '간편결제' || $od['od_settle_case'] == 'KAKAOPAY') || ($od['od_pg'] == 'inicis' && is_inicis_order_pay($od['od_settle_case']) )) {
+ switch($od['od_pg']) {
+ case 'lg':
+ include_once(G5_SHOP_PATH.'/settle_lg.inc.php');
+
+ $LGD_TID = $od['od_tno'];
+
+ $xpay = new XPay($configPath, $CST_PLATFORM);
+
+ // Mert Key 설정
+ $xpay->set_config_value('t'.$LGD_MID, $config['cf_lg_mert_key']);
+ $xpay->set_config_value($LGD_MID, $config['cf_lg_mert_key']);
+
+ $xpay->Init_TX($LGD_MID);
+
+ $xpay->Set('LGD_TXNAME', 'Cancel');
+ $xpay->Set('LGD_TID', $LGD_TID);
+
+ if ($xpay->TX()) {
+ $res_cd = $xpay->Response_Code();
+ if($res_cd != '0000' && $res_cd != 'AV11') {
+ $pg_res_cd = $res_cd;
+ $pg_res_msg = $xpay->Response_Msg();
+ }
+ } else {
+ $pg_res_cd = $xpay->Response_Code();
+ $pg_res_msg = $xpay->Response_Msg();
+ }
+ break;
+ case 'inicis':
+ include_once(G5_SHOP_PATH.'/settle_inicis.inc.php');
+ $cancel_msg = iconv_euckr('쇼핑몰 운영자 승인 취소');
+
+ /*********************
+ * 3. 취소 정보 설정 *
+ *********************/
+ $inipay->SetField("type", "cancel"); // 고정 (절대 수정 불가)
+ $inipay->SetField("mid", $default['de_inicis_mid']); // 상점아이디
+ /**************************************************************************************************
+ * admin 은 키패스워드 변수명입니다. 수정하시면 안됩니다. 1111의 부분만 수정해서 사용하시기 바랍니다.
+ * 키패스워드는 상점관리자 페이지(https://iniweb.inicis.com)의 비밀번호가 아닙니다. 주의해 주시기 바랍니다.
+ * 키패스워드는 숫자 4자리로만 구성됩니다. 이 값은 키파일 발급시 결정됩니다.
+ * 키패스워드 값을 확인하시려면 상점측에 발급된 키파일 안의 readme.txt 파일을 참조해 주십시오.
+ **************************************************************************************************/
+ $inipay->SetField("admin", $default['de_inicis_admin_key']); //비대칭 사용키 키패스워드
+ $inipay->SetField("tid", $od['od_tno']); // 취소할 거래의 거래아이디
+ $inipay->SetField("cancelmsg", $cancel_msg); // 취소사유
+
+ /****************
+ * 4. 취소 요청 *
+ ****************/
+ $inipay->startAction();
+
+ /****************************************************************
+ * 5. 취소 결과 *
+ * *
+ * 결과코드 : $inipay->getResult('ResultCode') ("00"이면 취소 성공) *
+ * 결과내용 : $inipay->getResult('ResultMsg') (취소결과에 대한 설명) *
+ * 취소날짜 : $inipay->getResult('CancelDate') (YYYYMMDD) *
+ * 취소시각 : $inipay->getResult('CancelTime') (HHMMSS) *
+ * 현금영수증 취소 승인번호 : $inipay->getResult('CSHR_CancelNum') *
+ * (현금영수증 발급 취소시에만 리턴됨) *
+ ****************************************************************/
+
+ $res_cd = $inipay->getResult('ResultCode');
+ $res_msg = $inipay->getResult('ResultMsg');
+
+ if($res_cd != '00') {
+ $pg_res_cd = $res_cd;
+ $pg_res_msg = iconv_utf8($res_msg);
+ }
+ break;
+ case 'KAKAOPAY':
+ include_once(G5_SHOP_PATH.'/settle_kakaopay.inc.php');
+ $_REQUEST['TID'] = $od['od_tno'];
+ $_REQUEST['Amt'] = $od['od_receipt_price'];
+ $_REQUEST['CancelMsg'] = '쇼핑몰 운영자 승인 취소';
+ $_REQUEST['PartialCancelCode'] = 0;
+ include G5_SHOP_PATH.'/kakaopay/kakaopay_cancel.php';
+ break;
+ default:
+ include_once(G5_SHOP_PATH.'/settle_kcp.inc.php');
+ require_once(G5_SHOP_PATH.'/kcp/pp_ax_hub_lib.php');
+
+ // locale ko_KR.euc-kr 로 설정
+ setlocale(LC_CTYPE, 'ko_KR.euc-kr');
+
+ $c_PayPlus = new C_PP_CLI_T;
+
+ $c_PayPlus->mf_clear();
+
+ $ordr_idxx = $od['od_id'];
+ $tno = $od['od_tno'];
+ $tran_cd = '00200000';
+ $cancel_msg = iconv_euckr('쇼핑몰 운영자 승인 취소');
+ $cust_ip = $_SERVER['REMOTE_ADDR'];
+ $bSucc_mod_type = "STSC";
+
+ $c_PayPlus->mf_set_modx_data( "tno", $tno ); // KCP 원거래 거래번호
+ $c_PayPlus->mf_set_modx_data( "mod_type", $bSucc_mod_type ); // 원거래 변경 요청 종류
+ $c_PayPlus->mf_set_modx_data( "mod_ip", $cust_ip ); // 변경 요청자 IP
+ $c_PayPlus->mf_set_modx_data( "mod_desc", $cancel_msg ); // 변경 사유
+
+ $c_PayPlus->mf_do_tx( $tno, $g_conf_home_dir, $g_conf_site_cd,
+ $g_conf_site_key, $tran_cd, "",
+ $g_conf_gw_url, $g_conf_gw_port, "payplus_cli_slib",
+ $ordr_idxx, $cust_ip, "3" ,
+ 0, 0, $g_conf_key_dir, $g_conf_log_dir);
+
+ $res_cd = $c_PayPlus->m_res_cd;
+ $res_msg = $c_PayPlus->m_res_msg;
+
+ if($res_cd != '0000') {
+ $pg_res_cd = $res_cd;
+ $pg_res_msg = iconv_utf8($res_msg);
+ }
+
+ // locale 설정 초기화
+ setlocale(LC_CTYPE, '');
+ break;
+ }
+
+ // PG 취소요청 성공했으면
+ if($pg_res_cd == '') {
+ $pg_cancel_log = ' PG 신용카드 승인취소 처리';
+ $sql = " update {$g5['g5_shop_order_table']}
+ set od_refund_price = '{$od['od_receipt_price']}'
+ where od_id = '$od_id' ";
+ sql_query($sql);
+ }
+ }
+ }
+
+ // 관리자 주문취소 로그
+ $mod_history .= G5_TIME_YMDHIS.' '.$member['mb_id'].' 주문'.$_POST['ct_status'].' 처리'.$pg_cancel_log."\n";
+ }
+}
+
+// 미수금 등의 정보
+$info = get_order_info($od_id);
+
+if(!$info)
+ alert('주문자료가 존재하지 않습니다.');
+
+$sql = " update {$g5['g5_shop_order_table']}
+ set od_cart_price = '{$info['od_cart_price']}',
+ od_cart_coupon = '{$info['od_cart_coupon']}',
+ od_coupon = '{$info['od_coupon']}',
+ od_send_coupon = '{$info['od_send_coupon']}',
+ od_cancel_price = '{$info['od_cancel_price']}',
+ od_send_cost = '{$info['od_send_cost']}',
+ od_misu = '{$info['od_misu']}',
+ od_tax_mny = '{$info['od_tax_mny']}',
+ od_vat_mny = '{$info['od_vat_mny']}',
+ od_free_mny = '{$info['od_free_mny']}' ";
+if ($mod_history) { // 주문변경 히스토리 기록
+ $sql .= " , od_mod_history = CONCAT(od_mod_history,'$mod_history') ";
+}
+
+if($cancel_change) {
+ $sql .= " , od_status = '취소' "; // 주문상품 모두 취소, 반품, 품절이면 주문 취소
+} else {
+ if (isset($_POST['ct_status']) && in_array($_POST['ct_status'], $status_normal)) { // 정상인 주문상태만 기록
+ $sql .= " , od_status = '{$_POST['ct_status']}' ";
+ }
+}
+
+$sql .= " where od_id = '$od_id' ";
+sql_query($sql);
+
+$qstr = "sort1=$sort1&sort2=$sort2&sel_field=$sel_field&search=$search&page=$page";
+
+$url = "./orderform.php?od_id=$od_id&$qstr";
+
+// 신용카드 취소 때 오류가 있으면 알림
+if($pg_cancel == 1 && $pg_res_cd && $pg_res_msg) {
+ alert('오류코드 : '.$pg_res_cd.' 오류내용 : '.$pg_res_msg, $url);
+} else {
+ // 1.06.06
+ $od = sql_fetch(" select od_receipt_point from {$g5['g5_shop_order_table']} where od_id = '$od_id' ");
+ if ($od['od_receipt_point'])
+ alert("포인트로 결제한 주문은,\\n\\n주문상태 변경으로 인해 포인트의 가감이 발생하는 경우\\n\\n회원관리 > 포인트관리에서 수작업으로 포인트를 맞추어 주셔야 합니다.", $url);
+ else
+ goto_url($url);
+}
\ No newline at end of file
diff --git a/adm/shop_admin/orderformreceiptupdate.php b/adm/shop_admin/orderformreceiptupdate.php
new file mode 100644
index 000000000..7bfb6b787
--- /dev/null
+++ b/adm/shop_admin/orderformreceiptupdate.php
@@ -0,0 +1,178 @@
+ 0 ";
+ break;
+ default:
+ $where[] = " od_status = '$od_status' ";
+ break;
+ }
+
+ switch ($od_status) {
+ case '주문' :
+ $sort1 = "od_id";
+ $sort2 = "desc";
+ break;
+ case '입금' : // 결제완료
+ $sort1 = "od_receipt_time";
+ $sort2 = "desc";
+ break;
+ case '배송' : // 배송중
+ $sort1 = "od_invoice_time";
+ $sort2 = "desc";
+ break;
+ }
+}
+
+if ($od_settle_case) {
+ if( $od_settle_case === '간편결제' ) {
+ $where[] = " od_settle_case in ('간편결제', '삼성페이', 'lpay', 'inicis_kakaopay') ";
+ } else {
+ $where[] = " od_settle_case = '$od_settle_case' ";
+ }
+}
+
+if ($od_misu) {
+ $where[] = " od_misu != 0 ";
+}
+
+if ($od_cancel_price) {
+ $where[] = " od_cancel_price != 0 ";
+}
+
+if ($od_refund_price) {
+ $where[] = " od_refund_price != 0 ";
+}
+
+if ($od_receipt_point) {
+ $where[] = " od_receipt_point != 0 ";
+}
+
+if ($od_coupon) {
+ $where[] = " ( od_cart_coupon > 0 or od_coupon > 0 or od_send_coupon > 0 ) ";
+}
+
+if ($od_escrow) {
+ $where[] = " od_escrow = 1 ";
+}
+
+if ($fr_date && $to_date) {
+ $where[] = " od_time between '$fr_date 00:00:00' and '$to_date 23:59:59' ";
+}
+
+if ($where) {
+ $sql_search = ' where '.implode(' and ', $where);
+}
+
+if ($sel_field == "") $sel_field = "od_id";
+if ($sort1 == "") $sort1 = "od_id";
+if ($sort2 == "") $sort2 = "desc";
+
+$sql_common = " from {$g5['g5_shop_order_table']} $sql_search ";
+
+$sql = " select count(od_id) as cnt " . $sql_common;
+$row = sql_fetch($sql);
+$total_count = $row['cnt'];
+
+$rows = $config['cf_page_rows'];
+$total_page = ceil($total_count / $rows); // 전체 페이지 계산
+if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
+$from_record = ($page - 1) * $rows; // 시작 열을 구함
+
+$sql = " select *,
+ (od_cart_coupon + od_coupon + od_send_coupon) as couponprice
+ $sql_common
+ order by $sort1 $sort2
+ limit $from_record, $rows ";
+$result = sql_query($sql);
+
+$qstr1 = "od_status=".urlencode($od_status)."&od_settle_case=".urlencode($od_settle_case)."&od_misu=$od_misu&od_cancel_price=$od_cancel_price&od_refund_price=$od_refund_price&od_receipt_point=$od_receipt_point&od_coupon=$od_coupon&fr_date=$fr_date&to_date=$to_date&sel_field=$sel_field&search=$search&save_search=$search";
+if($default['de_escrow_use'])
+ $qstr1 .= "&od_escrow=$od_escrow";
+$qstr = "$qstr1&sort1=$sort1&sort2=$sort2&page=$page";
+
+$listall = '전체목록';
+
+// 주문삭제 히스토리 테이블 필드 추가
+if(!sql_query(" select mb_id from {$g5['g5_shop_order_delete_table']} limit 1 ", false)) {
+ sql_query(" ALTER TABLE `{$g5['g5_shop_order_delete_table']}`
+ ADD `mb_id` varchar(20) NOT NULL DEFAULT '' AFTER `de_data`,
+ ADD `de_ip` varchar(255) NOT NULL DEFAULT '' AFTER `mb_id`,
+ ADD `de_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `de_ip` ", true);
+}
+
+if( function_exists('pg_setting_check') ){
+ pg_setting_check(true);
+}
+?>
+
+
+
+
전체 주문내역 건
+ 0) { ?>
+
엑셀배송처리
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+";
+
+ $current_status = $od['od_status'];
+ $change_status = isset($_POST['od_status']) ? clean_xss_tags($_POST['od_status'], 1, 1) : '';
+
+ switch ($current_status)
+ {
+ case '주문' :
+ if ($change_status != '입금') continue 2;
+ if ($od['od_settle_case'] != '무통장') continue 2;
+ change_status($od_id, '주문', '입금');
+ order_update_receipt($od_id);
+
+ // SMS
+ if($config['cf_sms_use'] == 'icode' && $send_sms && $default['de_sms_use4']) {
+ $sms_contents = conv_sms_contents($od_id, $default['de_sms_cont4']);
+ if($sms_contents) {
+ $receive_number = preg_replace("/[^0-9]/", "", $od['od_hp']); // 수신자번호
+ $send_number = preg_replace("/[^0-9]/", "", $default['de_admin_company_tel']); // 발신자번호
+
+ if($receive_number)
+ $sms_messages[] = array('recv' => $receive_number, 'send' => $send_number, 'cont' => $sms_contents);
+ }
+ }
+
+ // 메일
+ if($config['cf_email_use'] && $od_send_mail)
+ include './ordermail.inc.php';
+
+ break;
+
+ case '입금' :
+ if ($change_status != '준비') continue 2;
+ change_status($od_id, '입금', '준비');
+ break;
+
+ case '준비' :
+ if ($change_status != '배송') continue 2;
+
+ $delivery['invoice'] = $invoice;
+ $delivery['invoice_time'] = $invoice_time;
+ $delivery['delivery_company'] = $delivery_company;
+
+ order_update_delivery($od_id, $od['mb_id'], $change_status, $delivery);
+ change_status($od_id, '준비', '배송');
+
+ // SMS
+ if($config['cf_sms_use'] == 'icode' && $send_sms && $default['de_sms_use5']) {
+ $sms_contents = conv_sms_contents($od_id, $default['de_sms_cont5']);
+ if($sms_contents) {
+ $receive_number = preg_replace("/[^0-9]/", "", $od['od_hp']); // 수신자번호
+ $send_number = preg_replace("/[^0-9]/", "", $default['de_admin_company_tel']); // 발신자번호
+
+ if($receive_number)
+ $sms_messages[] = array('recv' => $receive_number, 'send' => $send_number, 'cont' => $sms_contents);
+ }
+ }
+
+ // 메일
+ if($config['cf_email_use'] && $od_send_mail)
+ include './ordermail.inc.php';
+
+ // 에스크로 배송
+ if($send_escrow && $od['od_tno'] && $od['od_escrow']) {
+ $escrow_tno = $od['od_tno'];
+ $escrow_numb = $invoice;
+ $escrow_corp = $delivery_company;
+
+ include(G5_SHOP_PATH.'/'.$od['od_pg'].'/escrow.register.php');
+ }
+
+ break;
+
+ case '배송' :
+ if ($change_status != '완료') continue 2;
+ change_status($od_id, '배송', '완료');
+
+ // 완료인 경우에만 상품구입 합계수량을 상품테이블에 저장한다.
+ $sql2 = " select it_id from {$g5['g5_shop_cart_table']} where od_id = '$od_id' and ct_status = '완료' group by it_id ";
+ $result2 = sql_query($sql2);
+ for ($k=0; $row2=sql_fetch_array($result2); $k++) {
+ $sql3 = " select sum(ct_qty) as sum_qty from {$g5['g5_shop_cart_table']} where it_id = '{$row2['it_id']}' and ct_status = '완료' ";
+ $row3 = sql_fetch($sql3);
+
+ $sql4 = " update {$g5['g5_shop_item_table']} set it_sum_qty = '{$row3['sum_qty']}' where it_id = '{$row2['it_id']}' ";
+ sql_query($sql4);
+ }
+ /*
+ $sql2 = " select it_id, sum(ct_qty) as sum_qty from {$g5['g5_shop_cart_table']} where od_id = '$od_id' and ct_status = '완료' group by it_id ";
+ $result2 = sql_query($sql2);
+ for ($k=0; $row2=sql_fetch_array($result2); $k++) {
+ $sql3 = " update {$g5['g5_shop_item_table']} set it_sum_qty = it_sum_qty + '{$row2['sum_qty']}' where it_id = '{$row2['it_id']}' ";
+ sql_query($sql3);
+ }
+ */
+ break;
+
+ } // switch end
+
+
+ // 주문정보
+ $info = get_order_info($od_id);
+ if(!$info) continue;
+
+ $sql = " update {$g5['g5_shop_order_table']}
+ set od_misu = '{$info['od_misu']}',
+ od_tax_mny = '{$info['od_tax_mny']}',
+ od_vat_mny = '{$info['od_vat_mny']}',
+ od_free_mny = '{$info['od_free_mny']}',
+ od_send_cost = '{$info['od_send_cost']}'
+ where od_id = '$od_id' ";
+ sql_query($sql, true);
+
+}
+
+// SMS
+$sms_count = count($sms_messages);
+if($sms_count > 0) {
+ if($config['cf_sms_type'] == 'LMS') {
+ include_once(G5_LIB_PATH.'/icode.lms.lib.php');
+
+ $port_setting = get_icode_port_type($config['cf_icode_id'], $config['cf_icode_pw']);
+
+ // SMS 모듈 클래스 생성
+ if($port_setting !== false) {
+ $SMS = new LMS;
+ $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $port_setting);
+
+ for($s=0; $s<$sms_count; $s++) {
+ $strDest = array();
+ $strDest[] = $sms_messages[$s]['recv'];
+ $strCallBack = $sms_messages[$s]['send'];
+ $strCaller = iconv_euckr(trim($default['de_admin_company_name']));
+ $strSubject = '';
+ $strURL = '';
+ $strData = iconv_euckr($sms_messages[$s]['cont']);
+ $strDate = '';
+ $nCount = count($strDest);
+
+ $res = $SMS->Add($strDest, $strCallBack, $strCaller, $strSubject, $strURL, $strData, $strDate, $nCount);
+
+ $SMS->Send();
+ $SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
+ }
+ }
+ } else {
+ include_once(G5_LIB_PATH.'/icode.sms.lib.php');
+
+ $SMS = new SMS; // SMS 연결
+ $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']);
+
+ for($s=0; $s<$sms_count; $s++) {
+ $recv_number = $sms_messages[$s]['recv'];
+ $send_number = $sms_messages[$s]['send'];
+ $sms_content = iconv_euckr($sms_messages[$s]['cont']);
+
+ $SMS->Add($recv_number, $send_number, $config['cf_icode_id'], $sms_content, "");
+ }
+
+ $SMS->Send();
+ $SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
+ }
+}
+
+$qstr = "sort1=$sort1&sort2=$sort2&sel_field=$sel_field&search=$search";
+$qstr .= "&od_status=$od_status";
+$qstr .= "&od_settle_case=$od_settle_case";
+$qstr .= "&od_misu=$od_misu";
+$qstr .= "&od_cancel_price=$od_cancel_price";
+$qstr .= "&od_receipt_price=$od_receipt_price";
+$qstr .= "&od_receipt_point=$od_receipt_point";
+$qstr .= "&od_receipt_coupon=$od_receipt_coupon";
+//$qstr .= "&page=$page";
+
+//exit;
+
+goto_url("./orderlist.php?$qstr");
\ No newline at end of file
diff --git a/adm/shop_admin/ordermail.inc.php b/adm/shop_admin/ordermail.inc.php
new file mode 100644
index 000000000..9e3bccd3e
--- /dev/null
+++ b/adm/shop_admin/ordermail.inc.php
@@ -0,0 +1,108 @@
+ 0 && $od['od_settle_case'] == '신용카드') {
+ $card_list['od_receipt_time'] = $od['od_receipt_time'];
+ $card_list['od_receipt_price'] = display_price($od['od_receipt_price']);
+
+ $is_receipt = true;
+ }
+
+ // 무통장 입금
+ if ($od['od_receipt_price'] > 0 && $od['od_settle_case'] == '무통장') {
+ $bank_list['od_receipt_time'] = $od['od_receipt_time'];
+ $bank_list['od_receipt_price'] = display_price($od['od_receipt_price']);
+ $bank_list['od_deposit_name'] = $od['od_deposit_name'];
+
+ $is_receipt = true;
+ }
+
+ // 포인트 입금
+ if ($od['od_receipt_point'] > 0) {
+ $point_list['od_time'] = $od['od_time'];
+ $point_list['od_receipt_point'] = display_point($od['od_receipt_point']);
+
+ $is_receipt = true;
+ }
+
+ // 배송정보
+ $is_delivery = false;
+ if ($od['od_delivery_company'] && $od['od_invoice']) {
+ $delivery_list['dl_company'] = $od['od_delivery_company'];
+ $delivery_list['od_invoice'] = $od['od_invoice'];
+ $delivery_list['od_invoice_time'] = $od['od_invoice_time'];
+ $delivery_list['dl_inquiry'] = get_delivery_inquiry($od['od_delivery_company'], $od['od_invoice'], 'dvr_link');
+
+ $is_delivery = true;
+ }
+
+ // 입금 또는 배송내역이 있다면 메일 발송
+ if ($is_receipt || $is_delivery)
+ {
+ ob_start();
+ include G5_SHOP_PATH.'/mail/ordermail.mail.php';
+ $content = ob_get_contents();
+ ob_end_clean();
+
+ $title = $config['cf_title'].' - '.$od['od_name'].'님 주문 처리 내역 안내';
+ $email = $od['od_email'];
+
+ // 메일 보낸 내역 상점메모에 update
+ $od_shop_memo = G5_TIME_YMDHIS.' - 결제/배송내역 메일발송\n' . $od['od_shop_memo'];
+ /* 1.00.06
+ ** 주석처리 - 처리하지 않음
+ if ($receipt_check)
+ $od_shop_memo .= ", 입금확인";
+ if ($invoice_check)
+ $od_shop_memo .= ", 송장번호";
+ */
+
+ sql_query(" update {$g5['g5_shop_order_table']} set od_shop_memo = '$od_shop_memo' where od_id = '$od_id' ");
+
+ mailer($config['cf_admin_email_name'], $config['cf_admin_email'], $email, $title, $content, 1);
+ }
+}
\ No newline at end of file
diff --git a/adm/shop_admin/orderpartcancel.php b/adm/shop_admin/orderpartcancel.php
new file mode 100644
index 000000000..089482f95
--- /dev/null
+++ b/adm/shop_admin/orderpartcancel.php
@@ -0,0 +1,107 @@
+= G5_TIME_YMD)
+ alert_close('실시간 계좌이체건의 부분취소 요청은 결제일 익일에 가능합니다.');
+
+if($od['od_receipt_price'] - $od['od_refund_price'] <= 0)
+ alert_close('부분취소 처리할 금액이 없습니다.');
+
+$g5['title'] = $od['od_settle_case'].' 부분취소';
+include_once(G5_PATH.'/head.sub.php');
+
+// 취소가능금액
+$od_misu = abs($od['od_misu']);
+?>
+
+
+
+
+
+= G5_TIME_YMD)
+ alert_close('실시간 계좌이체건의 부분취소 요청은 결제일 익일에 가능합니다.');
+
+// 금액비교
+$od_misu = abs($od['od_misu']);
+
+if(($tax_mny && $free_mny) && ($tax_mny + $free_mny) > $od_misu)
+ alert('과세, 비과세 취소금액의 합을 '.display_price($od_misu).' 이하로 입력해 주십시오.');
+
+if($tax_mny && $tax_mny > $od_misu)
+ alert('과세 취소금액을 '.display_price($od_misu).' 이하로 입력해 주십시오.');
+
+if($free_mny && $free_mny > $od_misu)
+ alert('비과세 취소금액을 '.display_price($od_misu).' 이하로 입력해 주십시오.');
+
+// PG사별 부분취소 실행
+include_once(G5_SHOP_PATH.'/'.strtolower($od['od_pg']).'/orderpartcancel.inc.php');
+
+include_once(G5_PATH.'/head.sub.php');
+?>
+
+
+
+
+
+
+
+
+
+
+
기간별 혹은 주문번호구간별 주문내역을 새창으로 출력할 수 있습니다.
+
+
+
+
+= '5.2.0') {
+ include_once(G5_LIB_PATH.'/PHPExcel.php');
+
+ $headers = array('우편번호', '주소', '이름', '전화1', '전화2', '상품명', '수량', '선택사항', '배송비', '상품코드', '주문번호', '운송장번호', '전하실말씀');
+ $widths = array(10, 30, 10, 15, 15, 15, 10, 10, 20, 15, 20, 20, 50);
+ $header_bgcolor = 'FFABCDEF';
+ $last_char = column_char(count($headers) - 1);
+
+ for($i=1; $row=sql_fetch_array($result); $i++) {
+
+ $pull_address = print_address($row['od_b_addr1'], $row['od_b_addr2'], $row['od_b_addr3'], $row['od_b_addr_jibeon']);
+
+ $save_it_id = '';
+ $ct_send_cost = '';
+ if($save_it_id != $row['it_id']) {
+ // 합계금액 계산
+ $sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
+ SUM(ct_qty) as qty
+ from {$g5['g5_shop_cart_table']}
+ where it_id = '{$row['it_id']}'
+ and od_id = '{$row['od_id']}' ";
+ $sum = sql_fetch($sql);
+
+ switch($row['ct_send_cost'])
+ {
+ case 1:
+ $ct_send_cost = '착불';
+ break;
+ case 2:
+ $ct_send_cost = '무료';
+ break;
+ default:
+ $ct_send_cost = '선불';
+ break;
+ }
+
+ // 조건부무료
+ if($row['it_sc_type'] == 2) {
+ $sendcost = get_item_sendcost($row['it_id'], $sum['price'], $sum['qty'], $row['od_id']);
+
+ if($sendcost == 0)
+ $ct_send_cost = '무료';
+ }
+
+ $save_it_id = $row['it_id'];
+
+ $ct_send_cost = $ct_send_cost;
+ }
+
+ $rows[] = array(' '.$row['od_b_zip1'].$row['od_b_zip2'],
+ $pull_address,
+ $row['od_b_name'],
+ ' '.conv_telno($row['od_b_tel']),
+ ' '.conv_telno($row['od_b_hp']),
+ preg_replace("/\"/", """, $row['it_name']),
+ ' '.$row['ct_qty'],
+ $row['ct_option'],
+ $ct_send_cost,
+ ' '.$row['it_id'],
+ ' '.$row['od_id'],
+ ' '.$row['od_invoice'],
+ preg_replace("/\"/", """, $row['od_memo']));
+ }
+
+ $data = array_merge(array($headers), $rows);
+
+ $excel = new PHPExcel();
+ $excel->setActiveSheetIndex(0)->getStyle( "A1:${last_char}1" )->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB($header_bgcolor);
+ $excel->setActiveSheetIndex(0)->getStyle( "A:$last_char" )->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER)->setWrapText(true);
+ foreach($widths as $i => $w) $excel->setActiveSheetIndex(0)->getColumnDimension( column_char($i) )->setWidth($w);
+ $excel->getActiveSheet()->fromArray($data,NULL,'A1');
+
+ header("Content-Type: application/octet-stream");
+ header("Content-Disposition: attachment; filename=\"orderlist-".date("ymd", time()).".xls\"");
+ header("Cache-Control: max-age=0");
+
+ $writer = PHPExcel_IOFactory::createWriter($excel, 'Excel5');
+ $writer->save('php://output');
+
+ } else {
+ /*================================================================================
+ php_writeexcel http://www.bettina-attack.de/jonny/view.php/projects/php_writeexcel/
+ =================================================================================*/
+
+ include_once(G5_LIB_PATH.'/Excel/php_writeexcel/class.writeexcel_workbook.inc.php');
+ include_once(G5_LIB_PATH.'/Excel/php_writeexcel/class.writeexcel_worksheet.inc.php');
+
+ $fname = tempnam(G5_DATA_PATH, "tmp-orderlist.xls");
+ $workbook = new writeexcel_workbook($fname);
+ $worksheet = $workbook->addworksheet();
+
+ // Put Excel data
+ $data = array('우편번호', '주소', '이름', '전화1', '전화2', '상품명', '수량', '선택사항', '배송비', '상품코드', '주문번호', '운송장번호', '전하실말씀');
+ $data = array_map('iconv_euckr', $data);
+
+ $col = 0;
+ foreach($data as $cell) {
+ $worksheet->write(0, $col++, $cell);
+ }
+
+ $save_it_id = '';
+ for($i=1; $row=sql_fetch_array($result); $i++)
+ {
+ if($save_it_id != $row['it_id']) {
+ // 합계금액 계산
+ $sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
+ SUM(ct_qty) as qty
+ from {$g5['g5_shop_cart_table']}
+ where it_id = '{$row['it_id']}'
+ and od_id = '{$row['od_id']}' ";
+ $sum = sql_fetch($sql);
+
+ switch($row['ct_send_cost'])
+ {
+ case 1:
+ $ct_send_cost = '착불';
+ break;
+ case 2:
+ $ct_send_cost = '무료';
+ break;
+ default:
+ $ct_send_cost = '선불';
+ break;
+ }
+
+ // 조건부무료
+ if($row['it_sc_type'] == 2) {
+ $sendcost = get_item_sendcost($row['it_id'], $sum['price'], $sum['qty'], $row['od_id']);
+
+ if($sendcost == 0)
+ $ct_send_cost = '무료';
+ }
+
+ $save_it_id = $row['it_id'];
+
+ $ct_send_cost = iconv_euckr($ct_send_cost);
+ }
+
+ $pull_address = iconv('UTF-8', 'UHC', print_address($row['od_b_addr1'], $row['od_b_addr2'], $row['od_b_addr3'], $row['od_b_addr_jibeon']));
+
+ $row = array_map('iconv_euckr', $row);
+
+ $worksheet->write($i, 0, ' '.$row['od_b_zip1'].$row['od_b_zip2']);
+ $worksheet->write($i, 1, $pull_address);
+ $worksheet->write($i, 2, $row['od_b_name']);
+ $worksheet->write($i, 3, ' '.$row['od_b_tel']);
+ $worksheet->write($i, 4, ' '.$row['od_b_hp']);
+ $worksheet->write($i, 5, $row['it_name']);
+ $worksheet->write($i, 6, $row['ct_qty']);
+ $worksheet->write($i, 7, $row['ct_option']);
+ $worksheet->write($i, 8, $ct_send_cost);
+ $worksheet->write($i, 9, ' '.$row['it_id']);
+ $worksheet->write($i, 10, ' '.$row['od_id']);
+ $worksheet->write($i, 11, $row['od_invoice']);
+ $worksheet->write($i, 12, $row['od_memo']);
+ }
+
+ $workbook->close();
+
+ header("Content-Type: application/x-msexcel; name=\"orderlist-".date("ymd", time()).".xls\"");
+ header("Content-Disposition: inline; filename=\"orderlist-".date("ymd", time()).".xls\"");
+ $fh=fopen($fname, "rb");
+ fpassthru($fh);
+ unlink($fname);
+
+ exit;
+ } //end if php 5.2.0
+}
+
+
+function get_order($od_id)
+{
+ global $g5;
+
+ $sql = " select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' ";
+ return sql_fetch($sql);
+}
+
+$g5['title'] = "주문내역";
+include_once(G5_PATH.'/head.sub.php');
+
+if ($case == 1)
+{
+ $fr_date = date_conv($fr_date);
+ $to_date = date_conv($to_date);
+ $sql = " SELECT DISTINCT a.od_id FROM {$g5['g5_shop_order_table']} a, {$g5['g5_shop_cart_table']} b
+ where a.od_id = b.od_id
+ and a.od_time between '$fr_date 00:00:00' and '$to_date 23:59:59' ";
+}
+else
+{
+ $sql = " SELECT DISTINCT a.od_id FROM {$g5['g5_shop_order_table']} a, {$g5['g5_shop_cart_table']} b
+ where a.od_id = b.od_id
+ and a.od_id between '$fr_od_id' and '$to_od_id' ";
+}
+if ($ct_status)
+ $sql .= " and b.ct_status = '$ct_status' ";
+$sql .= " order by a.od_id ";
+
+$result = sql_query($sql);
+if (sql_num_rows($result) == 0)
+{
+ echo "";
+ exit;
+}
+?>
+
+
+
+
+
+
+
+
+
+
주문번호
+
보내는 사람 :
+
+
+ - 주소
+
+ - 휴대폰
+
+ - 전화번호
+
+
+
+
보내는 사람과 받는 사람이 동일합니다.
+
+
받는 사람 :
+
+ - 주소
+
+ - 휴대폰
+
+ - 전화번호
+
+
+
+
+
주문 목록
+
+
+ 주문 목록
+
+
+ | 상품명(선택사항) |
+ 판매가 |
+ 수량 |
+ 소계 |
+ 배송비 |
+
+
+
+ = 0)
+ $price_plus = '+';
+
+ $it_name = "$it_name ({$row2['ct_option']} ".$price_plus.display_price($row2['io_price']).")";
+
+ if($save_it_id != $row2['it_id']) {
+ switch($row2['ct_send_cost'])
+ {
+ case 1:
+ $ct_send_cost = '착불';
+ break;
+ case 2:
+ $ct_send_cost = '무료';
+ break;
+ default:
+ $ct_send_cost = '선불';
+ break;
+ }
+
+ // 합계금액 계산
+ $sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
+ SUM(ct_qty) as qty
+ from {$g5['g5_shop_cart_table']}
+ where it_id = '{$row2['it_id']}'
+ and od_id = '{$row2['od_id']}' ";
+ $sum = sql_fetch($sql);
+
+ // 조건부무료
+ if($row2['it_sc_type'] == 2) {
+ $sendcost = get_item_sendcost($row2['it_id'], $sum['price'], $sum['qty'], $row['od_id']);
+
+ if($sendcost == 0)
+ $ct_send_cost = '무료';
+ }
+
+ $save_it_id = $row2['it_id'];
+ }
+
+ $fontqty1 = $fontqty2 = "";
+ if ($row2['ct_qty'] >= 2)
+ {
+ $fontqty1 = "";
+ $fontqty2 = "";
+ }
+
+ ?>
+
+ |
+ |
+ |
+ |
+ |
+
+
+
+ | 배송비 |
+ |
+ 1 |
+ |
+ |
+
+
+ | 추가 배송비 |
+ |
+ 1 |
+ |
+ |
+
+
+
+
+ | 합계 |
+ |
+ |
+ |
+
+
+
+
+
비고 $od_memo";
+ if ($od_shop_memo) $od_shop_memo = "
상점메모 $od_shop_memo
";
+
+ echo "
+ $od_memo
+ $od_shop_memo
+ ";
+ ?>
+
+
+
+
+
+
+ 전체
+ 개
+ 원
+
+ <출력 끝>
+
+
+
+
+
+