first commit 2
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
define('G5_IS_ADMIN', true);
|
||||
define('G5_IS_SHOP_ADMIN_PAGE', true);
|
||||
include_once ('../../common.php');
|
||||
|
||||
if (!defined('G5_USE_SHOP') || !G5_USE_SHOP)
|
||||
die('<p>쇼핑몰 설치 후 이용해 주십시오.</p>');
|
||||
|
||||
include_once(G5_ADMIN_PATH.'/admin.lib.php');
|
||||
include_once('./admin.shop.lib.php');
|
||||
|
||||
run_event('admin_common');
|
||||
|
||||
check_order_inicis_tmps();
|
||||
@@ -0,0 +1,238 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
// 상품옵션별재고 또는 상품재고에 더하기
|
||||
function add_io_stock($it_id, $ct_qty, $io_id="", $io_type=0)
|
||||
{
|
||||
global $g5;
|
||||
|
||||
if($io_id) {
|
||||
$sql = " update {$g5['g5_shop_item_option_table']}
|
||||
set io_stock_qty = io_stock_qty + '{$ct_qty}'
|
||||
where it_id = '{$it_id}'
|
||||
and io_id = '{$io_id}'
|
||||
and io_type = '{$io_type}' ";
|
||||
} else {
|
||||
$sql = " update {$g5['g5_shop_item_table']}
|
||||
set it_stock_qty = it_stock_qty + '{$ct_qty}'
|
||||
where it_id = '{$it_id}' ";
|
||||
}
|
||||
return sql_query($sql);
|
||||
}
|
||||
|
||||
|
||||
// 상품옵션별재고 또는 상품재고에서 빼기
|
||||
function subtract_io_stock($it_id, $ct_qty, $io_id="", $io_type=0)
|
||||
{
|
||||
global $g5;
|
||||
|
||||
if($io_id) {
|
||||
$sql = " update {$g5['g5_shop_item_option_table']}
|
||||
set io_stock_qty = io_stock_qty - '{$ct_qty}'
|
||||
where it_id = '{$it_id}'
|
||||
and io_id = '{$io_id}'
|
||||
and io_type = '{$io_type}' ";
|
||||
} else {
|
||||
$sql = " update {$g5['g5_shop_item_table']}
|
||||
set it_stock_qty = it_stock_qty - '{$ct_qty}'
|
||||
where it_id = '{$it_id}' ";
|
||||
}
|
||||
return sql_query($sql);
|
||||
}
|
||||
|
||||
|
||||
// 주문과 장바구니의 상태를 변경한다.
|
||||
function change_status($od_id, $current_status, $change_status)
|
||||
{
|
||||
global $g5;
|
||||
|
||||
$sql = " update {$g5['g5_shop_order_table']} set od_status = '{$change_status}' where od_id = '{$od_id}' and od_status = '{$current_status}' ";
|
||||
sql_query($sql, true);
|
||||
|
||||
$sql = " update {$g5['g5_shop_cart_table']} set ct_status = '{$change_status}' where od_id = '{$od_id}' and ct_status = '{$current_status}' ";
|
||||
sql_query($sql, true);
|
||||
}
|
||||
|
||||
|
||||
// 주문서에 입금시 update
|
||||
function order_update_receipt($od_id)
|
||||
{
|
||||
global $g5;
|
||||
|
||||
$sql = " update {$g5['g5_shop_order_table']} set od_receipt_price = od_misu, od_misu = 0, od_receipt_time = '".G5_TIME_YMDHIS."' where od_id = '$od_id' and od_status = '입금' ";
|
||||
return sql_query($sql);
|
||||
}
|
||||
|
||||
|
||||
// 주문서에 배송시 update
|
||||
function order_update_delivery($od_id, $mb_id, $change_status, $delivery)
|
||||
{
|
||||
global $g5;
|
||||
|
||||
if($change_status != '배송')
|
||||
return;
|
||||
|
||||
$sql = " update {$g5['g5_shop_order_table']} set od_delivery_company = '".sql_real_escape_string($delivery['delivery_company'])."', od_invoice = '".sql_real_escape_string($delivery['invoice'])."', od_invoice_time = '".sql_real_escape_string($delivery['invoice_time'])."' where od_id = '$od_id' and od_status = '준비' ";
|
||||
sql_query($sql);
|
||||
|
||||
$sql = " select * from {$g5['g5_shop_cart_table']} where od_id = '$od_id' ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
// 재고를 사용하지 않았다면
|
||||
$stock_use = $row['ct_stock_use'];
|
||||
|
||||
if(!$row['ct_stock_use'])
|
||||
{
|
||||
// 재고에서 뺀다.
|
||||
subtract_io_stock($row['it_id'], $row['ct_qty'], $row['io_id'], $row['io_type']);
|
||||
$stock_use = 1;
|
||||
|
||||
$sql = " update {$g5['g5_shop_cart_table']} set ct_stock_use = '$stock_use' where ct_id = '{$row['ct_id']}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 처리내용 SMS
|
||||
function conv_sms_contents($od_id, $contents)
|
||||
{
|
||||
global $g5, $config, $default;
|
||||
|
||||
$sms_contents = '';
|
||||
|
||||
if ($od_id && $config['cf_sms_use'] == 'icode')
|
||||
{
|
||||
$sql = " select od_id, od_name, od_invoice, od_receipt_price, od_delivery_company
|
||||
from {$g5['g5_shop_order_table']} where od_id = '$od_id' ";
|
||||
$od = sql_fetch($sql);
|
||||
|
||||
$sms_contents = $contents;
|
||||
$sms_contents = str_replace("{이름}", $od['od_name'], $sms_contents);
|
||||
$sms_contents = str_replace("{입금액}", number_format($od['od_receipt_price']), $sms_contents);
|
||||
$sms_contents = str_replace("{택배회사}", $od['od_delivery_company'], $sms_contents);
|
||||
$sms_contents = str_replace("{운송장번호}", $od['od_invoice'], $sms_contents);
|
||||
$sms_contents = str_replace("{주문번호}", $od['od_id'], $sms_contents);
|
||||
$sms_contents = str_replace("{회사명}", $default['de_admin_company_name'], $sms_contents);
|
||||
}
|
||||
|
||||
return stripslashes($sms_contents);
|
||||
}
|
||||
|
||||
function pg_setting_check($is_print=false){
|
||||
global $g5, $config, $default, $member;
|
||||
|
||||
$msg = '';
|
||||
$pg_msg = '';
|
||||
|
||||
if( $default['de_card_test'] ){
|
||||
if( $default['de_pg_service'] === 'kcp' && $default['de_kcp_mid'] && $default['de_kcp_site_key'] ){
|
||||
$pg_msg = 'NHN KCP';
|
||||
} else if ( $default['de_pg_service'] === 'lg' && $config['cf_lg_mid'] && $config['cf_lg_mert_key'] ){
|
||||
$pg_msg = 'LG유플러스';
|
||||
} else if ( $default['de_pg_service'] === 'inicis' && $default['de_inicis_mid'] && $default['de_inicis_sign_key'] ){
|
||||
$pg_msg = 'KG이니시스';
|
||||
} else if ( $default['de_pg_service'] === 'nicepay' && $default['de_nicepay_mid'] && $default['de_nicepay_key'] ){
|
||||
$pg_msg = 'NICEPAY';
|
||||
}
|
||||
}
|
||||
|
||||
if( function_exists('is_use_easypay') && is_use_easypay('global_nhnkcp') ){
|
||||
if(!extension_loaded('soap') || !class_exists('SOAPClient')) {
|
||||
$msg .= '<script>'.PHP_EOL;
|
||||
$msg .= 'alert("PHP SOAP 확장모듈이 설치되어 있지 않습니다.\n모바일 쇼핑몰 결제 때 사용되오니 SOAP 확장 모듈을 설치하여 주십시오.\nNHN_KCP (네이버페이) 모바일결제가 되지 않습니다.");'.PHP_EOL;
|
||||
$msg .= '</script>'.PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
if( $pg_msg ){
|
||||
$pg_test_conf_link = G5_ADMIN_URL.'/shop_admin/configform.php#de_card_test1';
|
||||
$msg .= '<div class="admin_pg_notice od_test_caution">(주의!) '.$pg_msg.' 결제의 결제 설정이 현재 테스트결제 로 되어 있습니다.<br>테스트결제시 실제 결제가 되지 않으므로, 쇼핑몰 운영중이면 반드시 실결제로 설정하여 운영하셔야 합니다.<br>아래 링크를 클릭하여 실결제로 설정하여 운영해 주세요.<br><a href="'.$pg_test_conf_link.'" class="pg_test_conf_link">'.$pg_test_conf_link.'</a></div>';
|
||||
}
|
||||
|
||||
if( $is_print ){
|
||||
echo $msg;
|
||||
} else{
|
||||
return $msg;
|
||||
}
|
||||
}
|
||||
|
||||
function is_cancel_shop_pg_order($od){
|
||||
|
||||
$is_od_pg_cancel = false;
|
||||
|
||||
if (($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']))) {
|
||||
$is_od_pg_cancel = true;
|
||||
}
|
||||
|
||||
if ($od['od_pg'] === 'nicepay' && in_array($od['od_settle_case'], array('계좌이체', '휴대폰'))) {
|
||||
$is_od_pg_cancel = true;
|
||||
}
|
||||
|
||||
return $is_od_pg_cancel;
|
||||
}
|
||||
|
||||
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 .= '<a href="'.G5_ADMIN_URL.'/shop_admin/inorderform.php?od_id='.$oid.'" target="_blank" >미완료 발생 주문번호 : '.$oid.'</a><br><br>';
|
||||
|
||||
}
|
||||
|
||||
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'].' 사이트 미완료 주문 알림', '이니시스를 통해 결제한 주문건 중에서 미완료 주문이 발생했습니다.<br><br>발생된 원인으로는 장바구니 금액와 실결제 금액이 맞지 않는 경우, 네트워크 오류, 프로그램 오류, 알수 없는 오류 등이 있습니다.<br><br>아래 내용과 실제 주문내역, 이니시스 상점 관리자 에서 결제된 내용을 확인하여 조치를 취해 주세요.<br><br>'.$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;
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$ca_id = isset($_POST['ca_id']) ? trim($_POST['ca_id']) : '';
|
||||
if (preg_match("/[^0-9a-z]/i", $ca_id)) {
|
||||
die("{\"error\":\"분류코드는 영문자 숫자 만 입력 가능합니다.\"}");
|
||||
}
|
||||
|
||||
$sql = " select ca_name from {$g5['g5_shop_category_table']} where ca_id = '{$ca_id}' ";
|
||||
$row = sql_fetch($sql);
|
||||
if (isset($row['ca_name']) && $row['ca_name']) {
|
||||
$ca_name = addslashes($row['ca_name']);
|
||||
die("{\"error\":\"이미 등록된 분류코드 입니다.\\n\\n분류명 : {$ca_name}\"}");
|
||||
}
|
||||
|
||||
die("{\"error\":\"\"}"); // 정상;
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$it_id = isset($_POST['it_id']) ? trim($_POST['it_id']) : '';
|
||||
if (preg_match("/[^\w\-]/", $it_id)) { // \w : 0-9 A-Z a-z _
|
||||
die("{\"error\":\"상품코드는 영문자 숫자 _ - 만 입력 가능합니다.\"}");
|
||||
}
|
||||
|
||||
$row = get_shop_item($it_id, true);
|
||||
if (isset($row['it_name']) && $row['it_name']) {
|
||||
$it_name = addslashes($row['it_name']);
|
||||
die("{\"error\":\"이미 등록된 상품코드 입니다.\\n\\n상품명 : {$it_name}\"}");
|
||||
}
|
||||
|
||||
die("{\"error\":\"\"}"); // 정상;
|
||||
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
$sub_menu = '400400';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$od_id = isset($_POST['od_id']) ? safe_replace_regex($_POST['od_id'], 'od_id') : 0;
|
||||
|
||||
$sql = " select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' ";
|
||||
$od = sql_fetch($sql);
|
||||
|
||||
if(! ($od['od_id'] && $od['od_id']))
|
||||
die('<div>주문정보가 존재하지 않습니다.</div>');
|
||||
|
||||
// 상품목록
|
||||
$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);
|
||||
?>
|
||||
|
||||
<section id="cart_list">
|
||||
<h2 class="h2_frm">주문상품 목록</h2>
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption>주문 상품 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">상품명</th>
|
||||
<th scope="col">옵션항목</th>
|
||||
<th scope="col">상태</th>
|
||||
<th scope="col">수량</th>
|
||||
<th scope="col">판매가</th>
|
||||
<th scope="col">소계</th>
|
||||
<th scope="col">쿠폰</th>
|
||||
<th scope="col">포인트</th>
|
||||
<th scope="col">배송비</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
// 상품이미지
|
||||
$image = get_it_image($row['it_id'], 50, 50);
|
||||
|
||||
// 상품의 옵션정보
|
||||
$sql = " select ct_id, it_id, ct_price, ct_qty, ct_option, ct_status, cp_price, ct_send_cost, io_type, io_price
|
||||
from {$g5['g5_shop_cart_table']}
|
||||
where od_id = '$od_id'
|
||||
and it_id = '{$row['it_id']}'
|
||||
order by io_type asc, ct_id asc ";
|
||||
$res = sql_query($sql);
|
||||
$rowspan = sql_num_rows($res);
|
||||
|
||||
// 배송비
|
||||
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) {
|
||||
|
||||
// 합계금액 계산
|
||||
$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 = '$od_id' ";
|
||||
$sum = sql_fetch($sql);
|
||||
|
||||
$sendcost = get_item_sendcost($row['it_id'], $sum['price'], $sum['qty'], $od_id);
|
||||
|
||||
if($sendcost == 0)
|
||||
$ct_send_cost = '무료';
|
||||
|
||||
$save_it_id = $row['it_id'];
|
||||
}
|
||||
|
||||
for($k=0; $opt=sql_fetch_array($res); $k++) {
|
||||
if($opt['io_type'])
|
||||
$opt_price = $opt['io_price'];
|
||||
else
|
||||
$opt_price = $opt['ct_price'] + $opt['io_price'];
|
||||
|
||||
// 소계
|
||||
$opt['ct_point'] = isset($opt['ct_point']) ? (int) $opt['ct_point'] : 0;
|
||||
$ct_price['stotal'] = $opt_price * $opt['ct_qty'];
|
||||
$ct_point['stotal'] = $opt['ct_point'] * $opt['ct_qty'];
|
||||
?>
|
||||
<tr>
|
||||
<?php if($k == 0) { ?>
|
||||
<td class="td_itname" rowspan="<?php echo $rowspan; ?>">
|
||||
<a href="./itemform.php?w=u&it_id=<?php echo $row['it_id']; ?>"><?php echo $image; ?> <?php echo stripslashes($row['it_name']); ?></a>
|
||||
<?php if($od['od_tax_flag'] && $row['ct_notax']) echo '[비과세상품]'; ?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<td class="td_itopt_tl">
|
||||
<?php echo $opt['ct_option']; ?>
|
||||
</td>
|
||||
<td class="td_mngsmall"><?php echo $opt['ct_status']; ?></td>
|
||||
<td class="td_cntsmall"><?php echo $opt['ct_qty']; ?></td>
|
||||
<td class="td_num"><?php echo number_format($opt_price); ?></td>
|
||||
<td class="td_num"><?php echo number_format($ct_price['stotal']); ?></td>
|
||||
<td class="td_num"><?php echo number_format($opt['cp_price']); ?></td>
|
||||
<td class="td_num"><?php echo number_format($ct_point['stotal']); ?></td>
|
||||
<td class="td_sendcost_by"><?php echo $ct_send_cost; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$type = isset($_REQUEST['type']) ? clean_xss_tags($_REQUEST['type'], 1, 1) : '';
|
||||
|
||||
if($type === 'mobile') {
|
||||
if(preg_match('#^theme/(.+)$#', $dir, $match))
|
||||
$skin_dir = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/shop/'.$match[1];
|
||||
else
|
||||
$skin_dir = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/shop/'.$dir;
|
||||
} else {
|
||||
if(preg_match('#^theme/(.+)$#', $dir, $match))
|
||||
$skin_dir = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/shop/'.$match[1];
|
||||
else
|
||||
$skin_dir = G5_PATH.'/'.G5_SKIN_DIR.'/shop/'.$dir;
|
||||
}
|
||||
|
||||
echo get_list_skin_options("^list.[0-9]+\.skin\.php", $skin_dir, $sval);
|
||||
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
$sub_menu = '500500';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
$bn_id = isset($_REQUEST['bn_id']) ? preg_replace('/[^0-9]/', '', $_REQUEST['bn_id']) : 0;
|
||||
$bn = array(
|
||||
'bn_id'=>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');
|
||||
?>
|
||||
|
||||
<form name="fbanner" action="./bannerformupdate.php" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="w" value="<?php echo $w; ?>">
|
||||
<input type="hidden" name="bn_id" value="<?php echo $bn_id; ?>">
|
||||
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?></caption>
|
||||
<colgroup>
|
||||
<col class="grid_4">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">이미지</th>
|
||||
<td>
|
||||
<input type="file" name="bn_bimg">
|
||||
<?php
|
||||
$bimg_str = "";
|
||||
$bimg = G5_DATA_PATH."/banner/{$bn['bn_id']}";
|
||||
if (file_exists($bimg) && $bn['bn_id']) {
|
||||
$size = @getimagesize($bimg);
|
||||
if($size[0] && $size[0] > 750)
|
||||
$width = 750;
|
||||
else
|
||||
$width = $size[0];
|
||||
|
||||
echo '<input type="checkbox" name="bn_bimg_del" value="1" id="bn_bimg_del"> <label for="bn_bimg_del">삭제</label>';
|
||||
$bimg_str = '<img src="'.G5_DATA_URL.'/banner/'.$bn['bn_id'].'" width="'.$width.'">';
|
||||
}
|
||||
if ($bimg_str) {
|
||||
echo '<div class="banner_or_img">';
|
||||
echo $bimg_str;
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="bn_alt">이미지 설명</label></th>
|
||||
<td>
|
||||
<?php echo help("img 태그의 alt, title 에 해당되는 내용입니다.\n배너에 마우스를 오버하면 이미지의 설명이 나옵니다."); ?>
|
||||
<input type="text" name="bn_alt" value="<?php echo get_text($bn['bn_alt']); ?>" id="bn_alt" class="frm_input" size="80">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="bn_url">링크</label></th>
|
||||
<td>
|
||||
<?php echo help("배너클릭시 이동하는 주소입니다."); ?>
|
||||
<input type="text" name="bn_url" size="80" value="<?php echo get_sanitize_input($bn['bn_url']); ?>" id="bn_url" class="frm_input">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="bn_device">접속기기</label></th>
|
||||
<td>
|
||||
<?php echo help('배너를 표시할 접속기기를 선택합니다.'); ?>
|
||||
<select name="bn_device" id="bn_device">
|
||||
<option value="both"<?php echo get_selected($bn['bn_device'], 'both', true); ?>>PC와 모바일</option>
|
||||
<option value="pc"<?php echo get_selected($bn['bn_device'], 'pc'); ?>>PC</option>
|
||||
<option value="mobile"<?php echo get_selected($bn['bn_device'], 'mobile'); ?>>모바일</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="bn_position">출력위치</label></th>
|
||||
<td>
|
||||
<?php echo help("왼쪽 : 쇼핑몰화면 왼쪽에 출력합니다.\n메인 : 쇼핑몰 메인화면(index.php)에만 출력합니다."); ?>
|
||||
<select name="bn_position" id="bn_position">
|
||||
<option value="왼쪽" <?php echo get_selected($bn['bn_position'], '왼쪽'); ?>>왼쪽</option>
|
||||
<option value="메인" <?php echo get_selected($bn['bn_position'], '메인'); ?>>메인</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="bn_border">테두리</label></th>
|
||||
<td>
|
||||
<?php echo help("배너이미지에 테두리를 넣을지를 설정합니다.", 50); ?>
|
||||
<select name="bn_border" id="bn_border">
|
||||
<option value="0" <?php echo get_selected($bn['bn_border'], 0); ?>>사용안함</option>
|
||||
<option value="1" <?php echo get_selected($bn['bn_border'], 1); ?>>사용</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="bn_new_win">새창</label></th>
|
||||
<td>
|
||||
<?php echo help("배너클릭시 새창을 띄울지를 설정합니다.", 50); ?>
|
||||
<select name="bn_new_win" id="bn_new_win">
|
||||
<option value="0" <?php echo get_selected($bn['bn_new_win'], 0); ?>>사용안함</option>
|
||||
<option value="1" <?php echo get_selected($bn['bn_new_win'], 1); ?>>사용</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="bn_begin_time">시작일시</label></th>
|
||||
<td>
|
||||
<?php echo help("배너 게시 시작일시를 설정합니다."); ?>
|
||||
<input type="text" name="bn_begin_time" value="<?php echo $bn['bn_begin_time']; ?>" id="bn_begin_time" class="frm_input" size="21" maxlength="19">
|
||||
<input type="checkbox" name="bn_begin_chk" value="<?php echo date("Y-m-d 00:00:00", time()); ?>" id="bn_begin_chk" onclick="if (this.checked == true) this.form.bn_begin_time.value=this.form.bn_begin_chk.value; else this.form.bn_begin_time.value = this.form.bn_begin_time.defaultValue;">
|
||||
<label for="bn_begin_chk">오늘</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="bn_end_time">종료일시</label></th>
|
||||
<td>
|
||||
<?php echo help("배너 게시 종료일시를 설정합니다."); ?>
|
||||
<input type="text" name="bn_end_time" value="<?php echo $bn['bn_end_time']; ?>" id="bn_end_time" class="frm_input" size=21 maxlength=19>
|
||||
<input type="checkbox" name="bn_end_chk" value="<?php echo date("Y-m-d 23:59:59", time()+60*60*24*31); ?>" id="bn_end_chk" onclick="if (this.checked == true) this.form.bn_end_time.value=this.form.bn_end_chk.value; else this.form.bn_end_time.value = this.form.bn_end_time.defaultValue;">
|
||||
<label for="bn_end_chk">오늘+31일</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="bn_order">출력 순서</label></th>
|
||||
<td>
|
||||
<?php echo help("배너를 출력할 때 순서를 정합니다. 숫자가 작을수록 먼저 출력됩니다."); ?>
|
||||
<?php echo order_select("bn_order", $bn['bn_order']); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<a href="./bannerlist.php" class="btn_02 btn">목록</a>
|
||||
<input type="submit" value="확인" class="btn_submit btn" accesskey="s">
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
$sub_menu = '500500';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
|
||||
$w = isset($_REQUEST['w']) ? $_REQUEST['w'] : '';
|
||||
|
||||
if ($w == 'd')
|
||||
auth_check_menu($auth, $sub_menu, "d");
|
||||
else
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
check_admin_token();
|
||||
|
||||
@mkdir(G5_DATA_PATH."/banner", G5_DIR_PERMISSION);
|
||||
@chmod(G5_DATA_PATH."/banner", G5_DIR_PERMISSION);
|
||||
|
||||
$bn_bimg = isset($_FILES['bn_bimg']['tmp_name']) ? $_FILES['bn_bimg']['tmp_name'] : '';
|
||||
$bn_bimg_name = isset($_FILES['bn_bimg']['name']) ? $_FILES['bn_bimg']['name'] : '';
|
||||
$bn_id = isset($_REQUEST['bn_id']) ? preg_replace('/[^0-9]/', '', $_REQUEST['bn_id']) : 0;
|
||||
$bn_bimg_del = (isset($_POST['bn_bimg_del']) && $_POST['bn_bimg_del']) ? preg_replace('/[^0-9]/', '', $_POST['bn_id']) : 0;
|
||||
$bn_url = isset($_POST['bn_url']) ? strip_tags(clean_xss_attributes($bn_url)) : '';
|
||||
$bn_alt = isset($_POST['bn_alt']) ? strip_tags(clean_xss_attributes($bn_alt)) : '';
|
||||
$bn_device = isset($_POST['bn_device']) ? clean_xss_tags($_POST['bn_device'], 1, 1) : '';
|
||||
$bn_position = isset($_POST['bn_position']) ? clean_xss_tags($_POST['bn_position'], 1, 1) : '';
|
||||
$bn_border = isset($_POST['bn_border']) ? (int) $_POST['bn_border'] : 0;
|
||||
$bn_new_win = isset($_POST['bn_new_win']) ? (int) $_POST['bn_new_win'] : 0;
|
||||
$bn_begin_time = isset($_POST['bn_begin_time']) ? clean_xss_tags($_POST['bn_begin_time'], 1, 1) : '';
|
||||
$bn_end_time = isset($_POST['bn_end_time']) ? clean_xss_tags($_POST['bn_end_time'], 1, 1) : '';
|
||||
$bn_order = isset($_POST['bn_order']) ? (int) $_POST['bn_order'] : 0;
|
||||
|
||||
if ($bn_bimg_del) @unlink(G5_DATA_PATH."/banner/$bn_id");
|
||||
|
||||
//파일이 이미지인지 체크합니다.
|
||||
if( $bn_bimg || $bn_bimg_name ){
|
||||
|
||||
if( !preg_match('/\.(gif|jpe?g|bmp|png)$/i', $bn_bimg_name) ){
|
||||
alert("이미지 파일만 업로드 할수 있습니다.");
|
||||
}
|
||||
|
||||
$timg = @getimagesize($bn_bimg);
|
||||
if ($timg['2'] < 1 || $timg['2'] > 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");
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
<?php
|
||||
$sub_menu = '500500';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$bn_position = (isset($_GET['bn_position']) && in_array($_GET['bn_position'], array('메인', '왼쪽'))) ? $_GET['bn_position'] : '';
|
||||
$bn_device = (isset($_GET['bn_device']) && in_array($_GET['bn_device'], array('pc', 'mobile'))) ? $_GET['bn_device'] : 'both';
|
||||
$bn_time = (isset($_GET['bn_time']) && in_array($_GET['bn_time'], array('ing', 'end'))) ? $_GET['bn_time'] : '';
|
||||
|
||||
$where = ' where ';
|
||||
$sql_search = '';
|
||||
|
||||
if ( $bn_position ){
|
||||
$sql_search .= " $where bn_position = '$bn_position' ";
|
||||
$where = ' and ';
|
||||
$qstr .= "&bn_position=$bn_position";
|
||||
}
|
||||
|
||||
if ( $bn_device && $bn_device !== 'both' ){
|
||||
$sql_search .= " $where bn_device = '$bn_device' ";
|
||||
$where = ' and ';
|
||||
$qstr .= "&bn_device=$bn_device";
|
||||
}
|
||||
|
||||
if ( $bn_time ){
|
||||
$sql_search .= ($bn_time === 'ing') ? " $where '".G5_TIME_YMDHIS."' between bn_begin_time and bn_end_time " : " $where bn_end_time < '".G5_TIME_YMDHIS."' ";
|
||||
$where = ' and ';
|
||||
$qstr .= "&bn_time=$bn_time";
|
||||
}
|
||||
|
||||
$g5['title'] = '배너관리';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
$sql_common = " from {$g5['g5_shop_banner_table']} ";
|
||||
$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; // 시작 열을 구함
|
||||
?>
|
||||
|
||||
<div class="local_ov01 local_ov">
|
||||
<span class="btn_ov01"><span class="ov_txt"> <?php echo ($sql_search) ? '검색' : '등록'; ?>된 배너 </span><span class="ov_num"> <?php echo $total_count; ?>개</span></span>
|
||||
|
||||
<form name="flist" class="local_sch01 local_sch">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
|
||||
<label for="bn_position" class="sound_only">검색</label>
|
||||
<select name="bn_position" id="bn_position">
|
||||
<option value=""<?php echo get_selected($bn_position, '', true); ?>>위치 전체</option>
|
||||
<option value="메인"<?php echo get_selected($bn_position, '메인', true); ?>>메인</option>
|
||||
<option value="왼쪽"<?php echo get_selected($bn_position, '왼쪽', true); ?>>왼쪽</option>
|
||||
</select>
|
||||
|
||||
<select name="bn_device" id="bn_device">
|
||||
<option value="both"<?php echo get_selected($bn_device, 'both', true); ?>>PC와 모바일</option>
|
||||
<option value="pc"<?php echo get_selected($bn_device, 'pc'); ?>>PC</option>
|
||||
<option value="mobile"<?php echo get_selected($bn_device, 'mobile'); ?>>모바일</option>
|
||||
</select>
|
||||
|
||||
<select name="bn_time" id="bn_time">
|
||||
<option value=""<?php echo get_selected($bn_time, '', true); ?>>배너 시간 전체</option>
|
||||
<option value="ing"<?php echo get_selected($bn_time, 'ing'); ?>>진행중인 배너</option>
|
||||
<option value="end"<?php echo get_selected($bn_time, 'end'); ?>>종료된 배너</option>
|
||||
</select>
|
||||
|
||||
<input type="submit" value="검색" class="btn_submit">
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<a href="./bannerform.php" class="btn_01 btn">배너추가</a>
|
||||
</div>
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?> 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" rowspan="2" id="th_id">ID</th>
|
||||
<th scope="col" id="th_dvc">접속기기</th>
|
||||
<th scope="col" id="th_loc">위치</th>
|
||||
<th scope="col" id="th_st">시작일시</th>
|
||||
<th scope="col" id="th_end">종료일시</th>
|
||||
<th scope="col" id="th_odr">출력순서</th>
|
||||
<th scope="col" id="th_hit">조회</th>
|
||||
<th scope="col" id="th_mng">관리</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col" colspan="7" id="th_img">이미지</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$sql = " select * from {$g5['g5_shop_banner_table']} $sql_search
|
||||
order by bn_order, bn_id desc
|
||||
limit $from_record, $rows ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
// 테두리 있는지
|
||||
$bn_border = $row['bn_border'];
|
||||
// 새창 띄우기인지
|
||||
$bn_new_win = ($row['bn_new_win']) ? 'target="_blank"' : '';
|
||||
|
||||
$bimg = G5_DATA_PATH.'/banner/'.$row['bn_id'];
|
||||
if(file_exists($bimg)) {
|
||||
$size = @getimagesize($bimg);
|
||||
if($size[0] && $size[0] > 800)
|
||||
$width = 800;
|
||||
else
|
||||
$width = $size[0];
|
||||
|
||||
$bn_img = "";
|
||||
|
||||
$bn_img .= '<img src="'.G5_DATA_URL.'/banner/'.$row['bn_id'].'?'.preg_replace('/[^0-9]/i', '', $row['bn_time']).'" width="'.$width.'" alt="'.get_text($row['bn_alt']).'">';
|
||||
}
|
||||
|
||||
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);
|
||||
?>
|
||||
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td headers="th_id" rowspan="2" class="td_num"><?php echo $row['bn_id']; ?></td>
|
||||
<td headers="th_dvc"><?php echo $bn_device; ?></td>
|
||||
<td headers="th_loc"><?php echo $row['bn_position']; ?></td>
|
||||
<td headers="th_st" class="td_datetime"><?php echo $bn_begin_time; ?></td>
|
||||
<td headers="th_end" class="td_datetime"><?php echo $bn_end_time; ?></td>
|
||||
<td headers="th_odr" class="td_num"><?php echo $row['bn_order']; ?></td>
|
||||
<td headers="th_hit" class="td_num"><?php echo $row['bn_hit']; ?></td>
|
||||
<td headers="th_mng" class="td_mng td_mns_m">
|
||||
<a href="./bannerform.php?w=u&bn_id=<?php echo $row['bn_id']; ?>" class="btn btn_03">수정</a>
|
||||
<a href="./bannerformupdate.php?w=d&bn_id=<?php echo $row['bn_id']; ?>" onclick="return delete_confirm(this);" class="btn btn_02">삭제</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td headers="th_img" colspan="7" class="td_img_view sbn_img">
|
||||
<div class="sbn_image"><?php echo $bn_img; ?></div>
|
||||
<button type="button" class="sbn_img_view btn_frmline">이미지확인</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
if ($i == 0) {
|
||||
echo '<tr><td colspan="8" class="empty_table">자료가 없습니다.</td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page="); ?>
|
||||
|
||||
<script>
|
||||
jQuery(function($) {
|
||||
$(".sbn_img_view").on("click", function() {
|
||||
$(this).closest(".td_img_view").find(".sbn_image").slideToggle();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,653 @@
|
||||
<?php
|
||||
$sub_menu = '400200';
|
||||
include_once('./_common.php');
|
||||
include_once(G5_EDITOR_LIB);
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
$ca_id = isset($_GET['ca_id']) ? preg_replace('/[^0-9a-z]/i', '', $_GET['ca_id']) : '';
|
||||
$ca = array(
|
||||
'ca_skin_dir'=>'',
|
||||
'ca_mobile_skin_dir'=>'',
|
||||
'ca_name'=>'',
|
||||
'ca_level'=>'1',
|
||||
'ca_level_opt'=>'1',
|
||||
'ca_order'=>'',
|
||||
'ca_mb_id'=>'',
|
||||
'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((string)$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 ='<ul class="anchor">
|
||||
<li><a href="#anc_scatefrm_basic">필수입력</a></li>
|
||||
<li><a href="#anc_scatefrm_optional">선택입력</a></li>
|
||||
<li><a href="#anc_scatefrm_extra">여분필드</a></li>';
|
||||
if ($w == 'u') $pg_anchor .= '<li><a href="#frm_etc">기타설정</a></li>';
|
||||
$pg_anchor .= '</ul>';
|
||||
|
||||
// 쿠폰 적용 불가 설정 필드 추가
|
||||
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'];
|
||||
}
|
||||
?>
|
||||
|
||||
<form name="fcategoryform" action="./categoryformupdate.php" onsubmit="return fcategoryformcheck(this);" method="post" enctype="multipart/form-data">
|
||||
|
||||
<input type="hidden" name="w" value="<?php echo $w; ?>">
|
||||
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
|
||||
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
|
||||
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
|
||||
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
<input type="hidden" name="ca_explan_html" value="<?php echo $ca['ca_explan_html']; ?>">
|
||||
|
||||
<section id="anc_scatefrm_basic">
|
||||
<h2 class="h2_frm">필수입력</h2>
|
||||
<?php echo $pg_anchor; ?>
|
||||
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<caption>분류 추가 필수입력</caption>
|
||||
<colgroup>
|
||||
<col class="grid_4">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_id">분류코드</label></th>
|
||||
<td>
|
||||
<?php if ($w == "") { ?>
|
||||
<?php echo help("자동으로 보여지는 분류코드를 사용하시길 권해드리지만 직접 입력한 값으로도 사용할 수 있습니다.\n분류코드는 나중에 수정이 되지 않으므로 신중하게 결정하여 사용하십시오.\n\n분류코드는 2자리씩 10자리를 사용하여 5단계를 표현할 수 있습니다.\n0~z까지 입력이 가능하며 한 분류당 최대 1296가지를 표현할 수 있습니다.\n그러므로 총 3656158440062976가지의 분류를 사용할 수 있습니다."); ?>
|
||||
<input type="text" name="ca_id" value="<?php echo $subid; ?>" id="ca_id" required class="required frm_input" size="<?php echo $sublen; ?>" maxlength="<?php echo $sublen; ?>">
|
||||
<?php } else { ?>
|
||||
<input type="hidden" name="ca_id" value="<?php echo $ca['ca_id']; ?>">
|
||||
<span class="frm_ca_id"><?php echo $ca['ca_id']; ?></span>
|
||||
<a href="<?php echo shop_category_url($ca_id); ?>" class="btn_frmline">미리보기</a>
|
||||
<a href="./categoryform.php?ca_id=<?php echo $ca_id; ?>&<?php echo $qstr; ?>" class="btn_frmline">하위분류 추가</a>
|
||||
<a href="./itemlist.php?sca=<?php echo $ca['ca_id']; ?>" class="btn_frmline">상품리스트</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_name">분류명</label></th>
|
||||
<td><input type="text" name="ca_name" value="<?php echo $ca['ca_name']; ?>" id="ca_name" size="38" required class="required frm_input"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_order">출력순서</label></th>
|
||||
<td>
|
||||
<?php echo help("숫자가 작을 수록 상위에 출력됩니다. 음수 입력도 가능하며 입력 가능 범위는 -2147483648 부터 2147483647 까지입니다.\n<b>입력하지 않으면 자동으로 출력됩니다.</b>"); ?>
|
||||
<input type="text" name="ca_order" value="<?php echo $ca['ca_order']; ?>" id="ca_order" class="frm_input" size="12">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php if ($is_admin == 'super') { ?><label for="ca_mb_id"><?php } ?>관리 회원아이디<?php if ($is_admin == 'super') { ?></label><?php } ?></th>
|
||||
<td>
|
||||
<?php if ($is_admin == 'super') { ?>
|
||||
<input type="text" name="ca_mb_id" value="<?php echo get_sanitize_input($ca['ca_mb_id']); ?>" id="ca_mb_id" class="frm_input" maxlength="20">
|
||||
<?php } else { ?>
|
||||
<input type="hidden" name="ca_mb_id" value="<?php echo get_sanitize_input($ca['ca_mb_id']); ?>">
|
||||
<?php echo $ca['ca_mb_id']; ?>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_level">접근 권한</label></th>
|
||||
<td>
|
||||
<?php echo help('권한 1은 비회원, 2 이상 회원입니다. 권한은 10 이 가장 높습니다.') ?>
|
||||
<?php echo get_member_level_select('ca_level', 1, $member['mb_level'], $ca['ca_level']) ?>
|
||||
|
||||
<select id="ca_level_opt" name="ca_level_opt">
|
||||
<option value="1" <?php if (isset($ca['ca_level_opt']) && $ca['ca_level_opt'] == "1") { ?>selected<?php } ?>>레벨 부터 접근가능</option>
|
||||
<option value="2" <?php if (isset($ca['ca_level_opt']) && $ca['ca_level_opt'] == "2") { ?>selected<?php } ?>>레벨만 접근가능</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_skin_dir">PC용 스킨명</label></th>
|
||||
<td>
|
||||
<?php echo get_skin_select('shop', 'ca_skin_dir', 'ca_skin_dir', $ca['ca_skin_dir']); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_mobile_skin_dir">모바일용 스킨명</label></th>
|
||||
<td>
|
||||
<?php echo get_mobile_skin_select('shop', 'ca_mobile_skin_dir', 'ca_mobile_skin_dir', $ca['ca_mobile_skin_dir']); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">본인확인 체크</th>
|
||||
<td>
|
||||
<input type="radio" name="ca_cert_use" value="1" id="ca_cert_use_yes" <?php if($ca['ca_cert_use']) echo 'checked="checked"'; ?>>
|
||||
<label for="ca_cert_use_yes">사용함</label>
|
||||
<input type="radio" name="ca_cert_use" value="0" id="ca_cert_use_no" <?php if(!$ca['ca_cert_use']) echo 'checked="checked"'; ?>>
|
||||
<label for="ca_cert_use_no">사용안함</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">성인인증 체크</th>
|
||||
<td>
|
||||
<input type="radio" name="ca_adult_use" value="1" id="ca_adult_use_yes" <?php if($ca['ca_adult_use']) echo 'checked="checked"'; ?>>
|
||||
<label for="ca_adult_use_yes">사용함</label>
|
||||
<input type="radio" name="ca_adult_use" value="0" id="ca_adult_use_no" <?php if(!$ca['ca_adult_use']) echo 'checked="checked"'; ?>>
|
||||
<label for="ca_adult_use_no">사용안함</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_skin">출력스킨</label></th>
|
||||
<td>
|
||||
<?php echo help('기본으로 제공하는 스킨은 '.str_replace(G5_PATH.'/', '', $g5_shop_skin_path).'/list.*.skin.php 입니다.'); ?>
|
||||
<select id="ca_skin" name="ca_skin" required class="required">
|
||||
<?php echo get_list_skin_options("^list.[0-9]+\.skin\.php", $g5_shop_skin_path, $ca['ca_skin']); ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_img_width">출력이미지 폭</label></th>
|
||||
<td>
|
||||
<?php echo help("쇼핑몰환경설정 > 이미지(소) 넓이가 기본값으로 설정됩니다.\n".G5_SHOP_URL."/list.php에서 출력되는 이미지의 폭입니다."); ?>
|
||||
<input type="text" name="ca_img_width" value="<?php echo $ca['ca_img_width']; ?>" id="ca_img_width" required class="required frm_input" size="5" > 픽셀
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_img_height">출력이미지 높이</label></th>
|
||||
<td>
|
||||
<?php echo help("쇼핑몰환경설정 > 이미지(소) 높이가 기본값으로 설정됩니다.\n".G5_SHOP_URL."/list.php에서 출력되는 이미지의 높이입니다."); ?>
|
||||
<input type="text" name="ca_img_height" value="<?php echo $ca['ca_img_height']; ?>" id="ca_img_height" required class="required frm_input" size="5" > 픽셀
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_list_mod">1줄당 이미지 수</label></th>
|
||||
<td>
|
||||
<?php echo help("한 줄에 설정한 값만큼의 상품을 출력하지만 스킨에 따라 한 줄에 하나의 상품만 출력할 수도 있습니다."); ?>
|
||||
<input type="text" name="ca_list_mod" size="3" value="<?php echo $ca['ca_list_mod']; ?>" id="ca_list_mod" required class="required frm_input"> 개
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_list_row">이미지 줄 수</label></th>
|
||||
<td>
|
||||
<?php echo help("한 페이지에 출력할 이미지 줄 수를 설정합니다.\n한 페이지에서 표시하는 상품수는 (1줄당 이미지 수 x 줄 수) 입니다."); ?>
|
||||
<input type="text" name="ca_list_row" value='<?php echo $ca['ca_list_row']; ?>' id="ca_list_row" required class="required frm_input" size="3"> 줄
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_mobile_skin">모바일 출력스킨</label></th>
|
||||
<td>
|
||||
<?php echo help('기본으로 제공하는 스킨은 '.str_replace(G5_PATH.'/', '', $g5_mshop_skin_path).'/list.*.skin.php 입니다.'); ?>
|
||||
<select id="ca_mobile_skin" name="ca_mobile_skin" required class="required">
|
||||
<?php echo get_list_skin_options("^list.[0-9]+\.skin\.php", $g5_mshop_skin_path, $ca['ca_mobile_skin']); ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_mobile_img_width">모바일 출력이미지 폭</label></th>
|
||||
<td>
|
||||
<?php echo help("쇼핑몰환경설정 > 이미지(소) 넓이가 기본값으로 설정됩니다.\n".G5_SHOP_URL."/list.php에서 출력되는 이미지의 폭입니다."); ?>
|
||||
<input type="text" name="ca_mobile_img_width" value="<?php echo $ca['ca_mobile_img_width']; ?>" id="ca_mobile_img_width" required class="required frm_input" size="5" > 픽셀
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_mobile_img_height">모바일 출력이미지 높이</label></th>
|
||||
<td>
|
||||
<?php echo help("쇼핑몰환경설정 > 이미지(소) 높이가 기본값으로 설정됩니다.\n".G5_SHOP_URL."/list.php에서 출력되는 이미지의 높이입니다."); ?>
|
||||
<input type="text" name="ca_mobile_img_height" value="<?php echo $ca['ca_mobile_img_height']; ?>" id="ca_mobile_img_height" required class="required frm_input" size="5" > 픽셀
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_mobile_list_mod">모바일 1줄당 이미지 수</label></th>
|
||||
<td>
|
||||
<?php echo help("한 줄에 설정한 값만큼의 상품을 출력하지만 스킨에 따라 한 줄에 하나의 상품만 출력할 수도 있습니다."); ?>
|
||||
<input type="text" name="ca_mobile_list_mod" value='<?php echo $ca['ca_mobile_list_mod']; ?>' id="ca_mobile_list_mod" required class="required frm_input" size="3"> 개
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_mobile_list_row">모바일 이미지 줄 수</label></th>
|
||||
<td>
|
||||
<?php echo help("한 페이지에 출력할 이미지 줄 수를 설정합니다.\n한 페이지에서 표시하는 상품수는 (1줄당 이미지 수 x 줄 수) 입니다."); ?>
|
||||
<input type="text" name="ca_mobile_list_row" value='<?php echo $ca['ca_mobile_list_row']; ?>' id="ca_mobile_list_row" required class="required frm_input" size="3"> 줄
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_stock_qty">재고수량</label></th>
|
||||
<td>
|
||||
<?php echo help("상품의 기본재고 수량을 설정합니다.\n재고를 사용하지 않는다면 숫자를 크게 입력하여 주십시오. 예) 999999"); ?>
|
||||
<input type="text" name="ca_stock_qty" size="10" value="<?php echo $ca['ca_stock_qty']; ?>" id="ca_stock_qty" class="frm_input"> 개
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_sell_email">판매자 E-mail</label></th>
|
||||
<td>
|
||||
<?php echo help("운영자와 판매자가 다른 경우에 사용합니다.\n이 분류에 속한 상품을 등록할 경우에 기본값으로 입력됩니다."); ?>
|
||||
<input type="text" name="ca_sell_email" size="40" value="<?php echo get_sanitize_input($ca['ca_sell_email']); ?>" id="ca_sell_email" class="frm_input">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_use">판매가능</label></th>
|
||||
<td>
|
||||
<?php echo help("재고가 없거나 일시적으로 판매를 중단하시려면 체크 해제하십시오.\n체크 해제하시면 상품 출력을 하지 않으며, 주문도 받지 않습니다."); ?>
|
||||
<input type="checkbox" name="ca_use" <?php echo ($ca['ca_use']) ? "checked" : ""; ?> value="1" id="ca_use">
|
||||
예
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_nocoupon">쿠폰적용안함</label></th>
|
||||
<td>
|
||||
<?php echo help("설정에 체크하시면 쿠폰생성 때 분류 검색 결과에 노출되지 않습니다."); ?>
|
||||
<input type="checkbox" name="ca_nocoupon" <?php echo ($ca['ca_nocoupon']) ? "checked" : ""; ?> value="1" id="ca_nocoupon">
|
||||
예
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<button type="button" class="shop_category btn_02 btn">테마설정 가져오기</button>
|
||||
</section>
|
||||
|
||||
|
||||
<section id="anc_scatefrm_optional">
|
||||
<h2 class="h2_frm">선택 입력</h2>
|
||||
<?php echo $pg_anchor; ?>
|
||||
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<caption>분류 추가 선택입력</caption>
|
||||
<colgroup>
|
||||
<col class="grid_4">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_include_head">상단파일경로</label></th>
|
||||
<td>
|
||||
<?php echo help("입력하지 않으면 기본 상단 파일을 사용합니다.<br>상단 내용과 달리 PHP 코드를 사용할 수 있습니다."); ?>
|
||||
<input type="text" name="ca_include_head" value="<?php echo $ca['ca_include_head']; ?>" id="ca_include_head" class="frm_input" size="60">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ca_include_tail">하단 파일 경로</label></th>
|
||||
<td>
|
||||
<?php echo help("입력하지 않으면 기본 하단 파일을 사용합니다.<br>하단 내용과 달리 PHP 코드를 사용할 수 있습니다."); ?>
|
||||
<input type="text" name="ca_include_tail" value="<?php echo $ca['ca_include_tail']; ?>" id="ca_include_tail" class="frm_input" size="60">
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="admin_captcha_box" style="display:none;">
|
||||
<th scope="row">자동등록방지</th>
|
||||
<td>
|
||||
<?php
|
||||
echo help("파일 경로를 입력 또는 수정시 캡챠를 반드시 입력해야 합니다.");
|
||||
|
||||
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
|
||||
$captcha_html = captcha_html();
|
||||
$captcha_js = chk_captcha_js();
|
||||
echo $captcha_html;
|
||||
?>
|
||||
<script>
|
||||
jQuery("#captcha_key").removeAttr("required").removeClass("required");
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">상단내용</th>
|
||||
<td>
|
||||
<?php echo help("상품리스트 페이지 상단에 출력하는 HTML 내용입니다."); ?>
|
||||
<?php echo editor_html('ca_head_html', get_text(html_purifier($ca['ca_head_html']), 0)); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">하단내용</th>
|
||||
<td>
|
||||
<?php echo help("상품리스트 페이지 하단에 출력하는 HTML 내용입니다."); ?>
|
||||
<?php echo editor_html('ca_tail_html', get_text(html_purifier($ca['ca_tail_html']), 0)); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">모바일 상단내용</th>
|
||||
<td>
|
||||
<?php echo help("상품리스트 페이지 상단에 출력하는 HTML 내용입니다."); ?>
|
||||
<?php echo editor_html('ca_mobile_head_html', get_text(html_purifier($ca['ca_mobile_head_html']), 0)); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">모바일 하단내용</th>
|
||||
<td>
|
||||
<?php echo help("상품리스트 페이지 하단에 출력하는 HTML 내용입니다."); ?>
|
||||
<?php echo editor_html('ca_mobile_tail_html', get_text(html_purifier($ca['ca_mobile_tail_html']), 0)); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<section id="anc_scatefrm_extra">
|
||||
<h2>여분필드 설정</h2>
|
||||
<?php echo $pg_anchor ?>
|
||||
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<colgroup>
|
||||
<col class="grid_3">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<?php for ($i=1; $i<=10; $i++) { ?>
|
||||
<tr>
|
||||
<th scope="row">여분필드<?php echo $i ?></th>
|
||||
<td class="td_extra">
|
||||
<label for="ca_<?php echo $i ?>_subj">여분필드 <?php echo $i ?> 제목</label>
|
||||
<input type="text" name="ca_<?php echo $i ?>_subj" id="ca_<?php echo $i ?>_subj" value="<?php echo get_text($ca['ca_'.$i.'_subj']) ?>" class="frm_input">
|
||||
<label for="ca_<?php echo $i ?>">여분필드 <?php echo $i ?> 값</label>
|
||||
<input type="text" name="ca_<?php echo $i ?>" value="<?php echo get_text($ca['ca_'.$i]) ?>" id="ca_<?php echo $i ?>" class="frm_input">
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<?php if ($w == "u") { ?>
|
||||
<section id="frm_etc">
|
||||
<h2 class="h2_frm">기타설정</h2>
|
||||
<?php echo $pg_anchor; ?>
|
||||
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<caption>분류 추가 기타설정</caption>
|
||||
<colgroup>
|
||||
<col class="grid_4">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">하위분류</th>
|
||||
<td>
|
||||
<?php echo help("이 분류의 코드가 10 이라면 10 으로 시작하는 하위분류의 설정값을 이 분류와 동일하게 설정합니다.\n<strong>이 작업은 실행 후 복구할 수 없습니다.</strong>"); ?>
|
||||
<label for="sub_category">이 분류의 하위분류 설정을, 이 분류와 동일하게 일괄수정</label>
|
||||
<input type="checkbox" name="sub_category" value="1" id="sub_category" onclick="if (this.checked) if (confirm('이 분류에 속한 하위 분류의 속성을 똑같이 변경합니다.\n\n이 작업은 되돌릴 방법이 없습니다.\n\n그래도 변경하시겠습니까?')) return ; this.checked = false;">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php } ?>
|
||||
<div class="btn_fixed_top">
|
||||
<input type="submit" value="확인" class="btn_submit btn" accesskey="s">
|
||||
<a href="./categorylist.php?<?php echo $qstr; ?>" class="btn_02 btn">목록</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
<?php if ($w == 'u') { ?>
|
||||
$(".banner_or_img").addClass("sit_wimg");
|
||||
$(function() {
|
||||
$(".sit_wimg_view").bind("click", function() {
|
||||
var sit_wimg_id = $(this).attr("id").split("_");
|
||||
var $img_display = $("#"+sit_wimg_id[1]);
|
||||
|
||||
$img_display.toggle();
|
||||
|
||||
if($img_display.is(":visible")) {
|
||||
$(this).text($(this).text().replace("확인", "닫기"));
|
||||
} else {
|
||||
$(this).text($(this).text().replace("닫기", "확인"));
|
||||
}
|
||||
|
||||
var $img = $("#"+sit_wimg_id[1]).children("img");
|
||||
var width = $img.width();
|
||||
var height = $img.height();
|
||||
if(width > 700) {
|
||||
var img_width = 700;
|
||||
var img_height = Math.round((img_width * height) / width);
|
||||
|
||||
$img.width(img_width).height(img_height);
|
||||
}
|
||||
});
|
||||
$(".sit_wimg_close").bind("click", function() {
|
||||
var $img_display = $(this).parents(".banner_or_img");
|
||||
var id = $img_display.attr("id");
|
||||
$img_display.toggle();
|
||||
var $button = $("#ca_"+id+"_view");
|
||||
$button.text($button.text().replace("닫기", "확인"));
|
||||
});
|
||||
});
|
||||
<?php } ?>
|
||||
|
||||
function fcategoryformcheck(f)
|
||||
{
|
||||
if (f.w.value == "") {
|
||||
var error = "";
|
||||
$.ajax({
|
||||
url: "./ajax.ca_id.php",
|
||||
type: "POST",
|
||||
data: {
|
||||
"ca_id": f.ca_id.value
|
||||
},
|
||||
dataType: "json",
|
||||
async: false,
|
||||
cache: false,
|
||||
success: function(data, textStatus) {
|
||||
error = data.error;
|
||||
}
|
||||
});
|
||||
|
||||
if (error) {
|
||||
alert(error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
<?php echo get_editor_js('ca_head_html'); ?>
|
||||
<?php echo get_editor_js('ca_tail_html'); ?>
|
||||
<?php echo get_editor_js('ca_mobile_head_html'); ?>
|
||||
<?php echo get_editor_js('ca_mobile_tail_html'); ?>
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
var captcha_chk = false;
|
||||
|
||||
function use_captcha_check(){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: g5_admin_url+"/ajax.use_captcha.php",
|
||||
data: { admin_use_captcha: "1" },
|
||||
cache: false,
|
||||
async: false,
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function frm_check_file(){
|
||||
var ca_include_head = "<?php echo $ca['ca_include_head']; ?>";
|
||||
var ca_include_tail = "<?php echo $ca['ca_include_tail']; ?>";
|
||||
var head = jQuery.trim(jQuery("#ca_include_head").val());
|
||||
var tail = jQuery.trim(jQuery("#ca_include_tail").val());
|
||||
|
||||
if(ca_include_head !== head || ca_include_tail !== tail){
|
||||
// 캡챠를 사용합니다.
|
||||
jQuery("#admin_captcha_box").show();
|
||||
captcha_chk = true;
|
||||
|
||||
use_captcha_check();
|
||||
|
||||
return false;
|
||||
} else {
|
||||
jQuery("#admin_captcha_box").hide();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
jQuery(function($){
|
||||
if( window.self !== window.top ){ // frame 또는 iframe을 사용할 경우 체크
|
||||
$("#ca_include_head, #ca_include_tail").on("change paste keyup", function(e) {
|
||||
frm_check_file();
|
||||
});
|
||||
|
||||
use_captcha_check();
|
||||
}
|
||||
|
||||
$(".shop_category").on("click", function() {
|
||||
if(!confirm("현재 테마의 스킨, 이미지 사이즈 등의 설정을 적용하시겠습니까?"))
|
||||
return false;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "../theme_config_load.php",
|
||||
cache: false,
|
||||
async: false,
|
||||
data: { type: 'shop_category' },
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.error) {
|
||||
alert(data.error);
|
||||
return false;
|
||||
}
|
||||
|
||||
$.each(data, function(key, val) {
|
||||
if(key == "error")
|
||||
return true;
|
||||
|
||||
$("#"+key).val(val);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/*document.fcategoryform.ca_name.focus(); 포커스 해제*/
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,263 @@
|
||||
<?php
|
||||
$sub_menu = '400200';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
$ca_include_head = isset($_POST['ca_include_head']) ? trim($_POST['ca_include_head']) : '';
|
||||
$ca_include_tail = isset($_POST['ca_include_tail']) ? trim($_POST['ca_include_tail']) : '';
|
||||
$ca_id = isset($_REQUEST['ca_id']) ? preg_replace('/[^0-9a-z]/i', '', $_REQUEST['ca_id']) : '';
|
||||
|
||||
if( ! $ca_id ){
|
||||
alert('', G5_SHOP_URL);
|
||||
}
|
||||
|
||||
if ($file = $ca_include_head) {
|
||||
$file_ext = pathinfo($file, PATHINFO_EXTENSION);
|
||||
|
||||
if (! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) || !preg_match("/\.(php|htm[l]?)$/i", $file)) {
|
||||
alert("상단 파일 경로가 php, html 파일이 아닙니다.");
|
||||
}
|
||||
}
|
||||
|
||||
if ($file = $ca_include_tail) {
|
||||
$file_ext = pathinfo($file, PATHINFO_EXTENSION);
|
||||
|
||||
if (! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) || !preg_match("/\.(php|htm[l]?)$/i", $file)) {
|
||||
alert("하단 파일 경로가 php, html 파일이 아닙니다.");
|
||||
}
|
||||
}
|
||||
|
||||
if( $ca_id ){
|
||||
$sql = " select * from {$g5['g5_shop_category_table']} where ca_id = '$ca_id' ";
|
||||
$ca = sql_fetch($sql);
|
||||
|
||||
if ($ca && ($ca['ca_include_head'] !== $ca_include_head || $ca['ca_include_tail'] !== $ca_include_tail) && function_exists('get_admin_captcha_by') && get_admin_captcha_by()){
|
||||
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
|
||||
|
||||
if (!chk_captcha()) {
|
||||
alert('자동등록방지 숫자가 틀렸습니다.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$check_str_keys = array(
|
||||
'ca_order'=>'int',
|
||||
'ca_img_width'=>'int',
|
||||
'ca_img_height'=>'int',
|
||||
'ca_name'=>'str',
|
||||
'ca_level'=>'int',
|
||||
'ca_level_opt'=>'int',
|
||||
'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_level = '$ca_level',
|
||||
ca_level_opt = '$ca_level_opt',
|
||||
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);
|
||||
run_event('shop_admin_category_created', $ca_id);
|
||||
}
|
||||
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);
|
||||
}
|
||||
run_event('shop_admin_category_updated', $ca_id);
|
||||
}
|
||||
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);
|
||||
run_event('shop_admin_category_deleted', $ca_id);
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
@@ -0,0 +1,299 @@
|
||||
<?php
|
||||
$sub_menu = '400200';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$g5['title'] = '분류관리';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
$where = " where ";
|
||||
$sql_search = "";
|
||||
|
||||
$sfl = in_array($sfl, array('ca_name', 'ca_id', 'ca_mb_id')) ? $sfl : '';
|
||||
|
||||
if ($stx != "") {
|
||||
if ($sfl != "") {
|
||||
$sql_search .= " $where $sfl like '%$stx%' ";
|
||||
$where = " and ";
|
||||
}
|
||||
if (isset($save_stx) && $save_stx && ($save_stx != $stx))
|
||||
$page = 1;
|
||||
}
|
||||
|
||||
$sql_common = " from {$g5['g5_shop_category_table']} ";
|
||||
if ($is_admin != 'super')
|
||||
$sql_search .= " $where ca_mb_id = '{$member['mb_id']}' ";
|
||||
$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 = "ca_id";
|
||||
$sod = "asc";
|
||||
}
|
||||
$sql_order = "order by $sst $sod";
|
||||
|
||||
// 출력할 레코드를 얻음
|
||||
$sql = " select *
|
||||
$sql_common
|
||||
$sql_order
|
||||
limit $from_record, $rows ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
$listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';
|
||||
?>
|
||||
|
||||
<div class="local_ov01 local_ov">
|
||||
<?php echo $listall; ?>
|
||||
<span class="btn_ov01"><span class="ov_txt">생성된 분류 수</span><span class="ov_num"> <?php echo number_format($total_count); ?>개</span></span>
|
||||
</div>
|
||||
|
||||
<form name="flist" class="local_sch01 local_sch">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
<input type="hidden" name="save_stx" value="<?php echo $stx; ?>">
|
||||
|
||||
<label for="sfl" class="sound_only">검색대상</label>
|
||||
<select name="sfl" id="sfl">
|
||||
<option value="ca_name"<?php echo get_selected($sfl, "ca_name", true); ?>>분류명</option>
|
||||
<option value="ca_id"<?php echo get_selected($sfl, "ca_id", true); ?>>분류코드</option>
|
||||
<option value="ca_mb_id"<?php echo get_selected($sfl, "ca_mb_id", true); ?>>회원아이디</option>
|
||||
</select>
|
||||
|
||||
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
|
||||
<input type="text" name="stx" value="<?php echo $stx; ?>" id="stx" required class="required frm_input">
|
||||
<input type="submit" value="검색" class="btn_submit">
|
||||
|
||||
</form>
|
||||
|
||||
<form name="fcategorylist" method="post" action="./categorylistupdate.php" autocomplete="off">
|
||||
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
|
||||
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
|
||||
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
|
||||
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
|
||||
<div id="sct" class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?> 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" rowspan="2"><?php echo subject_sort_link("ca_id"); ?>분류코드</a></th>
|
||||
<th scope="col" id="sct_cate"><?php echo subject_sort_link("ca_name"); ?>분류명</a></th>
|
||||
<th scope="col" id="sct_amount">상품수</th>
|
||||
<th scope="col" id="sct_hpcert">본인인증</th>
|
||||
<th scope="col" id="sct_imgw">이미지 폭</th>
|
||||
<th scope="col" id="sct_imgcol">1행이미지수</th>
|
||||
<th scope="col" id="sct_mobileimg">모바일<br>1행이미지수</th>
|
||||
<th scope="col" id="sct_pcskin">PC스킨지정</th>
|
||||
<th scope="col" id="sct_level" rowspan="2">접근권한</th>
|
||||
<th scope="col" rowspan="2">관리</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col" id="sct_admin"><?php echo subject_sort_link("ca_mb_id"); ?>관리회원아이디</a></th>
|
||||
<th scope="col" id="sct_sell"><?php echo subject_sort_link("ca_use"); ?>판매가능</a></th>
|
||||
<th scope="col" id="sct_adultcert">성인인증</th>
|
||||
<th scope="col" id="sct_imgh">이미지 높이</th>
|
||||
<th scope="col" id="sct_imgrow">이미지 행수</th>
|
||||
<th scope="col" id="sct_mobilerow">모바일<br>이미지 행수</th>
|
||||
<th scope="col" id="sct_mskin">모바일스킨지정</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$s_add = $s_vie = $s_upd = $s_del = '';
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
$level = strlen($row['ca_id']) / 2 - 1;
|
||||
$p_ca_name = '';
|
||||
|
||||
if ($level > 0) {
|
||||
$class = 'class="name_lbl"'; // 2단 이상 분류의 label 에 스타일 부여 - 지운아빠 2013-04-02
|
||||
// 상위단계의 분류명
|
||||
$p_ca_id = substr($row['ca_id'], 0, $level*2);
|
||||
$sql = " select ca_name from {$g5['g5_shop_category_table']} where ca_id = '$p_ca_id' ";
|
||||
$temp = sql_fetch($sql);
|
||||
$p_ca_name = $temp['ca_name'].'의하위';
|
||||
} else {
|
||||
$class = '';
|
||||
}
|
||||
|
||||
$s_level = '<div><label for="ca_name_'.$i.'" '.$class.'><span class="sound_only">'.$p_ca_name.''.($level+1).'단 분류</span></label></div>';
|
||||
$s_level_input_size = 25 - $level *2; // 하위 분류일 수록 입력칸 넓이 작아짐 - 지운아빠 2013-04-02
|
||||
|
||||
if ($level+2 < 6) $s_add = '<a href="./categoryform.php?ca_id='.$row['ca_id'].'&'.$qstr.'" class="btn btn_03">추가</a> '; // 분류는 5단계까지만 가능
|
||||
else $s_add = '';
|
||||
$s_upd = '<a href="./categoryform.php?w=u&ca_id='.$row['ca_id'].'&'.$qstr.'" class="btn btn_02"><span class="sound_only">'.get_text($row['ca_name']).' </span>수정</a> ';
|
||||
|
||||
if ($is_admin == 'super')
|
||||
$s_del = '<a href="./categoryformupdate.php?w=d&ca_id='.$row['ca_id'].'&'.$qstr.'" onclick="return delete_confirm(this);" class="btn btn_02"><span class="sound_only">'.get_text($row['ca_name']).' </span>삭제</a> ';
|
||||
|
||||
// 해당 분류에 속한 상품의 수
|
||||
$sql1 = " select COUNT(*) as cnt from {$g5['g5_shop_item_table']}
|
||||
where ca_id = '{$row['ca_id']}'
|
||||
or ca_id2 = '{$row['ca_id']}'
|
||||
or ca_id3 = '{$row['ca_id']}' ";
|
||||
$row1 = sql_fetch($sql1);
|
||||
|
||||
// 스킨 Path
|
||||
if(!$row['ca_skin_dir'])
|
||||
$g5_shop_skin_path = G5_SHOP_SKIN_PATH;
|
||||
else {
|
||||
if(preg_match('#^theme/(.+)$#', $row['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/'.$row['ca_skin_dir'];
|
||||
}
|
||||
|
||||
if(!$row['ca_mobile_skin_dir'])
|
||||
$g5_mshop_skin_path = G5_MSHOP_SKIN_PATH;
|
||||
else {
|
||||
if(preg_match('#^theme/(.+)$#', $row['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/'.$row['ca_mobile_skin_dir'];
|
||||
}
|
||||
|
||||
$bg = 'bg'.($i%2);
|
||||
?>
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td class="td_code" rowspan="2">
|
||||
<input type="hidden" name="ca_id[<?php echo $i; ?>]" value="<?php echo $row['ca_id']; ?>">
|
||||
<a href="<?php echo shop_category_url($row['ca_id']); ?>"><?php echo $row['ca_id']; ?></a>
|
||||
</td>
|
||||
<td headers="sct_cate" class="sct_name<?php echo $level; ?>"><?php echo $s_level; ?> <input type="text" name="ca_name[<?php echo $i; ?>]" value="<?php echo get_text($row['ca_name']); ?>" id="ca_name_<?php echo $i; ?>" required class="tbl_input full_input required"></td>
|
||||
<td headers="sct_amount" class="td_amount"><a href="./itemlist.php?sca=<?php echo $row['ca_id']; ?>"><?php echo $row1['cnt']; ?></a></td>
|
||||
<td headers="sct_hpcert" class="td_possible">
|
||||
<input type="checkbox" name="ca_cert_use[<?php echo $i; ?>]" value="1" id="ca_cert_use_yes<?php echo $i; ?>" <?php if($row['ca_cert_use']) echo 'checked="checked"'; ?>>
|
||||
<label for="ca_cert_use_yes<?php echo $i; ?>">사용</label>
|
||||
</td>
|
||||
<td headers="sct_imgw">
|
||||
<label for="ca_out_width<?php echo $i; ?>" class="sound_only">출력이미지 폭</label>
|
||||
<input type="text" name="ca_img_width[<?php echo $i; ?>]" value="<?php echo get_text($row['ca_img_width']); ?>" id="ca_out_width<?php echo $i; ?>" required class="required tbl_input" size="3" > <span class="sound_only">픽셀</span>
|
||||
</td>
|
||||
|
||||
<td headers="sct_imgcol">
|
||||
<label for="ca_lineimg_num<?php echo $i; ?>" class="sound_only">1줄당 이미지 수</label>
|
||||
<input type="text" name="ca_list_mod[<?php echo $i; ?>]" size="3" value="<?php echo $row['ca_list_mod']; ?>" id="ca_lineimg_num<?php echo $i; ?>" required class="required tbl_input"> <span class="sound_only">개</span>
|
||||
</td>
|
||||
<td headers="sct_mobileimg">
|
||||
<label for="ca_mobileimg_num<?php echo $i; ?>" class="sound_only">모바일 1줄당 이미지 수</label>
|
||||
<input type="text" name="ca_mobile_list_mod[<?php echo $i; ?>]" size="3" value="<?php echo $row['ca_mobile_list_mod']; ?>" id="ca_mobileimg_num<?php echo $i; ?>" required class="required tbl_input"> <span class="sound_only">개</span>
|
||||
</td>
|
||||
<td headers="sct_pcskin" class="sct_pcskin">
|
||||
<label for="ca_skin_dir<?php echo $i; ?>" class="sound_only">PC스킨폴더</label>
|
||||
<?php echo get_skin_select('shop', 'ca_skin_dir'.$i, 'ca_skin_dir['.$i.']', $row['ca_skin_dir'], 'class="skin_dir"'); ?>
|
||||
<label for="ca_skin<?php echo $i; ?>" class="sound_only">PC스킨파일</label>
|
||||
<select id="ca_skin<?php echo $i; ?>" name="ca_skin[<?php echo $i; ?>]" required class="required">
|
||||
<?php echo get_list_skin_options("^list.[0-9]+\.skin\.php", $g5_shop_skin_path, $row['ca_skin']); ?>
|
||||
</select>
|
||||
</td>
|
||||
<td class="td_mng" rowspan="2">
|
||||
<?php echo isset($row['ca_level']) ? $row['ca_level'] : ''; ?>
|
||||
<?php if(isset($row['ca_level_opt']) && $row['ca_level_opt'] == "2") { ?>
|
||||
레벨 전용
|
||||
<?php } else { ?>
|
||||
레벨 부터
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td class="td_mng td_mng_s" rowspan="2">
|
||||
<?php echo $s_add; ?>
|
||||
<?php echo $s_vie; ?>
|
||||
<?php echo $s_upd; ?>
|
||||
<?php echo $s_del; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td headers="sct_admin">
|
||||
<?php if ($is_admin == 'super') {?>
|
||||
<label for="ca_mb_id<?php echo $i; ?>" class="sound_only">관리회원아이디</label>
|
||||
<input type="text" name="ca_mb_id[<?php echo $i; ?>]" value="<?php echo $row['ca_mb_id']; ?>" id="ca_mb_id<?php echo $i; ?>" class="tbl_input full_input" size="15" maxlength="20">
|
||||
<?php } else { ?>
|
||||
<input type="hidden" name="ca_mb_id[<?php echo $i; ?>]" value="<?php echo $row['ca_mb_id']; ?>">
|
||||
<?php echo $row['ca_mb_id']; ?>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td headers="sct_sell" class="td_possible">
|
||||
<input type="checkbox" name="ca_use[<?php echo $i; ?>]" value="1" id="ca_use<?php echo $i; ?>" <?php echo ($row['ca_use'] ? "checked" : ""); ?>>
|
||||
<label for="ca_use<?php echo $i; ?>">판매</label>
|
||||
</td>
|
||||
|
||||
<td headers="sct_adultcert" class="td_possible">
|
||||
<input type="checkbox" name="ca_adult_use[<?php echo $i; ?>]" value="1" id="ca_adult_use_yes<?php echo $i; ?>" <?php if($row['ca_adult_use']) echo 'checked="checked"'; ?>>
|
||||
<label for="ca_adult_use_yes<?php echo $i; ?>">사용</label>
|
||||
</td>
|
||||
<td headers="sct_imgh">
|
||||
<label for="ca_img_height<?php echo $i; ?>" class="sound_only">출력이미지 높이</label>
|
||||
<input type="text" name="ca_img_height[<?php echo $i; ?>]" value="<?php echo $row['ca_img_height']; ?>" id="ca_img_height<?php echo $i; ?>" required class="required tbl_input" size="3" > <span class="sound_only">픽셀</span>
|
||||
</td>
|
||||
<td headers="sct_imgrow">
|
||||
<label for="ca_imgline_num<?php echo $i; ?>" class="sound_only">이미지 줄 수</label>
|
||||
<input type="text" name="ca_list_row[<?php echo $i; ?>]" value='<?php echo $row['ca_list_row']; ?>' id="ca_imgline_num<?php echo $i; ?>" required class="required tbl_input" size="3"> <span class="sound_only">줄</span>
|
||||
</td>
|
||||
<td headers="sct_mobilerow">
|
||||
<label for="ca_mobileimg_row<?php echo $i; ?>" class="sound_only">모바일 이미지 줄 수</label>
|
||||
<input type="text" name="ca_mobile_list_row[<?php echo $i; ?>]" value='<?php echo $row['ca_mobile_list_row']; ?>' id="ca_mobileimg_row<?php echo $i; ?>" required class="required tbl_input" size="3">
|
||||
</td>
|
||||
<td headers="sct_mskin" class="sct_mskin">
|
||||
<label for="ca_mobile_skin_dir<?php echo $i; ?>" class="sound_only">모바일스킨폴더</label>
|
||||
<?php echo get_mobile_skin_select('shop', 'ca_mobile_skin_dir'.$i, 'ca_mobile_skin_dir['.$i.']', $row['ca_mobile_skin_dir'], 'class="skin_dir"'); ?>
|
||||
<label for="ca_mobile_skin<?php echo $i; ?>" class="sound_only">모바일스킨파일</label>
|
||||
<select id="ca_mobile_skin<?php echo $i; ?>" name="ca_mobile_skin[<?php echo $i; ?>]" required class="required">
|
||||
<?php echo get_list_skin_options("^list.[0-9]+\.skin\.php", $g5_mshop_skin_path, $row['ca_mobile_skin']); ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }
|
||||
if ($i == 0) echo "<tr><td colspan=\"10\" class=\"empty_table\">자료가 한 건도 없습니다.</td></tr>\n";
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<input type="submit" value="일괄수정" class="btn_02 btn">
|
||||
|
||||
<?php if ($is_admin == 'super') {?>
|
||||
<a href="./categoryform.php" id="cate_add" class="btn btn_01">분류 추가</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page="); ?>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$("select.skin_dir").on("change", function() {
|
||||
var type = "";
|
||||
var dir = $(this).val();
|
||||
if(!dir)
|
||||
return false;
|
||||
|
||||
var id = $(this).attr("id");
|
||||
var $sel = $(this).siblings("select");
|
||||
var sval = $sel.find("option:selected").val();
|
||||
|
||||
if(id.search("mobile") > -1)
|
||||
type = "mobile";
|
||||
|
||||
$sel.load(
|
||||
"./ajax.skinfile.php",
|
||||
{ dir : dir, type : type, sval: sval }
|
||||
);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
$sub_menu = '400200';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$post_ca_id_count = (isset($_POST['ca_id']) && is_array($_POST['ca_id'])) ? count($_POST['ca_id']) : 0;
|
||||
|
||||
for ($i=0; $i<$post_ca_id_count; $i++)
|
||||
{
|
||||
$str_ca_mb_id = isset($_POST['ca_mb_id'][$i]) ? strip_tags(clean_xss_attributes($_POST['ca_mb_id'][$i])) : '';
|
||||
|
||||
if ($str_ca_mb_id)
|
||||
{
|
||||
$sql = " select mb_id from {$g5['member_table']} where mb_id = '".sql_real_escape_string($str_ca_mb_id)."' ";
|
||||
$row = sql_fetch($sql);
|
||||
if (!$row['mb_id'])
|
||||
alert("\'{$str_ca_mb_id}\' 은(는) 존재하는 회원아이디가 아닙니다.", "./categorylist.php?$qstr");
|
||||
}
|
||||
|
||||
$check_files = array();
|
||||
|
||||
if( !empty($_POST['ca_skin'][$i]) ){
|
||||
$check_files[] = $_POST['ca_skin'][$i];
|
||||
}
|
||||
|
||||
if( !empty($_POST['ca_mobile_skin'][$i]) ){
|
||||
$check_files[] = $_POST['ca_mobile_skin'][$i];
|
||||
}
|
||||
|
||||
if( !empty($_POST['ca_skin_dir'][$i]) ){
|
||||
if( preg_match('#\.+(\/|\\\)#', $_POST['ca_skin_dir'][$i]) ){
|
||||
alert('PC 스킨폴더명에 포함될수 없는 문자가 들어있습니다.');
|
||||
}
|
||||
}
|
||||
|
||||
if( !empty($_POST['ca_mobile_skin_dir'][$i]) ){
|
||||
if( preg_match('#\.+(\/|\\\)#', $_POST['ca_mobile_skin_dir'][$i]) ){
|
||||
alert('모바일 스킨폴더명에 포함될수 없는 문자가 들어있습니다.');
|
||||
}
|
||||
}
|
||||
|
||||
foreach( $check_files as $file ){
|
||||
if( empty($file) ) continue;
|
||||
|
||||
if( preg_match('#\.+(\/|\\\)#', $file) ){
|
||||
alert('스킨파일명에 포함될수 없는 문자가 들어있습니다.');
|
||||
}
|
||||
|
||||
if( ! is_include_path_check($file) ){
|
||||
alert('오류 : 데이터폴더가 포함된 path 또는 잘못된 path 를 포함할수 없습니다.');
|
||||
}
|
||||
|
||||
$file_ext = pathinfo($file, PATHINFO_EXTENSION);
|
||||
|
||||
if( ! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) || ! preg_match('/^.*\.(php|htm|html)$/i', $file) ) {
|
||||
alert('스킨 파일 경로의 확장자는 php, htm, html 만 허용합니다.');
|
||||
}
|
||||
}
|
||||
|
||||
$p_ca_name = is_array($_POST['ca_name']) ? strip_tags(clean_xss_attributes($_POST['ca_name'][$i])) : '';
|
||||
|
||||
$posts = array();
|
||||
|
||||
$check_keys = array('ca_mb_id', 'ca_id', 'ca_use', 'ca_list_mod', 'ca_cert_use', 'ca_adult_use', 'ca_skin', 'ca_mobile_skin', 'ca_skin_dir', 'ca_mobile_skin_dir', 'ca_img_width', 'ca_img_height', 'ca_list_row', 'ca_mobile_list_mod', 'ca_mobile_list_row');
|
||||
|
||||
foreach($check_keys as $key){
|
||||
$posts[$key] = (isset($_POST[$key]) && isset($_POST[$key][$i])) ? $_POST[$key][$i] : '';
|
||||
}
|
||||
|
||||
$sql = " update {$g5['g5_shop_category_table']}
|
||||
set ca_name = '".$p_ca_name."',
|
||||
ca_mb_id = '".sql_real_escape_string(strip_tags(clean_xss_attributes($posts['ca_mb_id'])))."',
|
||||
ca_use = '".sql_real_escape_string(strip_tags($posts['ca_use']))."',
|
||||
ca_list_mod = '".sql_real_escape_string(strip_tags($posts['ca_list_mod']))."',
|
||||
ca_cert_use = '".sql_real_escape_string(strip_tags($posts['ca_cert_use']))."',
|
||||
ca_adult_use = '".sql_real_escape_string(strip_tags($posts['ca_adult_use']))."',
|
||||
ca_skin = '".sql_real_escape_string(strip_tags($posts['ca_skin']))."',
|
||||
ca_mobile_skin = '".sql_real_escape_string(strip_tags($posts['ca_mobile_skin']))."',
|
||||
ca_skin_dir = '".sql_real_escape_string(strip_tags($posts['ca_skin_dir']))."',
|
||||
ca_mobile_skin_dir = '".sql_real_escape_string(strip_tags($posts['ca_mobile_skin_dir']))."',
|
||||
ca_img_width = '".sql_real_escape_string(strip_tags($posts['ca_img_width']))."',
|
||||
ca_img_height = '".sql_real_escape_string(strip_tags($posts['ca_img_height']))."',
|
||||
ca_list_row = '".sql_real_escape_string(strip_tags($posts['ca_list_row']))."',
|
||||
ca_mobile_list_mod = '".sql_real_escape_string(strip_tags($posts['ca_mobile_list_mod']))."',
|
||||
ca_mobile_list_row = '".sql_real_escape_string(strip_tags($posts['ca_mobile_list_row']))."'
|
||||
where ca_id = '".sql_real_escape_string($posts['ca_id'])."' ";
|
||||
|
||||
sql_query($sql);
|
||||
|
||||
}
|
||||
|
||||
goto_url("./categorylist.php?$qstr");
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,477 @@
|
||||
<?php
|
||||
$sub_menu = '400100';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
check_admin_token();
|
||||
|
||||
// 대표전화번호 유효성 체크
|
||||
if(! (isset($_POST['de_admin_company_tel']) && check_vaild_callback($_POST['de_admin_company_tel'])) )
|
||||
alert('대표전화번호를 올바르게 입력해 주세요.');
|
||||
|
||||
// 로그인을 바로 이 주소로 하는 경우 쇼핑몰설정값이 사라지는 현상을 방지
|
||||
if (!$_POST['de_admin_company_owner']) goto_url("./configform.php");
|
||||
|
||||
if (! empty($_POST['logo_img_del'])) @unlink(G5_DATA_PATH."/common/logo_img");
|
||||
if (! empty($_POST['logo_img_del2'])) @unlink(G5_DATA_PATH."/common/logo_img2");
|
||||
if (! empty($_POST['mobile_logo_img_del'])) @unlink(G5_DATA_PATH."/common/mobile_logo_img");
|
||||
if (! empty($_POST['mobile_logo_img_del2'])) @unlink(G5_DATA_PATH."/common/mobile_logo_img2");
|
||||
|
||||
if ($_FILES['logo_img']['name']) upload_file($_FILES['logo_img']['tmp_name'], "logo_img", G5_DATA_PATH."/common");
|
||||
if ($_FILES['logo_img2']['name']) upload_file($_FILES['logo_img2']['tmp_name'], "logo_img2", G5_DATA_PATH."/common");
|
||||
if ($_FILES['mobile_logo_img']['name']) upload_file($_FILES['mobile_logo_img']['tmp_name'], "mobile_logo_img", G5_DATA_PATH."/common");
|
||||
if ($_FILES['mobile_logo_img2']['name']) upload_file($_FILES['mobile_logo_img2']['tmp_name'], "mobile_logo_img2", G5_DATA_PATH."/common");
|
||||
|
||||
$de_kcp_mid = isset($_POST['de_kcp_mid']) ? substr($_POST['de_kcp_mid'], 0, 3) : '';
|
||||
$cf_icode_server_port = isset($cf_icode_server_port) ? preg_replace('/[^0-9]/', '', $cf_icode_server_port) : '7295';
|
||||
|
||||
$de_shop_skin = isset($_POST['de_shop_skin']) ? preg_replace(array('#\.+(\/|\\\)#', '#[\'\"]#'), array('', ''), $_POST['de_shop_skin']) : 'basic';
|
||||
$de_shop_mobile_skin = isset($_POST['de_shop_mobile_skin']) ? preg_replace(array('#\.+(\/|\\\)#', '#[\'\"]#'), array('', ''), $_POST['de_shop_mobile_skin']) : 'basic';
|
||||
|
||||
$skins = get_skin_dir('shop');
|
||||
|
||||
if(defined('G5_THEME_PATH') && $config['cf_theme']) {
|
||||
$dirs = get_skin_dir('shop', G5_THEME_PATH.'/'.G5_SKIN_DIR);
|
||||
if(!empty($dirs)) {
|
||||
foreach($dirs as $dir) {
|
||||
$skins[] = 'theme/'.$dir;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$mobile_skins = get_skin_dir('shop', G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
|
||||
|
||||
if(defined('G5_THEME_PATH') && $config['cf_theme']) {
|
||||
$dirs = get_skin_dir('shop', G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR);
|
||||
if(!empty($dirs)) {
|
||||
foreach($dirs as $dir) {
|
||||
$mobile_skins[] = 'theme/'.$dir;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$de_shop_skin = in_array($de_shop_skin, $skins) ? $de_shop_skin : 'basic';
|
||||
$de_shop_mobile_skin = in_array($de_shop_mobile_skin, $mobile_skins) ? $de_shop_mobile_skin : 'basic';
|
||||
|
||||
$check_skin_keys = array('de_type1_list_skin', 'de_type2_list_skin', 'de_type3_list_skin', 'de_type4_list_skin', 'de_type5_list_skin', 'de_mobile_type1_list_skin', 'de_mobile_type2_list_skin', 'de_mobile_type3_list_skin', 'de_mobile_type4_list_skin', 'de_mobile_type5_list_skin', 'de_rel_list_skin', 'de_mobile_rel_list_skin', 'de_search_list_skin', 'de_mobile_search_list_skin', 'de_listtype_list_skin', 'de_mobile_listtype_list_skin');
|
||||
|
||||
foreach($check_skin_keys as $key){
|
||||
$$key = $_POST[$key] = isset($_POST[$key]) ? preg_replace(array('#\.+(\/|\\\)#', '#[\'\"]#'), array('', ''), strip_tags($_POST[$key])) : '';
|
||||
|
||||
if( isset($_POST[$key]) && preg_match('#\.+(\/|\\\)#', $_POST[$key]) ){
|
||||
alert('스킨설정에 유효하지 문자가 포함되어 있습니다.');
|
||||
}
|
||||
}
|
||||
|
||||
// 현금영수증 발급수단
|
||||
$de_taxsave_types = 'account'; // 무통장
|
||||
|
||||
if(isset($_POST['de_taxsave_types_vbank']) && $_POST['de_taxsave_types_vbank']){ //가상계좌
|
||||
$de_taxsave_types .= ',vbank';
|
||||
}
|
||||
if(isset($_POST['de_taxsave_types_transfer']) && $_POST['de_taxsave_types_transfer']){ //실시간계좌이체
|
||||
$de_taxsave_types .= ',transfer';
|
||||
}
|
||||
|
||||
// NHN_KCP 간편결제 체크
|
||||
$de_easy_pay_services = '';
|
||||
if(isset($_POST['de_easy_pays'])){
|
||||
$tmps = array();
|
||||
foreach( (array) $_POST['de_easy_pays'] as $v ){
|
||||
$tmps[] = preg_replace('/[^0-9a-z_\-]/i', '', $v);
|
||||
}
|
||||
$de_easy_pay_services = implode(",", $tmps);
|
||||
}
|
||||
|
||||
//KVE-2019-0689, KVE-2019-0691, KVE-2019-0694
|
||||
$check_sanitize_keys = array(
|
||||
'de_admin_company_name', //회사명
|
||||
'de_admin_company_saupja_no', //사업자등록번호
|
||||
'de_admin_company_owner', //대표자명
|
||||
'de_admin_company_tel', //대표전화번호
|
||||
'de_admin_company_fax', //팩스번호
|
||||
'de_admin_tongsin_no', //통신판매업 신고번호
|
||||
'de_admin_buga_no', //부가통신 사업자번호
|
||||
'de_admin_company_zip', //사업자우편번호
|
||||
'de_admin_company_addr', //사업장주소
|
||||
'de_admin_info_name', //정보관리책임자명
|
||||
'de_admin_info_email', //정보책임자e-mail
|
||||
'de_type1_list_mod', //히트상품출력 이미지수
|
||||
'de_type1_list_row', //히트상품출력 줄수
|
||||
'de_type1_img_width', //히트상품출력 이미지 폭
|
||||
'de_type1_img_height', //히트상품출력 이미지 높이
|
||||
'de_type2_list_mod', //추천상품출력 이미지 수
|
||||
'de_type2_list_row', //추천상품출력 줄수
|
||||
'de_type2_img_width', //추천상품출력 이미지 폭
|
||||
'de_type2_img_height', //추천상품출력 이미지 높이
|
||||
'de_type3_list_mod', //최신상품출력 이미지 수
|
||||
'de_type3_list_row', //최신상품출력 줄수
|
||||
'de_type3_img_width', //최신상품출력 이미지 폭
|
||||
'de_type3_img_height', //최신상품출력 이미지 높이
|
||||
'de_type4_list_mod', //인기상품출력 이미지 수
|
||||
'de_type4_list_row', //인기상품출력 줄수
|
||||
'de_type4_img_width', //인기상품출력 이미지 폭
|
||||
'de_type4_img_height', //인기상품출력 이미지 높이
|
||||
'de_type5_list_mod', //할인상품출력 이미지 수
|
||||
'de_type5_list_row', //할인상품출력 줄수
|
||||
'de_type5_img_width', //할인상품출력 이미지 폭
|
||||
'de_type5_img_height', //할인상품출력 이미지 높이
|
||||
'de_mobile_type1_list_mod', //모바일 히트상품출력 이미지수
|
||||
'de_mobile_type1_list_row', //모바일 히트상품출력 줄수
|
||||
'de_mobile_type1_img_width', //모바일 히트상품출력 이미지 폭
|
||||
'de_mobile_type1_img_height', //모바일 히트상품출력 이미지 높이
|
||||
'de_mobile_type2_list_mod', //모바일 추천상품출력 이미지수
|
||||
'de_mobile_type2_list_row', //모바일 추천상품출력 줄수
|
||||
'de_mobile_type2_img_width', //모바일 추천상품출력 이미지 폭
|
||||
'de_mobile_type2_img_height', //모바일 추천상품출력 이미지 높이
|
||||
'de_mobile_type3_list_mod', //모바일 최신상품출력 이미지수
|
||||
'de_mobile_type3_list_row', //모바일 최신상품출력 줄수
|
||||
'de_mobile_type3_img_width', //모바일 최신상품출력 이미지 폭
|
||||
'de_mobile_type3_img_height', //모바일 최신상품출력 이미지 높이
|
||||
'de_mobile_type4_list_mod', //모바일 인기상품출력 이미지수
|
||||
'de_mobile_type4_list_row', //모바일 인기상품출력 줄수
|
||||
'de_mobile_type4_img_width', //모바일 인기상품출력 이미지 폭
|
||||
'de_mobile_type4_img_height', //모바일 인기상품출력 이미지 높이
|
||||
'de_mobile_type5_list_mod', //모바일 할인상품출력 이미지수
|
||||
'de_mobile_type5_list_row', //모바일 할인상품출력 줄수
|
||||
'de_mobile_type5_img_width', //모바일 할인상품출력 이미지 폭
|
||||
'de_mobile_type5_img_height', //모바일 할인상품출력 이미지 높이
|
||||
'de_bank_use', //무통장입금사용
|
||||
'de_bank_account', //은행계좌번호
|
||||
'de_iche_use', //계좌이체 결제사용
|
||||
'de_vbank_use', //가상계좌 결제사용
|
||||
'de_hp_use', //휴대폰결제 결제사용
|
||||
'de_card_use', //신용카드 결제사용
|
||||
'de_card_noint_use', //신용카드 무이자할부사용
|
||||
'de_easy_pay_use', //PG사 간편결제 버튼 사용
|
||||
'de_taxsave_use', //현금영수증 발급사용
|
||||
'cf_use_point', //포인트 사용
|
||||
'de_settle_min_point', //결제 최소포인트
|
||||
'de_settle_max_point', //최대 결제포인트
|
||||
'de_settle_point_unit', //결제 포인트단위
|
||||
'de_card_point', //포인트부여
|
||||
'de_point_days', //주문완료 포인트
|
||||
'de_pg_service', //결제대행사
|
||||
'de_kcp_mid', //KCP SITE CODE
|
||||
'de_kcp_site_key', //NHN KCP SITE KEY
|
||||
'cf_lg_mid', //LG유플러스 상점아이디
|
||||
'cf_lg_mert_key', //LG유플러스 MERT KEY
|
||||
'de_inicis_mid', //KG이니시스 상점아이디
|
||||
'de_inicis_iniapi_key', //KG이니시스 INIAPI KEY
|
||||
'de_inicis_iniapi_iv', //KG이니시스 INIAPI IV
|
||||
'de_inicis_sign_key', //KG이니시스 웹결제 사인키
|
||||
'de_samsung_pay_use', //KG이니시스 삼성페이 사용
|
||||
'de_inicis_lpay_use', //KG이니시스 Lpay 사용
|
||||
'de_inicis_kakaopay_use', //KG이니시스 카카오페이 사용
|
||||
'de_inicis_cartpoint_use', //KG이니시스 신용카드 포인트 결제
|
||||
'de_nicepay_mid', //NICEPAY 상점아이디
|
||||
'de_nicepay_key', //NICEPAY 상점키
|
||||
'de_kakaopay_mid', //카카오페이 상점MID
|
||||
'de_kakaopay_key', //카카오페이 상점키
|
||||
'de_kakaopay_enckey', //카카오페이 상점 EncKey
|
||||
'de_kakaopay_hashkey', //카카오페이 상점 HashKey
|
||||
'de_kakaopay_cancelpwd', //카카오페이 결제취소 비밀번호
|
||||
'de_naverpay_mid', //네이버페이 가맹점 아이디
|
||||
'de_naverpay_cert_key', //네이버페이 가맹점 인증키
|
||||
'de_naverpay_button_key', //네이버페이 버튼 인증키
|
||||
'de_naverpay_test', //네이버페이 결제테스트
|
||||
'de_naverpay_mb_id', //네이버페이 결제테스트 아이디
|
||||
'de_naverpay_sendcost', //네이버페이 추가배송비 안내
|
||||
'de_escrow_use', //에스크로 사용
|
||||
'de_card_test', //결제 테스트
|
||||
'de_tax_flag_use', //복합과세 결제
|
||||
'de_delivery_company', //배송업체
|
||||
'de_send_cost_case', //배송비유형
|
||||
'de_send_cost_limit', //배송비상한가
|
||||
'de_send_cost_list', //배송비
|
||||
'de_hope_date_use', //희망배송일사용
|
||||
'de_hope_date_after', //희망배송일지정
|
||||
'de_rel_img_width', //관련상품출력 이미지폭
|
||||
'de_rel_img_height', //관련상품출력 이미지높이
|
||||
'de_rel_list_mod', //관련상품출력 1줄당 이미지 수
|
||||
'de_rel_list_use', //관련상품출력 출력여부
|
||||
'de_mobile_rel_img_width', //모바일 관련상품출력 이미지폭
|
||||
'de_mobile_rel_img_height', //모바일 관련상품출력 이미지높이
|
||||
'de_mobile_rel_list_mod', //모바일 관련상품출력 1줄당 이미지 수
|
||||
'de_mobile_rel_list_use', //모바일 관련상품출력 출력여부
|
||||
'de_search_img_width', //검색상품출력 이미지폭
|
||||
'de_search_img_height', //검색상품출력 이미지높이
|
||||
'de_search_list_mod', //검색상품출력 1줄당 이미지 수
|
||||
'de_search_list_row', //검색상품출력 출력할 줄 수
|
||||
'de_mobile_search_img_width', //모바일 검색상품출력 이미지폭
|
||||
'de_mobile_search_img_height', //모바일 검색상품출력 이미지높이
|
||||
'de_mobile_search_list_mod', //모바일 검색상품출력 1줄당 이미지 수
|
||||
'de_mobile_search_list_row', //모바일 검색상품출력 출력할 줄 수
|
||||
'de_listtype_img_width', //유형별 상품리스트 이미지폭
|
||||
'de_listtype_list_mod', //유형별 상품리스트 1줄당 이미지 수
|
||||
'de_listtype_list_row', //유형별 상품리스트 출력할 줄 수
|
||||
'de_mobile_listtype_img_width', //모바일 유형별 상품리스트 이미지폭
|
||||
'de_mobile_listtype_img_height',//모바일 유형별 상품리스트 이미지높이
|
||||
'de_mobile_listtype_list_mod', //모바일 유형별 상품리스트 1줄당 이미지 수
|
||||
'de_mobile_listtype_list_row', //모바일 유형별 상품리스트 출력할 줄 수
|
||||
'de_simg_width', //이미지(소) 폭
|
||||
'de_simg_height', //이미지(소) 높이
|
||||
'de_mimg_width', //이미지(중) 폭
|
||||
'de_mimg_height', //이미지(중) 높이
|
||||
'de_item_use_write', //사용후기 작성
|
||||
'de_item_use_use', //사용후기
|
||||
'de_level_sell', //상품구입 권한
|
||||
'de_code_dup_use', //코드 중복검사
|
||||
'de_cart_keep_term', //장바구니 보관기간
|
||||
'de_guest_cart_use', //비회원 장바구니
|
||||
'de_member_reg_coupon_use', //신규회원 쿠폰발행 여부
|
||||
'de_member_reg_coupon_price', //신규회원 쿠폰발행 쿠폰할인금액
|
||||
'de_member_reg_coupon_minimum', //주문최소금액
|
||||
'de_member_reg_coupon_term', //쿠폰유효기간
|
||||
'cf_sms_use', //SMS 사용
|
||||
'cf_sms_type', //SMS 전송유형
|
||||
'de_sms_hp', //관리자 휴대폰번호
|
||||
'cf_icode_id', //아이코드 회원아이디
|
||||
'cf_icode_pw', //아이코드 비밀번호
|
||||
'de_sms_use1', //SMS 회원가입시 고객님께 발송
|
||||
'de_sms_use2', //SMS 주문시 고객님께 발송
|
||||
'de_sms_use3', //SMS 주문시 주문시 관리자에게 발송
|
||||
'de_sms_use4', //SMS 입금확인시 고객님께 발송
|
||||
'de_sms_use5', //SMS 상품배송시 고객님께 발송
|
||||
'cf_icode_server_ip', // 아이코드 ip
|
||||
'cf_icode_server_port', // 아이코드 port
|
||||
'cf_icode_token_key', // 아이코드 토큰키 (JSON버전)
|
||||
);
|
||||
|
||||
foreach( $check_sanitize_keys as $key ){
|
||||
if( in_array($key, array('de_bank_account')) ){
|
||||
$$key = isset($_POST[$key]) ? clean_xss_tags($_POST[$key], 1, 1, 0, 0) : '';
|
||||
} else {
|
||||
$$key = isset($_POST[$key]) ? clean_xss_tags($_POST[$key], 1, 1) : '';
|
||||
}
|
||||
}
|
||||
|
||||
$warning_msg = '';
|
||||
|
||||
// kcp 전자결제를 사용할 때 site key 입력체크
|
||||
if($de_pg_service == 'kcp' && ! $de_card_test && ($de_iche_use || $de_vbank_use || $de_hp_use || $de_card_use)) {
|
||||
if(! trim($de_kcp_site_key))
|
||||
alert('NHN KCP SITE KEY를 입력해 주십시오.');
|
||||
}
|
||||
|
||||
if( $de_kakaopay_enckey && ($de_pg_service === 'inicis' || $de_inicis_lpay_use || $de_inicis_kakaopay_use) ){
|
||||
|
||||
$warning_msg = 'KG 이니시스 결제 또는 L.pay 또는 KG이니시스 카카오페이를 사용시 결제모듈 중복문제로 카카오페이를 활성화 할수 없습니다. \\n\\n카카오페이 사용을 비활성화 합니다.';
|
||||
$de_kakaopay_enckey = '';
|
||||
}
|
||||
|
||||
//
|
||||
// 영카트 default
|
||||
//
|
||||
$sql = " update {$g5['g5_shop_default_table']}
|
||||
set de_admin_company_owner = '{$de_admin_company_owner}',
|
||||
de_admin_company_name = '{$de_admin_company_name}',
|
||||
de_admin_company_saupja_no = '{$de_admin_company_saupja_no}',
|
||||
de_admin_company_tel = '{$de_admin_company_tel}',
|
||||
de_admin_company_fax = '{$de_admin_company_fax}',
|
||||
de_admin_tongsin_no = '{$de_admin_tongsin_no}',
|
||||
de_admin_company_zip = '{$de_admin_company_zip}',
|
||||
de_admin_company_addr = '{$de_admin_company_addr}',
|
||||
de_admin_info_name = '{$de_admin_info_name}',
|
||||
de_admin_info_email = '{$de_admin_info_email}',
|
||||
de_shop_skin = '{$de_shop_skin}',
|
||||
de_shop_mobile_skin = '{$de_shop_mobile_skin}',
|
||||
de_type1_list_use = '{$_POST['de_type1_list_use']}',
|
||||
de_type1_list_skin = '{$_POST['de_type1_list_skin']}',
|
||||
de_type1_list_mod = '{$de_type1_list_mod}',
|
||||
de_type1_list_row = '{$de_type1_list_row}',
|
||||
de_type1_img_width = '{$de_type1_img_width}',
|
||||
de_type1_img_height = '{$de_type1_img_height}',
|
||||
de_type2_list_use = '{$de_type2_list_use}',
|
||||
de_type2_list_skin = '{$de_type2_list_skin}',
|
||||
de_type2_list_mod = '{$de_type2_list_mod}',
|
||||
de_type2_list_row = '{$de_type2_list_row}',
|
||||
de_type2_img_width = '{$de_type2_img_width}',
|
||||
de_type2_img_height = '{$de_type2_img_height}',
|
||||
de_type3_list_use = '{$de_type3_list_use}',
|
||||
de_type3_list_skin = '{$de_type3_list_skin}',
|
||||
de_type3_list_mod = '{$de_type3_list_mod}',
|
||||
de_type3_list_row = '{$de_type3_list_row}',
|
||||
de_type3_img_width = '{$de_type3_img_width}',
|
||||
de_type3_img_height = '{$de_type3_img_height}',
|
||||
de_type4_list_use = '{$de_type4_list_use}',
|
||||
de_type4_list_skin = '{$de_type4_list_skin}',
|
||||
de_type4_list_mod = '{$de_type4_list_mod}',
|
||||
de_type4_list_row = '{$de_type4_list_row}',
|
||||
de_type4_img_width = '{$de_type4_img_width}',
|
||||
de_type4_img_height = '{$de_type4_img_height}',
|
||||
de_type5_list_use = '{$de_type5_list_use}',
|
||||
de_type5_list_skin = '{$de_type5_list_skin}',
|
||||
de_type5_list_mod = '{$de_type5_list_mod}',
|
||||
de_type5_list_row = '{$de_type5_list_row}',
|
||||
de_type5_img_width = '{$de_type5_img_width}',
|
||||
de_type5_img_height = '{$de_type5_img_height}',
|
||||
de_mobile_type1_list_use = '{$de_mobile_type1_list_use}',
|
||||
de_mobile_type1_list_skin = '{$de_mobile_type1_list_skin}',
|
||||
de_mobile_type1_list_mod = '{$de_mobile_type1_list_mod}',
|
||||
de_mobile_type1_list_row = '{$de_mobile_type1_list_row}',
|
||||
de_mobile_type1_img_width = '{$de_mobile_type1_img_width}',
|
||||
de_mobile_type1_img_height = '{$de_mobile_type1_img_height}',
|
||||
de_mobile_type2_list_use = '{$de_mobile_type2_list_use}',
|
||||
de_mobile_type2_list_skin = '{$de_mobile_type2_list_skin}',
|
||||
de_mobile_type2_list_mod = '{$de_mobile_type2_list_mod}',
|
||||
de_mobile_type2_list_row = '{$de_mobile_type2_list_row}',
|
||||
de_mobile_type2_img_width = '{$de_mobile_type2_img_width}',
|
||||
de_mobile_type2_img_height = '{$de_mobile_type2_img_height}',
|
||||
de_mobile_type3_list_use = '{$de_mobile_type3_list_use}',
|
||||
de_mobile_type3_list_skin = '{$de_mobile_type3_list_skin}',
|
||||
de_mobile_type3_list_mod = '{$de_mobile_type3_list_mod}',
|
||||
de_mobile_type3_list_row = '{$de_mobile_type3_list_row}',
|
||||
de_mobile_type3_img_width = '{$de_mobile_type3_img_width}',
|
||||
de_mobile_type3_img_height = '{$de_mobile_type3_img_height}',
|
||||
de_mobile_type4_list_use = '{$de_mobile_type4_list_use}',
|
||||
de_mobile_type4_list_skin = '{$de_mobile_type4_list_skin}',
|
||||
de_mobile_type4_list_mod = '{$de_mobile_type4_list_mod}',
|
||||
de_mobile_type4_list_row = '{$de_mobile_type4_list_row}',
|
||||
de_mobile_type4_img_width = '{$de_mobile_type4_img_width}',
|
||||
de_mobile_type4_img_height = '{$de_mobile_type4_img_height}',
|
||||
de_mobile_type5_list_use = '{$de_mobile_type5_list_use}',
|
||||
de_mobile_type5_list_skin = '{$de_mobile_type5_list_skin}',
|
||||
de_mobile_type5_list_mod = '{$de_mobile_type5_list_mod}',
|
||||
de_mobile_type5_list_row = '{$de_mobile_type5_list_row}',
|
||||
de_mobile_type5_img_width = '{$de_mobile_type5_img_width}',
|
||||
de_mobile_type5_img_height = '{$de_mobile_type5_img_height}',
|
||||
de_rel_list_use = '{$de_rel_list_use}',
|
||||
de_rel_list_skin = '{$_POST['de_rel_list_skin']}',
|
||||
de_rel_list_mod = '{$de_rel_list_mod}',
|
||||
de_rel_img_width = '{$de_rel_img_width}',
|
||||
de_rel_img_height = '{$de_rel_img_height}',
|
||||
de_mobile_rel_list_use = '{$de_mobile_rel_list_use}',
|
||||
de_mobile_rel_list_skin = '{$_POST['de_mobile_rel_list_skin']}',
|
||||
de_mobile_rel_list_mod = '{$de_mobile_rel_list_mod}',
|
||||
de_mobile_rel_img_width = '{$de_mobile_rel_img_width}',
|
||||
de_mobile_rel_img_height = '{$de_mobile_rel_img_height}',
|
||||
de_search_list_skin = '{$_POST['de_search_list_skin']}',
|
||||
de_search_list_mod = '{$de_search_list_mod}',
|
||||
de_search_list_row = '{$de_search_list_row}',
|
||||
de_search_img_width = '{$de_search_img_width}',
|
||||
de_search_img_height = '{$de_search_img_height}',
|
||||
de_mobile_search_list_skin = '{$_POST['de_mobile_search_list_skin']}',
|
||||
de_mobile_search_list_mod = '{$de_mobile_search_list_mod}',
|
||||
de_mobile_search_list_row = '{$de_mobile_search_list_row}',
|
||||
de_mobile_search_img_width = '{$de_mobile_search_img_width}',
|
||||
de_mobile_search_img_height = '{$de_mobile_search_img_height}',
|
||||
de_listtype_list_skin = '{$_POST['de_listtype_list_skin']}',
|
||||
de_listtype_list_mod = '{$de_listtype_list_mod}',
|
||||
de_listtype_list_row = '{$de_listtype_list_row}',
|
||||
de_listtype_img_width = '{$de_listtype_img_width}',
|
||||
de_listtype_img_height = '{$_POST['de_listtype_img_height']}',
|
||||
de_mobile_listtype_list_skin = '{$_POST['de_mobile_listtype_list_skin']}',
|
||||
de_mobile_listtype_list_mod = '{$de_mobile_listtype_list_mod}',
|
||||
de_mobile_listtype_list_row = '{$de_mobile_listtype_list_row}',
|
||||
de_mobile_listtype_img_width = '{$de_mobile_listtype_img_width}',
|
||||
de_mobile_listtype_img_height = '{$de_mobile_listtype_img_height}',
|
||||
de_bank_use = '{$de_bank_use}',
|
||||
de_bank_account = '{$de_bank_account}',
|
||||
de_card_test = '{$de_card_test}',
|
||||
de_card_use = '{$de_card_use}',
|
||||
de_easy_pay_use = '{$de_easy_pay_use}',
|
||||
de_easy_pay_services = '{$de_easy_pay_services}',
|
||||
de_samsung_pay_use = '{$de_samsung_pay_use}',
|
||||
de_inicis_lpay_use = '{$de_inicis_lpay_use}',
|
||||
de_inicis_kakaopay_use = '{$de_inicis_kakaopay_use}',
|
||||
de_inicis_cartpoint_use = '{$de_inicis_cartpoint_use}',
|
||||
de_nicepay_mid = '{$de_nicepay_mid}',
|
||||
de_nicepay_key = '{$de_nicepay_key}',
|
||||
de_card_noint_use = '{$de_card_noint_use}',
|
||||
de_card_point = '{$de_card_point}',
|
||||
de_settle_min_point = '{$de_settle_min_point}',
|
||||
de_settle_max_point = '{$de_settle_max_point}',
|
||||
de_settle_point_unit = '{$de_settle_point_unit}',
|
||||
de_level_sell = '{$de_level_sell}',
|
||||
de_delivery_company = '{$de_delivery_company}',
|
||||
de_send_cost_case = '{$de_send_cost_case}',
|
||||
de_send_cost_limit = '{$de_send_cost_limit}',
|
||||
de_send_cost_list = '{$de_send_cost_list}',
|
||||
de_hope_date_use = '{$de_hope_date_use}',
|
||||
de_hope_date_after = '{$de_hope_date_after}',
|
||||
de_baesong_content = '{$_POST['de_baesong_content']}',
|
||||
de_change_content = '{$_POST['de_change_content']}',
|
||||
de_point_days = '{$de_point_days}',
|
||||
de_simg_width = '{$de_simg_width}',
|
||||
de_simg_height = '{$de_simg_height}',
|
||||
de_mimg_width = '{$de_mimg_width}',
|
||||
de_mimg_height = '{$de_mimg_height}',
|
||||
de_pg_service = '{$de_pg_service}',
|
||||
de_kcp_mid = '{$de_kcp_mid}',
|
||||
de_kcp_site_key = '{$de_kcp_site_key}',
|
||||
de_inicis_mid = '{$de_inicis_mid}',
|
||||
de_inicis_iniapi_key = '{$de_inicis_iniapi_key}',
|
||||
de_inicis_iniapi_iv = '{$de_inicis_iniapi_iv}',
|
||||
de_inicis_sign_key = '{$de_inicis_sign_key}',
|
||||
de_iche_use = '{$de_iche_use}',
|
||||
de_sms_cont1 = '{$_POST['de_sms_cont1']}',
|
||||
de_sms_cont2 = '{$_POST['de_sms_cont2']}',
|
||||
de_sms_cont3 = '{$_POST['de_sms_cont3']}',
|
||||
de_sms_cont4 = '{$_POST['de_sms_cont4']}',
|
||||
de_sms_cont5 = '{$_POST['de_sms_cont5']}',
|
||||
de_sms_use1 = '{$de_sms_use1}',
|
||||
de_sms_use2 = '{$de_sms_use2}',
|
||||
de_sms_use3 = '{$de_sms_use3}',
|
||||
de_sms_use4 = '{$de_sms_use4}',
|
||||
de_sms_use5 = '{$de_sms_use5}',
|
||||
de_sms_hp = '{$de_sms_hp}',
|
||||
de_item_use_use = '{$de_item_use_use}',
|
||||
de_item_use_write = '{$de_item_use_write}',
|
||||
de_code_dup_use = '{$de_code_dup_use}',
|
||||
de_cart_keep_term = '{$de_cart_keep_term}',
|
||||
de_guest_cart_use = '{$de_guest_cart_use}',
|
||||
de_admin_buga_no = '{$de_admin_buga_no}',
|
||||
de_vbank_use = '{$de_vbank_use}',
|
||||
de_taxsave_use = '{$de_taxsave_use}',
|
||||
de_taxsave_types = '{$de_taxsave_types}',
|
||||
de_guest_privacy = '{$_POST['de_guest_privacy']}',
|
||||
de_hp_use = '{$de_hp_use}',
|
||||
de_escrow_use = '{$de_escrow_use}',
|
||||
de_tax_flag_use = '{$de_tax_flag_use}',
|
||||
de_kakaopay_mid = '{$de_kakaopay_mid}',
|
||||
de_kakaopay_key = '{$de_kakaopay_key}',
|
||||
de_kakaopay_enckey = '{$de_kakaopay_enckey}',
|
||||
de_kakaopay_hashkey = '{$de_kakaopay_hashkey}',
|
||||
de_kakaopay_cancelpwd = '{$de_kakaopay_cancelpwd}',
|
||||
de_member_reg_coupon_use = '{$de_member_reg_coupon_use}',
|
||||
de_member_reg_coupon_term = '{$de_member_reg_coupon_term}',
|
||||
de_member_reg_coupon_price = '{$de_member_reg_coupon_price}',
|
||||
de_member_reg_coupon_minimum = '{$de_member_reg_coupon_minimum}'
|
||||
";
|
||||
if (defined('G5_SHOP_DIRECT_NAVERPAY') && G5_SHOP_DIRECT_NAVERPAY) {
|
||||
$sql .= " ,de_naverpay_mid = '{$de_naverpay_mid}',
|
||||
de_naverpay_cert_key = '{$de_naverpay_cert_key}',
|
||||
de_naverpay_button_key = '{$de_naverpay_button_key}',
|
||||
de_naverpay_test = '{$de_naverpay_test}',
|
||||
de_naverpay_mb_id = '{$de_naverpay_mb_id}',
|
||||
de_naverpay_sendcost = '{$de_naverpay_sendcost}' ";
|
||||
}
|
||||
sql_query($sql);
|
||||
|
||||
// 환경설정 > 포인트 사용
|
||||
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");
|
||||
}
|
||||
@@ -0,0 +1,295 @@
|
||||
<?php
|
||||
$sub_menu = '400800';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
$cp_id = isset($_REQUEST['cp_id']) ? clean_xss_tags($_REQUEST['cp_id'], 1, 1) : '';
|
||||
$cp = array(
|
||||
'cp_method'=>'',
|
||||
'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');
|
||||
?>
|
||||
|
||||
<form name="fcouponform" action="./couponformupdate.php" method="post" onsubmit="return form_check(this);">
|
||||
<input type="hidden" name="w" value="<?php echo get_sanitize_input($w); ?>">
|
||||
<input type="hidden" name="cp_id" value="<?php echo get_sanitize_input($cp_id); ?>">
|
||||
<input type="hidden" name="sst" value="<?php echo get_sanitize_input($sst); ?>">
|
||||
<input type="hidden" name="sod" value="<?php echo get_sanitize_input($sod); ?>">
|
||||
<input type="hidden" name="sfl" value="<?php echo get_sanitize_input($sfl); ?>">
|
||||
<input type="hidden" name="stx" value="<?php echo get_sanitize_input($stx); ?>">
|
||||
<input type="hidden" name="page" value="<?php echo get_sanitize_input($page);?>">
|
||||
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?></caption>
|
||||
<colgroup>
|
||||
<col class="grid_4">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><label for="cp_subject">쿠폰이름</label></th>
|
||||
<td>
|
||||
<input type="text" name="cp_subject" value="<?php echo get_sanitize_input($cp['cp_subject']); ?>" id="cp_subject" required class="required frm_input" size="50">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="cp_method">쿠폰종류</label></th>
|
||||
<td>
|
||||
<?php echo help("쿠폰 종류를 변경하시면 입력 서식도 일부 변경됩니다."); ?>
|
||||
<select name="cp_method" id="cp_method">
|
||||
<option value="0"<?php echo get_selected('0', $cp['cp_method']); ?>>개별상품할인</option>
|
||||
<option value="1"<?php echo get_selected('1', $cp['cp_method']); ?>>카테고리할인</option>
|
||||
<option value="2"<?php echo get_selected('2', $cp['cp_method']); ?>>주문금액할인</option>
|
||||
<option value="3"<?php echo get_selected('3', $cp['cp_method']); ?>>배송비할인</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="tr_cp_target">
|
||||
<th scope="row"><label for="cp_target"><?php echo $cp_target_label; ?></label></th>
|
||||
<td>
|
||||
<input type="text" name="cp_target" value="<?php echo stripslashes($cp['cp_target']); ?>" id="cp_target" required class="required frm_input">
|
||||
<button type="button" id="sch_target" class="btn_frmline"><?php echo $cp_target_btn; ?></button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="mb_id">회원아이디</label></th>
|
||||
<td>
|
||||
<input type="text" name="mb_id" value="<?php echo stripslashes($cp['mb_id']); ?>" id="mb_id" class="frm_input">
|
||||
<button type="button" id="sch_member" class="btn_frmline">회원검색</button>
|
||||
<input type="checkbox" name="chk_all_mb" id="chk_all_mb" value="1">
|
||||
<label for="chk_all_mb">전체회원</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="cp_start">사용시작일</label></th>
|
||||
<td>
|
||||
<?php echo help('입력 예: '.date('Y-m-d')); ?>
|
||||
<input type="text" name="cp_start" value="<?php echo stripslashes($cp['cp_start']); ?>" id="cp_start" required class="frm_input required">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="cp_end">사용종료일</label></th>
|
||||
<td>
|
||||
<?php echo help('입력 예: '.date('Y-m-d')); ?>
|
||||
<input type="text" name="cp_end" value="<?php echo stripslashes($cp['cp_end']); ?>" id="cp_end" required class="frm_input required">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="cp_type">쿠폰타입</label></th>
|
||||
<td>
|
||||
<?php echo help("쿠폰 타입을 변경하시면 입력 서식도 일부 변경됩니다."); ?>
|
||||
<select name="cp_type" id="cp_type">
|
||||
<option value="0"<?php echo get_selected('0', $cp['cp_type']); ?>>정액할인(원)</option>
|
||||
<option value="1"<?php echo get_selected('1', $cp['cp_type']); ?>>정률할인(%)</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="cp_price"><?php echo $cp['cp_type'] ? '할인비율' : '할인금액'; ?></label></th>
|
||||
<td>
|
||||
<input type="text" name="cp_price" value="<?php echo stripslashes($cp['cp_price']); ?>" id="cp_price" required class="frm_input required"> <span id="cp_price_unit"><?php echo $cp['cp_type'] ? '%' : '원'; ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="tr_cp_trunc">
|
||||
<th scope="row"><label for="cp_trunc">절사금액</label></th>
|
||||
<td>
|
||||
<select name="cp_trunc" id="cp_trunc">
|
||||
<option value="1"<?php echo get_selected('1', $cp['cp_trunc']); ?>>1원단위</option>
|
||||
<option value="10"<?php echo get_selected('10', $cp['cp_trunc']); ?>>10원단위</option>
|
||||
<option value="100"<?php echo get_selected('100', $cp['cp_trunc']); ?>>100원단위</option>
|
||||
<option value="1000"<?php echo get_selected('1000', $cp['cp_trunc']); ?>>1,000원단위</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="cp_minimum">최소주문금액</label></th>
|
||||
<td>
|
||||
<input type="text" name="cp_minimum" value="<?php echo stripslashes($cp['cp_minimum']); ?>" id="cp_minimum" class="frm_input"> 원
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="tr_cp_maximum">
|
||||
<th scope="row"><label for="cp_maximum">최대할인금액</label></th>
|
||||
<td>
|
||||
<input type="text" name="cp_maximum" value="<?php echo stripslashes($cp['cp_maximum']); ?>" id="cp_maximum" class="frm_input"> 원
|
||||
</td>
|
||||
</tr>
|
||||
<?php if($w == '') { ?>
|
||||
<tr>
|
||||
<th scope="row">쿠폰발행알림</th>
|
||||
<td>
|
||||
<label for="cp_sms_send">SMS발송</label>
|
||||
<input type="checkbox" name="cp_sms_send" value="1" id="cp_sms_send" checked>
|
||||
<label for="cp_email_send">이메일발송</label>
|
||||
<input type="checkbox" name="cp_email_send" value="1" id="cp_email_send" checked>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<a href="./couponlist.php" class="btn btn_02">목록</a>
|
||||
<input type="submit" value="확인" class="btn_submit btn" accesskey="s">
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
<?php if($cp['cp_method'] == 2 || $cp['cp_method'] == 3) { ?>
|
||||
$("#tr_cp_target").hide();
|
||||
$("#tr_cp_target").find("input").attr("required", false).removeClass("required");
|
||||
<?php } ?>
|
||||
<?php if($cp['cp_type'] != 1) { ?>
|
||||
$("#tr_cp_maximum").hide();
|
||||
$("#tr_cp_trunc").hide();
|
||||
<?php } ?>
|
||||
$("#cp_method").change(function() {
|
||||
var cp_method = $(this).val();
|
||||
change_method(cp_method);
|
||||
});
|
||||
|
||||
$("#cp_type").change(function() {
|
||||
var cp_type = $(this).val();
|
||||
change_type(cp_type);
|
||||
});
|
||||
|
||||
$("#sch_target").click(function() {
|
||||
var cp_method = $("#cp_method").val();
|
||||
var opt = "left=50,top=50,width=520,height=600,scrollbars=1";
|
||||
var url = "./coupontarget.php?sch_target=";
|
||||
|
||||
if(cp_method == "0") {
|
||||
window.open(url+"0", "win_target", opt);
|
||||
} else if(cp_method == "1") {
|
||||
window.open(url+"1", "win_target", opt);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$("#sch_member").click(function() {
|
||||
if($("#chk_all_mb").is(":checked")) {
|
||||
alert("전체회원 체크를 해제 후 이용해 주십시오.");
|
||||
return false;
|
||||
}
|
||||
|
||||
var opt = "left=50,top=50,width=520,height=600,scrollbars=1";
|
||||
var url = "./couponmember.php";
|
||||
window.open(url, "win_member", opt);
|
||||
});
|
||||
|
||||
$("#cp_start, #cp_end").datepicker(
|
||||
{ changeMonth: true, changeYear: true, dateFormat: "yy-mm-dd", showButtonPanel: true, yearRange: "c-99:c+99" }
|
||||
);
|
||||
});
|
||||
|
||||
function change_method(cp_method)
|
||||
{
|
||||
if(cp_method == "0") {
|
||||
$("#sch_target").text("상품검색");
|
||||
$("#tr_cp_target").find("label").text("적용상품");
|
||||
$("#tr_cp_target").find("input").attr("required", true).addClass("required");
|
||||
$("#tr_cp_target").show();
|
||||
} else if(cp_method == "1") {
|
||||
$("#sch_target").text("분류검색");
|
||||
$("#tr_cp_target").find("label").text("적용분류");
|
||||
$("#tr_cp_target").find("input").attr("required", true).addClass("required");
|
||||
$("#tr_cp_target").show();
|
||||
} else {
|
||||
$("#tr_cp_target").hide();
|
||||
$("#tr_cp_target").find("input").attr("required", false).removeClass("required");
|
||||
}
|
||||
}
|
||||
|
||||
function change_type(cp_type)
|
||||
{
|
||||
if(cp_type == "0") {
|
||||
$("#cp_price_unit").text("원");
|
||||
$("#cp_price_unit").closest("tr").find("label").text("할인금액");
|
||||
$("#tr_cp_maximum").hide();
|
||||
$("#tr_cp_trunc").hide();
|
||||
} else {
|
||||
$("#cp_price_unit").text("%");
|
||||
$("#cp_price_unit").closest("tr").find("label").text("할인비율");
|
||||
$("#tr_cp_maximum").show();
|
||||
$("#tr_cp_trunc").show();
|
||||
}
|
||||
}
|
||||
|
||||
function form_check(f)
|
||||
{
|
||||
var sel_type = f.cp_type;
|
||||
var cp_type = sel_type.options[sel_type.selectedIndex].value;
|
||||
var cp_price = f.cp_price.value;
|
||||
|
||||
if(!f.chk_all_mb.checked && f.mb_id.value == "") {
|
||||
alert("회원아이디를 입력해 주십시오.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isNaN(cp_price)) {
|
||||
if(cp_type == "1")
|
||||
alert("할인비율을 숫자로 입력해 주십시오.");
|
||||
else
|
||||
alert("할인금액을 숫자로 입력해 주십시오.");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
cp_price = parseInt(cp_price);
|
||||
|
||||
if(cp_type == "1" && (cp_price < 1 || cp_price > 99)) {
|
||||
alert("할인비율을 1과 99 사이의 숫자로 입력해 주십시오.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 전체회원일 때 쿠폰알림 체크되어 있으면 확인창
|
||||
if(f.chk_all_mb.checked && (f.cp_sms_send.checked || f.cp_email_send.checked)) {
|
||||
if(!confirm("전체회원에게 쿠폰발행알림을 발송하시겠습니까?"))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,267 @@
|
||||
<?php
|
||||
$sub_menu = '400800';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$_POST = array_map('trim', $_POST);
|
||||
|
||||
$check_sanitize_keys = array(
|
||||
'cp_subject', // 쿠폰이름
|
||||
'cp_method', // 쿠폰종류
|
||||
'cp_target', // 적용상품
|
||||
'mb_id', // 회원아이디
|
||||
'cp_start', // 사용시작일
|
||||
'cp_end', // 사용종료일
|
||||
'cp_type', // 쿠폰타입
|
||||
'cp_price', // 할인금액
|
||||
'cp_type', // 할인금액타입
|
||||
'cp_trunc', // 절사금액
|
||||
'cp_minimum', // 최소주문금액
|
||||
'cp_maximum', // 최대할인금액
|
||||
'chk_all_mb' // 전체회원 체크
|
||||
);
|
||||
|
||||
foreach( $check_sanitize_keys as $key ){
|
||||
$$key = $_POST[$key] = isset($_POST[$key]) ? strip_tags(clean_xss_attributes($_POST[$key])) : '';
|
||||
}
|
||||
|
||||
if(!$_POST['cp_subject'])
|
||||
alert('쿠폰이름을 입력해 주십시오.');
|
||||
|
||||
if($_POST['cp_method'] == 0 && !$_POST['cp_target'])
|
||||
alert('적용상품을 입력해 주십시오.');
|
||||
|
||||
if($_POST['cp_method'] == 1 && !$_POST['cp_target'])
|
||||
alert('적용분류를 입력해 주십시오.');
|
||||
|
||||
if(!$_POST['mb_id'] && !$_POST['chk_all_mb'])
|
||||
alert('회원아이디를 입력해 주십시오.');
|
||||
|
||||
if(!$_POST['cp_start'] || !$_POST['cp_end'])
|
||||
alert('사용 시작일과 종료일을 입력해 주십시오.');
|
||||
|
||||
if($_POST['cp_start'] > $_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 == '' && (isset($_POST['cp_sms_send']) || isset($_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.'<br>';
|
||||
$contents .= '적용대상 : '.$coupon_method.'<br>';
|
||||
$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');
|
||||
@@ -0,0 +1,187 @@
|
||||
<?php
|
||||
$sub_menu = '400800';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$sql_common = " from {$g5['g5_shop_coupon_table']} ";
|
||||
|
||||
$sql_search = " where (1) ";
|
||||
if ($stx) {
|
||||
$sql_search .= " and ( ";
|
||||
switch ($sfl) {
|
||||
case 'mb_id' :
|
||||
$sql_search .= " ({$sfl} = '{$stx}') ";
|
||||
break;
|
||||
default :
|
||||
$sql_search .= " ({$sfl} like '%{$stx}%') ";
|
||||
break;
|
||||
}
|
||||
$sql_search .= " ) ";
|
||||
}
|
||||
|
||||
if (!$sst) {
|
||||
$sst = "cp_no";
|
||||
$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 = 9;
|
||||
?>
|
||||
<div class="local_ov">
|
||||
<span class="btn_ov01"><span class="ov_txt">전체 </span><span class="ov_num"> <?php echo number_format($total_count) ?> 개</span></span>
|
||||
</div>
|
||||
<form name="fsearch" id="fsearch" class="local_sch01 local_sch" method="get">
|
||||
|
||||
<select name="sfl" title="검색대상">
|
||||
<option value="mb_id"<?php echo get_selected($sfl, "mb_id"); ?>>회원아이디</option>
|
||||
<option value="cp_subject"<?php echo get_selected($sfl, "cp_subject"); ?>>쿠폰이름</option>
|
||||
<option value="cp_id"<?php echo get_selected($sfl, "cp_id"); ?>>쿠폰코드</option>
|
||||
</select>
|
||||
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
|
||||
<input type="text" name="stx" value="<?php echo $stx ?>" id="stx" required class="required frm_input">
|
||||
<input type="submit" class="btn_submit" value="검색">
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
<form name="fcouponlist" id="fcouponlist" method="post" action="./couponlist_delete.php" onsubmit="return fcouponlist_submit(this);">
|
||||
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
|
||||
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
|
||||
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
|
||||
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
<input type="hidden" name="token" value="">
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
<label for="chkall" class="sound_only">쿠폰 전체</label>
|
||||
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
|
||||
</th>
|
||||
<th scope="col">쿠폰종류</th>
|
||||
<th scope="col">쿠폰코드</th>
|
||||
<th scope="col">쿠폰이름</th>
|
||||
<th scope="col">적용대상</th>
|
||||
<th scope="col"><?php echo subject_sort_link('mb_id') ?>회원아이디</a></th>
|
||||
<th scope="col"><?php echo subject_sort_link('cp_end') ?>사용기한</a></th>
|
||||
<th scope="col">사용회수</th>
|
||||
<th scope="col">관리</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
switch($row['cp_method']) {
|
||||
case '0':
|
||||
$row3 = get_shop_item($row['cp_target'], true);
|
||||
$cp_method = '개별상품할인';
|
||||
$cp_target = get_text($row3['it_name']);
|
||||
break;
|
||||
case '1':
|
||||
$sql3 = " select ca_name from {$g5['g5_shop_category_table']} where ca_id = '{$row['cp_target']}' ";
|
||||
$row3 = sql_fetch($sql3);
|
||||
$cp_method = '카테고리할인';
|
||||
$cp_target = get_text($row3['ca_name']);
|
||||
break;
|
||||
case '2':
|
||||
$cp_method = '주문금액할인';
|
||||
$cp_target = '주문금액';
|
||||
break;
|
||||
case '3':
|
||||
$cp_method = '배송비할인';
|
||||
$cp_target = '배송비';
|
||||
break;
|
||||
}
|
||||
|
||||
$link1 = '<a href="./orderform.php?od_id='.$row['od_id'].'">';
|
||||
$link2 = '</a>';
|
||||
|
||||
// 쿠폰사용회수
|
||||
$sql = " select count(*) as cnt from {$g5['g5_shop_coupon_log_table']} where cp_id = '{$row['cp_id']}' ";
|
||||
$tmp = sql_fetch($sql);
|
||||
$used_count = $tmp['cnt'];
|
||||
|
||||
$bg = 'bg'.($i%2);
|
||||
?>
|
||||
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td class="td_chk">
|
||||
<input type="hidden" id="cp_id_<?php echo $i; ?>" name="cp_id[<?php echo $i; ?>]" value="<?php echo $row['cp_id']; ?>">
|
||||
<input type="checkbox" id="chk_<?php echo $i; ?>" name="chk[]" value="<?php echo $i; ?>" title="내역선택">
|
||||
</td>
|
||||
<td><?php echo $cp_method; ?></td>
|
||||
<td><?php echo $row['cp_id']; ?></td>
|
||||
<td class="td_left"><?php echo $row['cp_subject']; ?></td>
|
||||
<td><?php echo $cp_target; ?></td>
|
||||
<td class="td_name sv_use"><div><?php echo $row['mb_id']; ?></div></td>
|
||||
<td class="td_datetime"><?php echo substr($row['cp_start'], 2, 8); ?> ~ <?php echo substr($row['cp_end'], 2, 8); ?></td>
|
||||
<td class="td_cntsmall"><?php echo number_format($used_count); ?></td>
|
||||
<td class="td_mng td_mng_s">
|
||||
<a href="./couponform.php?w=u&cp_id=<?php echo $row['cp_id']; ?>&<?php echo $qstr; ?>" class="btn btn_03"><span class="sound_only"><?php echo $row['cp_id']; ?> </span>수정</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($i == 0)
|
||||
echo '<tr><td colspan="'.$colspan.'" class="empty_table">자료가 없습니다.</td></tr>';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="btn_fixed_top">
|
||||
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value" class="btn btn_02">
|
||||
<a href="./couponform.php" id="coupon_add" class="btn btn_01">쿠폰 추가</a>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page="); ?>
|
||||
|
||||
<script>
|
||||
function fcouponlist_submit(f)
|
||||
{
|
||||
if (!is_checked("chk[]")) {
|
||||
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(document.pressed == "선택삭제") {
|
||||
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
$sub_menu = '400800';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
|
||||
auth_check_menu($auth, $sub_menu, 'd');
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$count = (isset($_POST['chk']) && is_array($_POST['chk'])) ? count($_POST['chk']) : 0;
|
||||
if(!$count)
|
||||
alert('선택삭제 하실 항목을 하나이상 선택해 주세요.');
|
||||
|
||||
for ($i=0; $i<$count; $i++)
|
||||
{
|
||||
// 실제 번호를 넘김
|
||||
$k = isset($_POST['chk'][$i]) ? (int) $_POST['chk'][$i] : 0;
|
||||
|
||||
$sql = " delete from {$g5['g5_shop_coupon_table']} where cp_id = '".preg_replace('/[^a-z0-9_\-]/i', '', $_POST['cp_id'][$k])."' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
goto_url('./couponlist.php?'.$qstr);
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
$sub_menu = '400800';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
$mb_name = isset($_REQUEST['mb_name']) ? clean_xss_tags($_REQUEST['mb_name'], 1, 1) : '';
|
||||
|
||||
$html_title = '회원검색';
|
||||
|
||||
$g5['title'] = $html_title;
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
$sql_common = " from {$g5['member_table']} ";
|
||||
$sql_where = " where mb_id <> '{$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);
|
||||
?>
|
||||
|
||||
<div id="sch_member_frm" class="new_win scp_new_win">
|
||||
<h1>쿠폰 적용 회원선택</h1>
|
||||
|
||||
<form name="fmember" method="get">
|
||||
<div id="scp_list_find">
|
||||
<label for="mb_name">회원이름</label>
|
||||
<input type="text" name="mb_name" id="mb_name" value="<?php echo get_text($mb_name); ?>" class="frm_input" size="20">
|
||||
<input type="submit" value="검색" class="btn_frmline">
|
||||
</div>
|
||||
<div class="tbl_head01 tbl_wrap new_win_con">
|
||||
<table>
|
||||
<caption>검색결과</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>회원이름</th>
|
||||
<th>회원아이디</th>
|
||||
<th>선택</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
?>
|
||||
<tr>
|
||||
<td class="td_mbname"><?php echo get_text($row['mb_name']); ?></td>
|
||||
<td class="td_left"><?php echo $row['mb_id']; ?></td>
|
||||
<td class="scp_find_select td_mng td_mng_s"><button type="button" class="btn btn_03" onclick="sel_member_id('<?php echo $row['mb_id']; ?>');">선택</button></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
if($i ==0)
|
||||
echo '<tr><td colspan="3" class="empty_table">검색된 자료가 없습니다.</td></tr>';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, '?'.$qstr1.'&page='); ?>
|
||||
|
||||
<div class="btn_confirm01 btn_confirm win_btn">
|
||||
<button type="button" onclick="window.close();" class="btn_close btn">닫기</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function sel_member_id(id)
|
||||
{
|
||||
var f = window.opener.document.fcouponform;
|
||||
f.mb_id.value = id;
|
||||
|
||||
window.close();
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
$sub_menu = '400800';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
$sch_target = isset($_GET['sch_target']) ? substr(preg_replace('/[^a-zA-Z0-9]/', '', strip_tags($_GET['sch_target'])), 0, 1) : '';
|
||||
$sch_word = isset($_GET['sch_word']) ? clean_xss_tags(strip_tags($_GET['sch_word'])) : '';
|
||||
|
||||
if($_GET['sch_target'] == 1) {
|
||||
$html_title = '분류';
|
||||
$t_name = '분류명';
|
||||
$t_id = '분류코드';
|
||||
$t_desc1 = '분류를';
|
||||
$t_desc2 = '분류가';
|
||||
} else {
|
||||
$html_title = '상품';
|
||||
$t_name = '상품명';
|
||||
$t_id = '상품코드';
|
||||
$t_desc1 = '상품을';
|
||||
$t_desc2 = '상품이';
|
||||
}
|
||||
|
||||
$g5['title'] = $html_title.'검색';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
if($sch_target == 1) {
|
||||
$sql_common = " from {$g5['g5_shop_category_table']} ";
|
||||
$sql_where = " where ca_use = '1' and ca_nocoupon = '0' ";
|
||||
if($sch_word)
|
||||
$sql_where .= " and ca_name like '%".sql_real_escape_string($sch_word)."%' ";
|
||||
$sql_select = " select ca_id as t_id, ca_name as t_name ";
|
||||
$sql_order = " order by ca_order, ca_name ";
|
||||
} else {
|
||||
$sql_common = " from {$g5['g5_shop_item_table']} ";
|
||||
$sql_where = " where it_use = '1' and it_nocoupon = '0' ";
|
||||
if($sch_word)
|
||||
$sql_where .= " and it_name like '%".sql_real_escape_string($sch_word)."%' ";
|
||||
$sql_select = " select it_id as t_id, it_name as t_name ";
|
||||
$sql_order = " order by it_order, it_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 = $sql_select . $sql_common . $sql_where . $sql_order . " limit $from_record, $rows ";
|
||||
|
||||
$result = sql_query($sql);
|
||||
|
||||
$qstr1 = 'sch_target='.$sch_target.'&sch_word='.urlencode($sch_word);
|
||||
?>
|
||||
|
||||
<div id="sch_target_frm" class="new_win scp_new_win">
|
||||
<h1>쿠폰 적용 <?php echo $html_title; ?>선택</h1>
|
||||
|
||||
<div class="local_desc01 local_desc">
|
||||
<p>
|
||||
쿠폰을 적용할 <?php echo $t_desc1; ?> 선택하세요.<br>
|
||||
<?php echo $t_desc2; ?> 많을 경우에는 검색 기능을 이용하세요.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<form name="ftarget" method="get">
|
||||
<input type="hidden" name="sch_target" value="<?php echo preg_replace('/[^a-zA-Z0-9]/', '', strip_tags($_GET['sch_target'])); ?>">
|
||||
|
||||
<div id="scp_list_find">
|
||||
<label for="sch_word"><?php echo $t_name; ?></label>
|
||||
<input type="text" name="sch_word" id="sch_word" value="<?php echo get_text($sch_word); ?>" class="frm_input required" required size="20">
|
||||
<input type="submit" value="검색" class="btn_frmline">
|
||||
</div>
|
||||
|
||||
<div class="tbl_head01 tbl_wrap new_win_con">
|
||||
<table>
|
||||
<caption>검색결과</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php echo $t_name; ?></th>
|
||||
<th scope="col"><?php echo $t_id; ?></th>
|
||||
<th scope="col">선택</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
?>
|
||||
<tr>
|
||||
<td class="td_left"><?php echo $row['t_name']; ?></td>
|
||||
<td class="scp_target_code"><?php echo $row['t_id']; ?></td>
|
||||
<td class="td_mng td_mng_s"><button type="button" class="btn btn_03" onclick="sel_target_id('<?php echo $row['t_id']; ?>');">선택</button>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
if($i ==0)
|
||||
echo '<tr><td colspan="3" class="empty_table">검색된 자료가 없습니다.</td></tr>';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, '?'.$qstr1.'&page='); ?>
|
||||
|
||||
<div class="btn_confirm01 btn_confirm win_btn">
|
||||
<button type="button" onclick="window.close();" class="btn">닫기</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function sel_target_id(id)
|
||||
{
|
||||
var f = window.opener.document.fcouponform;
|
||||
f.cp_target.value = id;
|
||||
|
||||
window.close();
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
@@ -0,0 +1,321 @@
|
||||
<?php
|
||||
$sub_menu = '400810';
|
||||
include_once('./_common.php');
|
||||
|
||||
$cz_id = isset($_REQUEST['cz_id']) ? (int) $_REQUEST['cz_id'] : 0;
|
||||
$cp = array(
|
||||
'cp_method'=>'',
|
||||
'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');
|
||||
?>
|
||||
|
||||
<form name="fcouponform" action="./couponzoneformupdate.php" method="post" enctype="multipart/form-data" onsubmit="return form_check(this);">
|
||||
<input type="hidden" name="w" value="<?php echo $w; ?>">
|
||||
<input type="hidden" name="cz_id" value="<?php echo $cz_id; ?>">
|
||||
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
|
||||
<input type="hidden" name="page" value="<?php echo $page;?>">
|
||||
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?></caption>
|
||||
<colgroup>
|
||||
<col class="grid_4">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><label for="cz_type">발행쿠폰타입</label></th>
|
||||
<td>
|
||||
<?php echo help("발행 쿠폰의 타입을 설정합니다.<br>포인트쿠폰은 회원의 포인트를 쿠폰으로 교환하는 쿠폰이며 다운로드 쿠폰은 회원이 다운로드하여 사용할 수 있는 쿠폰입니다."); ?>
|
||||
<select name="cz_type" id="cz_type">
|
||||
<option value="0"<?php echo get_selected('0', $cp['cz_type']); ?>>다운로드쿠폰</option>
|
||||
<option value="1"<?php echo get_selected('1', $cp['cz_type']); ?>>포인트쿠폰</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="cz_subject">쿠폰이름</label></th>
|
||||
<td>
|
||||
<input type="text" name="cz_subject" value="<?php echo get_text($cp['cz_subject']); ?>" id="cz_subject" required class="required frm_input" size="50">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="cz_start">사용시작일</label></th>
|
||||
<td>
|
||||
<?php echo help('입력 예: '.date('Y-m-d')); ?>
|
||||
<input type="text" name="cz_start" value="<?php echo stripslashes($cp['cz_start']); ?>" id="cz_start" required class="frm_input required">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="cz_end">사용종료일</label></th>
|
||||
<td>
|
||||
<?php echo help('입력 예: '.date('Y-m-d')); ?>
|
||||
<input type="text" name="cz_end" value="<?php echo stripslashes($cp['cz_end']); ?>" id="cz_end" required class="frm_input required">
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="tr_cz_point">
|
||||
<th scope="row"><label for="cz_point">쿠폰교환 포인트</label></th>
|
||||
<td>
|
||||
<?php echo help("쿠폰으로 교환할 회원의 포인트를 지정합니다. 쿠폰 다운로드 때 설정한 값만큼 회원의 포인트를 차감합니다."); ?>
|
||||
<input type="text" name="cz_point" value="<?php echo get_text($cp['cz_point']); ?>" id="cz_point" class="frm_input">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="cz_period">쿠폰사용기한</label></th>
|
||||
<td>
|
||||
<?php echo help("쿠폰 다운로드 후 사용할 수 있는 기간을 설정합니다."); ?>
|
||||
<input type="text" name="cz_period" value="<?php echo stripslashes($cp['cz_period']); ?>" id="cz_period" required class="frm_input required" size="5"> 일
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">쿠폰이미지</th>
|
||||
<td>
|
||||
<input type="file" name="cp_img">
|
||||
<?php
|
||||
$cpimg_str = '';
|
||||
$cpimg = G5_DATA_PATH."/coupon/{$cp['cz_file']}";
|
||||
if (is_file($cpimg) && $cp['cz_id']) {
|
||||
$size = @getimagesize($cpimg);
|
||||
if($size[0] && $size[0] > 750)
|
||||
$width = 750;
|
||||
else
|
||||
$width = $size[0];
|
||||
|
||||
echo '<input type="checkbox" name="cp_img_del" value="1" id="cp_img_del"> <label for="cp_img_del">삭제</label>';
|
||||
$cpimg_str = '<img src="'.G5_DATA_URL.'/coupon/'.$cp['cz_file'].'" width="'.$width.'">';
|
||||
}
|
||||
if ($cpimg_str) {
|
||||
echo '<div class="coupon_img">';
|
||||
echo $cpimg_str;
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="cp_method">발급쿠폰종류</label></th>
|
||||
<td>
|
||||
<select name="cp_method" id="cp_method">
|
||||
<option value="0"<?php echo get_selected('0', $cp['cp_method']); ?>>개별상품할인</option>
|
||||
<option value="1"<?php echo get_selected('1', $cp['cp_method']); ?>>카테고리할인</option>
|
||||
<option value="2"<?php echo get_selected('2', $cp['cp_method']); ?>>주문금액할인</option>
|
||||
<option value="3"<?php echo get_selected('3', $cp['cp_method']); ?>>배송비할인</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="tr_cp_target">
|
||||
<th scope="row"><label for="cp_target"><?php echo $cp_target_label; ?></label></th>
|
||||
<td>
|
||||
<input type="text" name="cp_target" value="<?php echo stripslashes($cp['cp_target']); ?>" id="cp_target" required class="required frm_input">
|
||||
<button type="button" id="sch_target" class="btn_frmline"><?php echo $cp_target_btn; ?></button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="cp_type">할인금액타입</label></th>
|
||||
<td>
|
||||
<select name="cp_type" id="cp_type">
|
||||
<option value="0"<?php echo get_selected('0', $cp['cp_type']); ?>>정액할인(원)</option>
|
||||
<option value="1"<?php echo get_selected('1', $cp['cp_type']); ?>>정률할인(%)</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="cp_price"><?php echo $cp['cp_type'] ? '할인비율' : '할인금액'; ?></label></th>
|
||||
<td>
|
||||
<input type="text" name="cp_price" value="<?php echo stripslashes($cp['cp_price']); ?>" id="cp_price" required class="frm_input required"> <span id="cp_price_unit"><?php echo $cp['cp_type'] ? '%' : '원'; ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="tr_cp_trunc">
|
||||
<th scope="row"><label for="cp_trunc">절사금액</label></th>
|
||||
<td>
|
||||
<select name="cp_trunc" id="cp_trunc">
|
||||
<option value="1"<?php echo get_selected('1', $cp['cp_trunc']); ?>>1원단위</option>
|
||||
<option value="10"<?php echo get_selected('10', $cp['cp_trunc']); ?>>10원단위</option>
|
||||
<option value="100"<?php echo get_selected('100', $cp['cp_trunc']); ?>>100원단위</option>
|
||||
<option value="1000"<?php echo get_selected('1000', $cp['cp_trunc']); ?>>1,000원단위</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="cp_minimum">최소주문금액</label></th>
|
||||
<td>
|
||||
<input type="text" name="cp_minimum" value="<?php echo stripslashes($cp['cp_minimum']); ?>" id="cp_minimum" class="frm_input"> 원
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="tr_cp_maximum">
|
||||
<th scope="row"><label for="cp_maximum">최대할인금액</label></th>
|
||||
<td>
|
||||
<input type="text" name="cp_maximum" value="<?php echo stripslashes($cp['cp_maximum']); ?>" id="cp_maximum" class="frm_input"> 원
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<a href="./couponzonelist.php?<?php echo $qstr; ?>" class="btn_02 btn">목록</a>
|
||||
<input type="submit" value="확인" class="btn_submit btn" accesskey="s">
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
<?php if(!$cp['cz_type']) { ?>
|
||||
$("#tr_cz_point").hide();
|
||||
<?php } ?>
|
||||
<?php if($cp['cp_method'] == 2 || $cp['cp_method'] == 3) { ?>
|
||||
$("#tr_cp_target").hide();
|
||||
$("#tr_cp_target").find("input").attr("required", false).removeClass("required");
|
||||
<?php } ?>
|
||||
<?php if($cp['cp_type'] != 1) { ?>
|
||||
$("#tr_cp_maximum").hide();
|
||||
$("#tr_cp_trunc").hide();
|
||||
<?php } ?>
|
||||
$("#cz_type").change(function() {
|
||||
if($(this).val() == "1") {
|
||||
$("#tr_cz_point").find("input").attr("required", true).addClass("required");
|
||||
$("#tr_cz_point").show();
|
||||
} else {
|
||||
$("#tr_cz_point").find("input").attr("required", false).removeClass("required");
|
||||
$("#tr_cz_point").hide();
|
||||
}
|
||||
});
|
||||
$("#cp_method").change(function() {
|
||||
var cp_method = $(this).val();
|
||||
change_method(cp_method);
|
||||
});
|
||||
|
||||
$("#cp_type").change(function() {
|
||||
var cp_type = $(this).val();
|
||||
change_type(cp_type);
|
||||
});
|
||||
|
||||
$("#sch_target").click(function() {
|
||||
var cp_method = $("#cp_method").val();
|
||||
var opt = "left=50,top=50,width=520,height=600,scrollbars=1";
|
||||
var url = "./coupontarget.php?sch_target=";
|
||||
|
||||
if(cp_method == "0") {
|
||||
window.open(url+"0", "win_target", opt);
|
||||
} else if(cp_method == "1") {
|
||||
window.open(url+"1", "win_target", opt);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$("#cz_start, #cz_end").datepicker(
|
||||
{ changeMonth: true, changeYear: true, dateFormat: "yy-mm-dd", showButtonPanel: true, yearRange: "c-99:c+99" }
|
||||
);
|
||||
});
|
||||
|
||||
function change_method(cp_method)
|
||||
{
|
||||
if(cp_method == "0") {
|
||||
$("#sch_target").text("상품검색");
|
||||
$("#tr_cp_target").find("label").text("적용상품");
|
||||
$("#tr_cp_target").find("input").attr("required", true).addClass("required");
|
||||
$("#tr_cp_target").show();
|
||||
} else if(cp_method == "1") {
|
||||
$("#sch_target").text("분류검색");
|
||||
$("#tr_cp_target").find("label").text("적용분류");
|
||||
$("#tr_cp_target").find("input").attr("required", true).addClass("required");
|
||||
$("#tr_cp_target").show();
|
||||
} else {
|
||||
$("#tr_cp_target").hide();
|
||||
$("#tr_cp_target").find("input").attr("required", false).removeClass("required");
|
||||
}
|
||||
}
|
||||
|
||||
function change_type(cp_type)
|
||||
{
|
||||
if(cp_type == "0") {
|
||||
$("#cp_price_unit").text("원");
|
||||
$("#cp_price_unit").closest("tr").find("label").text("할인금액");
|
||||
$("#tr_cp_maximum").hide();
|
||||
$("#tr_cp_trunc").hide();
|
||||
} else {
|
||||
$("#cp_price_unit").text("%");
|
||||
$("#cp_price_unit").closest("tr").find("label").text("할인비율");
|
||||
$("#tr_cp_maximum").show();
|
||||
$("#tr_cp_trunc").show();
|
||||
}
|
||||
}
|
||||
|
||||
function form_check(f)
|
||||
{
|
||||
var sel_type = f.cp_type;
|
||||
var cp_type = sel_type.options[sel_type.selectedIndex].value;
|
||||
var cp_price = f.cp_price.value;
|
||||
|
||||
<?php if(!$cpimg_str) { ?>
|
||||
if(f.cp_img.value == "") {
|
||||
alert("쿠폰이미지를 업로드해 주십시오.");
|
||||
return false;
|
||||
}
|
||||
<?php } ?>
|
||||
|
||||
if(isNaN(cp_price)) {
|
||||
if(cp_type == "1")
|
||||
alert("할인비율을 숫자로 입력해 주십시오.");
|
||||
else
|
||||
alert("할인금액을 숫자로 입력해 주십시오.");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
cp_price = parseInt(cp_price);
|
||||
|
||||
if(cp_type == "1" && (cp_price < 1 || cp_price > 99)) {
|
||||
alert("할인비율을 1과 99 사이의 숫자로 입력해 주십시오.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
$sub_menu = '400810';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
check_admin_token();
|
||||
|
||||
@mkdir(G5_DATA_PATH."/coupon", G5_DIR_PERMISSION);
|
||||
@chmod(G5_DATA_PATH."/coupon", G5_DIR_PERMISSION);
|
||||
|
||||
$_POST = array_map('trim', $_POST);
|
||||
|
||||
$check_sanitize_keys = array(
|
||||
'cz_subject', // 쿠폰이름
|
||||
'cz_type', // 발행쿠폰타입
|
||||
'cz_start', // 사용시작일
|
||||
'cz_end', // 사용종료일
|
||||
'cz_period', // 쿠폰사용기한
|
||||
'cz_point', // 쿠폰교환 포인트
|
||||
'cp_method', // 발급쿠폰종류
|
||||
'cp_target', // 적용상품
|
||||
'cp_price', // 할인금액
|
||||
'cp_type', // 할인금액타입
|
||||
'cp_trunc', // 절사금액
|
||||
'cp_minimum', // 최소주문금액
|
||||
'cp_maximum', // 최대할인금액
|
||||
);
|
||||
|
||||
foreach( $check_sanitize_keys as $key ){
|
||||
$$key = $_POST[$key] = isset($_POST[$key]) ? strip_tags(clean_xss_attributes($_POST[$key])) : '';
|
||||
}
|
||||
|
||||
if(!$_POST['cz_subject'])
|
||||
alert('쿠폰이름을 입력해 주십시오.');
|
||||
|
||||
if(!$_POST['cz_start'] || !$_POST['cz_end'])
|
||||
alert('사용 시작일과 종료일을 입력해 주십시오.');
|
||||
|
||||
if($_POST['cz_start'] > $_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);
|
||||
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
$sub_menu = '400810';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$sql_common = " from {$g5['g5_shop_coupon_zone_table']} ";
|
||||
|
||||
$sql_search = " where (1) ";
|
||||
if ($stx) {
|
||||
$sql_search .= " and cz_subject like '%$stx%' ";
|
||||
}
|
||||
|
||||
if (!$sst) {
|
||||
$sst = "cz_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 = 9;
|
||||
?>
|
||||
|
||||
<div class="local_ov">
|
||||
<span class="btn_ov01"><span class="ov_txt">전체 </span><span class="ov_num"> <?php echo number_format($total_count) ?> 개</span></span>
|
||||
</div>
|
||||
<form name="fsearch" id="fsearch" class="local_sch01 local_sch" method="get">
|
||||
|
||||
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
|
||||
<input type="text" name="stx" value="<?php echo $stx ?>" id="stx" required class="required frm_input">
|
||||
<input type="submit" class="btn_submit" value="검색">
|
||||
</form>
|
||||
|
||||
|
||||
<form name="fcouponlist" id="fcouponzonelist" method="post" action="./couponzonelist_delete.php" onsubmit="return fcouponzonelist_submit(this);">
|
||||
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
<input type="hidden" name="token" value="">
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
<label for="chkall" class="sound_only">쿠폰 전체</label>
|
||||
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
|
||||
</th>
|
||||
<th scope="col">쿠폰이름</th>
|
||||
<th scope="col">쿠폰종류</th>
|
||||
<th scope="col">적용대상</th>
|
||||
<th scope="col">쿠폰금액</th>
|
||||
<th scope="col">쿠폰사용기한</th>
|
||||
<th scope="col">다운로드</th>
|
||||
<th scope="col">사용기한</th>
|
||||
<th scope="col">관리</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
switch($row['cz_type']) {
|
||||
case '1':
|
||||
$cz_type = '포인트쿠폰';
|
||||
break;
|
||||
default:
|
||||
$cz_type = '다운로드쿠폰';
|
||||
break;
|
||||
}
|
||||
|
||||
switch($row['cp_method']) {
|
||||
case '0':
|
||||
$row3 = get_shop_item($row['cp_target'], true);
|
||||
$cp_method = '개별상품할인';
|
||||
$cp_target = get_text($row3['it_name']);
|
||||
break;
|
||||
case '1':
|
||||
$sql3 = " select ca_name from {$g5['g5_shop_category_table']} where ca_id = '{$row['cp_target']}' ";
|
||||
$row3 = sql_fetch($sql3);
|
||||
$cp_method = '카테고리할인';
|
||||
$cp_target = get_text($row3['ca_name']);
|
||||
break;
|
||||
case '2':
|
||||
$cp_method = '주문금액할인';
|
||||
$cp_target = '주문금액';
|
||||
break;
|
||||
case '3':
|
||||
$cp_method = '배송비할인';
|
||||
$cp_target = '배송비';
|
||||
break;
|
||||
}
|
||||
|
||||
if($row['cp_type'])
|
||||
$cp_price = $row['cp_price'].'%';
|
||||
else
|
||||
$cp_price = number_format($row['cp_price']).'원';
|
||||
|
||||
$bg = 'bg'.($i%2);
|
||||
?>
|
||||
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td class="td_chk">
|
||||
<input type="hidden" id="cz_id_<?php echo $i; ?>" name="cz_id[<?php echo $i; ?>]" value="<?php echo $row['cz_id']; ?>">
|
||||
<input type="checkbox" id="chk_<?php echo $i; ?>" name="chk[]" value="<?php echo $i; ?>" title="내역선택">
|
||||
</td>
|
||||
<td class="td_left"><?php echo get_text($row['cz_subject']); ?></td>
|
||||
<td class="td_type"><?php echo $cz_type; ?></td>
|
||||
<td class="td_type"><?php echo $cp_method; ?></td>
|
||||
<td class="td_odrnum2"><?php echo $cp_price; ?></td>
|
||||
<td class="td_type">다운로드 후 <?php echo $row['cz_period']; ?>일</td>
|
||||
<td class="td_num"><?php echo number_format($row['cz_download']); ?></td>
|
||||
<td class="td_datetime"><?php echo substr($row['cz_start'], 2, 8); ?> ~ <?php echo substr($row['cz_end'], 2, 8); ?></td>
|
||||
<td class="td_mng td_mng_s">
|
||||
<a href="./couponzoneform.php?w=u&cz_id=<?php echo $row['cz_id']; ?>&<?php echo $qstr; ?>" class="btn btn_03"><span class="sound_only"><?php echo get_text($row['cz_subject']); ?> </span>수정</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($i == 0)
|
||||
echo '<tr><td colspan="'.$colspan.'" class="empty_table">자료가 없습니다.</td></tr>';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value" class="btn btn_02">
|
||||
<a href="./couponzoneform.php" id="coupon_add" class="btn btn_01">쿠폰 추가</a>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page="); ?>
|
||||
|
||||
<script>
|
||||
function fcouponzonelist_submit(f)
|
||||
{
|
||||
if (!is_checked("chk[]")) {
|
||||
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(document.pressed == "선택삭제") {
|
||||
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
$sub_menu = '400810';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
|
||||
auth_check_menu($auth, $sub_menu, 'd');
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$count = (isset($_POST['chk']) && is_array($_POST['chk'])) ? count($_POST['chk']) : 0;
|
||||
if(!$count)
|
||||
alert('선택삭제 하실 항목을 하나이상 선택해 주세요.');
|
||||
|
||||
for ($i=0; $i<$count; $i++)
|
||||
{
|
||||
// 실제 번호를 넘김
|
||||
$k = isset($_POST['chk'][$i]) ? (int) $_POST['chk'][$i] : 0;
|
||||
$ccz_id = isset($_POST['cz_id'][$k]) ? (int) $_POST['cz_id'][$k] : 0;
|
||||
|
||||
$sql = " delete from {$g5['g5_shop_coupon_zone_table']} where cz_id = '{$ccz_id}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
goto_url('./couponzonelist.php?'.$qstr);
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 77 B |
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.0 KiB |
@@ -0,0 +1,545 @@
|
||||
<?php
|
||||
$sub_menu = '400010';
|
||||
include_once('./_common.php');
|
||||
|
||||
$max_limit = 7; // 몇행 출력할 것인지?
|
||||
|
||||
$g5['title'] = ' 쇼핑몰현황';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
$pg_anchor = '<ul class="anchor sidx_anchor">
|
||||
<li><a href="#anc_sidx_ord">주문현황</a></li>
|
||||
<li><a href="#anc_sidx_rdy">입금완료미배송내역</a></li>
|
||||
<li><a href="#anc_sidx_wait">미입금주문내역</a></li>
|
||||
<li><a href="#anc_sidx_ps">사용후기</a></li>
|
||||
<li><a href="#anc_sidx_qna">상품문의</a></li>
|
||||
</ul>';
|
||||
|
||||
// 주문상태에 따른 합계 금액
|
||||
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);
|
||||
}
|
||||
?>
|
||||
<?php if (! auth_check_menu($auth, '400400', 'r', true)) { ?>
|
||||
<div class="sidx">
|
||||
<section id="anc_sidx_ord">
|
||||
<h2>주문현황</h2>
|
||||
<?php echo $pg_anchor; ?>
|
||||
|
||||
<?php
|
||||
$arr_order = array();
|
||||
$x_val = array();
|
||||
for($i=6; $i>=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;
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="sidx_graph">
|
||||
<ul id="sidx_graph_price">
|
||||
<?php
|
||||
foreach($y_val as $val) {
|
||||
?>
|
||||
<li><span></span><?php echo number_format($val); ?></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<ul id="sidx_graph_area">
|
||||
<?php
|
||||
for($i=0; $i<count($x_val); $i++) {
|
||||
$order_title = date("n월 j일", strtotime($x_val[$i])).' 주문: '.display_price($arr_order[$i]['order']);
|
||||
$cancel_title = date("n월 j일", strtotime($x_val[$i])).' 취소: '.display_price($arr_order[$i]['cancel']);
|
||||
$k = 10 - $i;
|
||||
$li_bg = 'bg'.($i%2);
|
||||
?>
|
||||
<li class="<?php echo $li_bg; ?>" style="z-index:<?php echo $k; ?>">
|
||||
<div class="graph order" title="<?php echo $order_title; ?>">
|
||||
|
||||
</div>
|
||||
<div class="graph cancel" title="<?php echo $cancel_title; ?>">
|
||||
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<ul id="sidx_graph_date">
|
||||
<?php
|
||||
foreach($x_val as $val) {
|
||||
?>
|
||||
<li><span></span><?php echo substr($val, 5, 5).' ('.get_yoil($val).')'; ?></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<div id="sidx_graph_legend">
|
||||
<span id="legend_order"></span> 주문
|
||||
<span id="legend_cancel"></span> 취소
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div id="sidx_stat">
|
||||
<section id="anc_sidx_act">
|
||||
<h2>처리할 주문</h2>
|
||||
<?php echo $pg_anchor; ?>
|
||||
|
||||
<div id="sidx_take_act" class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="td_mng">상태변경</th>
|
||||
<th scope="col">건수</th>
|
||||
<th scope="col">금액</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<?php
|
||||
$info = get_order_status_sum('주문');
|
||||
?>
|
||||
<th scope="row">주문 -> 입금</th>
|
||||
<td class="td_num"><a href="<?php echo $info['href']; ?>"><?php echo number_format($info['count']); ?></a></td>
|
||||
<td class="td_price"><a href="<?php echo $info['href']; ?>"><?php echo number_format($info['price']); ?></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php
|
||||
$info = get_order_status_sum('입금');
|
||||
?>
|
||||
<th scope="row">입금 -> 준비</th>
|
||||
<td class="td_num"><a href="<?php echo $info['href']; ?>"><?php echo number_format($info['count']); ?></a></td>
|
||||
<td class="td_price"><a href="<?php echo $info['href']; ?>"><?php echo number_format($info['price']); ?></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php
|
||||
$info = get_order_status_sum('준비');
|
||||
?>
|
||||
<th scope="row">준비 -> 배송</th>
|
||||
<td class="td_num"><a href="<?php echo $info['href']; ?>"><?php echo number_format($info['count']); ?></a></td>
|
||||
<td class="td_price"><a href="<?php echo $info['href']; ?>"><?php echo number_format($info['price']); ?></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php
|
||||
$info = get_order_status_sum('배송');
|
||||
?>
|
||||
<th scope="row">배송 -> 완료</th>
|
||||
<td class="td_num"><a href="<?php echo $info['href']; ?>"><?php echo number_format($info['count']); ?></a></td>
|
||||
<td class="td_price"><a href="<?php echo $info['href']; ?>"><?php echo number_format($info['price']); ?></a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="anc_sidx_stock">
|
||||
<h2>재고현황</h2>
|
||||
<?php echo $pg_anchor; ?>
|
||||
|
||||
<?php
|
||||
// 재고부족 상품
|
||||
$item_noti = 0;
|
||||
$sql = " select count(*) as cnt
|
||||
from {$g5['g5_shop_item_table']}
|
||||
where it_use = '1'
|
||||
and it_option_subject = ''
|
||||
and it_stock_qty <= it_noti_qty ";
|
||||
$row = sql_fetch($sql);
|
||||
$item_noti = (int)$row['cnt'];
|
||||
|
||||
// 재고부족 옵션
|
||||
$option_noti = 0;
|
||||
$sql = " select count(*) as cnt
|
||||
from {$g5['g5_shop_item_option_table']}
|
||||
where io_use = '1'
|
||||
and io_stock_qty <= io_noti_qty ";
|
||||
$row = sql_fetch($sql);
|
||||
$option_noti = (int)$row['cnt'];
|
||||
|
||||
// SMS 정보
|
||||
$userinfo = array('coin'=>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']);
|
||||
}
|
||||
?>
|
||||
<div id="sidx_stock" class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">재고부족 상품</th>
|
||||
<th scope="col">재고부족 옵션</th>
|
||||
<th scope="col">SMS 잔여금액</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="td_num2"><a href="./itemstocklist.php"><?php echo number_format($item_noti); ?></a></td>
|
||||
<td class="td_num2"><a href="./optionstocklist.php"><?php echo number_format($option_noti); ?></a></td>
|
||||
<td class="td_price"><?php echo display_price(intval($userinfo['coin'])); ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section id="anc_sidx_settle">
|
||||
<h2>결제수단별 주문현황</h2>
|
||||
<?php echo $pg_anchor; ?>
|
||||
|
||||
<div id="sidx_settle" class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" rowspan="2">구분</th>
|
||||
<?php
|
||||
$term = 3;
|
||||
$info = array();
|
||||
$info_key = array();
|
||||
for($i=($term - 1); $i>=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;
|
||||
?>
|
||||
<th scope="col" colspan="2"><?php echo $day; ?></th>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php
|
||||
for($i=0; $i<$term; $i++) {
|
||||
?>
|
||||
<th scope="col">건수</th>
|
||||
<th scope="col">금액</th>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$case = array('신용카드', '계좌이체', '가상계좌', '무통장', '휴대폰', '포인트', '쿠폰');
|
||||
|
||||
$val_cnt = 0;
|
||||
foreach($case as $val)
|
||||
{
|
||||
$val_cnt++;
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row" id="th_val_<?php echo $val_cnt; ?>" class="td_category"><?php echo $val; ?></th>
|
||||
<?php
|
||||
foreach($info_key as $date)
|
||||
{
|
||||
?>
|
||||
<td><?php echo number_format($info[$date][$val]['count']); ?></td>
|
||||
<td><?php echo number_format($info[$date][$val]['price']); ?></td>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script>
|
||||
jQuery(function($) {
|
||||
graph_draw();
|
||||
|
||||
$("#sidx_graph_area div").hover(
|
||||
function() {
|
||||
if($(this).is(":animated"))
|
||||
return false;
|
||||
|
||||
var title = $(this).attr("title");
|
||||
if(title && $(this).data("title") == undefined)
|
||||
$(this).data("title", title);
|
||||
var left = parseInt($(this).css("left")) + 10;
|
||||
var bottom = $(this).height() + 5;
|
||||
|
||||
$(this)
|
||||
.attr("title", "")
|
||||
.append("<div id=\"price_tooltip\"><div></div></div>");
|
||||
$("#price_tooltip")
|
||||
.find("div")
|
||||
.html(title)
|
||||
.end()
|
||||
// .css({ left: left+"px", bottom: bottom+"px" })
|
||||
.show(200);
|
||||
},
|
||||
function() {
|
||||
if($(this).is(":animated"))
|
||||
return false;
|
||||
|
||||
$(this).attr("title", $(this).data("title"));
|
||||
$("#price_tooltip").remove();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
function graph_draw()
|
||||
{
|
||||
var g_h1 = new Array("<?php echo implode('", "', $h_val['order']); ?>");
|
||||
var g_h2 = new Array("<?php echo implode('", "', $h_val['cancel']); ?>");
|
||||
var duration = 600;
|
||||
|
||||
var $el = $("#sidx_graph_area li");
|
||||
var h1, h2;
|
||||
var $g1, $g2;
|
||||
|
||||
$el.each(function(index) {
|
||||
h1 = g_h1[index];
|
||||
h2 = g_h2[index];
|
||||
|
||||
$g1 = $(this).find(".order");
|
||||
$g2 = $(this).find(".cancel");
|
||||
|
||||
$g1.animate({ height: h1+"px" }, duration);
|
||||
$g2.animate({ height: h2+"px" }, duration);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php } //endif ?>
|
||||
<?php if ($is_admin === 'super') { ?>
|
||||
<div class="sidx sidx_cs">
|
||||
<section id="anc_sidx_oneq">
|
||||
<h2>1:1문의</h2>
|
||||
<?php echo $pg_anchor; ?>
|
||||
|
||||
<div class="ul_01 ul_wrap">
|
||||
<ul>
|
||||
<?php
|
||||
$sql = " select * from {$g5['qa_content_table']}
|
||||
where qa_status = '0'
|
||||
and qa_type = '0'
|
||||
order by qa_num
|
||||
limit $max_limit ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
$sql1 = " select * from {$g5['member_table']} where mb_id = '{$row['mb_id']}' ";
|
||||
$row1 = sql_fetch($sql1);
|
||||
|
||||
$name = get_sideview($row['mb_id'], get_text($row['qa_name']), $row1['mb_email'], $row1['mb_homepage']);
|
||||
?>
|
||||
<li>
|
||||
<span class="oneq_cate oneq_span"><?php echo get_text($row['qa_category']); ?></span>
|
||||
<a href="<?php echo G5_BBS_URL; ?>/qaview.php?qa_id=<?php echo $row['qa_id']; ?>" target="_blank" class="oneq_link"><?php echo conv_subject($row['qa_subject'],40); ?></a>
|
||||
<?php echo $name; ?>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($i == 0)
|
||||
echo '<li class="empty_list">자료가 없습니다.</li>';
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="btn_list03 btn_list">
|
||||
<a href="<?php echo G5_BBS_URL; ?>/qalist.php" target="_blank">1:1문의 더보기</a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="anc_sidx_qna">
|
||||
<h2>상품문의</h2>
|
||||
<?php echo $pg_anchor; ?>
|
||||
|
||||
<div class="ul_01 ul_wrap">
|
||||
<ul>
|
||||
<?php
|
||||
$sql = " select * from {$g5['g5_shop_item_qa_table']}
|
||||
where iq_answer = ''
|
||||
order by iq_id desc
|
||||
limit $max_limit ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
$sql1 = " select * from {$g5['member_table']} where mb_id = '{$row['mb_id']}' ";
|
||||
$row1 = sql_fetch($sql1);
|
||||
|
||||
$name = get_sideview($row['mb_id'], get_text($row['iq_name']), $row1['mb_email'], $row1['mb_homepage']);
|
||||
?>
|
||||
<li>
|
||||
<a href="./itemqaform.php?w=u&iq_id=<?php echo $row['iq_id']; ?>" class="qna_link"><?php echo conv_subject($row['iq_subject'],40); ?></a>
|
||||
<?php echo $name; ?>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($i == 0)
|
||||
echo '<li class="empty_list">자료가 없습니다.</li>';
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="btn_list03 btn_list">
|
||||
<a href="./itemqalist.php?sort1=iq_answer&sort2=asc">상품문의 더보기</a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="anc_sidx_ps">
|
||||
<h2>사용후기</h2>
|
||||
<?php echo $pg_anchor; ?>
|
||||
|
||||
<div class="ul_01 ul_wrap">
|
||||
<ul>
|
||||
<?php
|
||||
$sql = " select * from {$g5['g5_shop_item_use_table']}
|
||||
where is_confirm = 0
|
||||
order by is_id desc
|
||||
limit $max_limit ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
$sql1 = " select * from {$g5['member_table']} where mb_id = '{$row['mb_id']}' ";
|
||||
$row1 = sql_fetch($sql1);
|
||||
|
||||
$name = get_sideview($row['mb_id'], get_text($row['is_name']), $row1['mb_email'], $row1['mb_homepage']);
|
||||
?>
|
||||
<li>
|
||||
<a href="./itemuseform.php?w=u&is_id=<?php echo $row['is_id']; ?>" class="ps_link"><?php echo conv_subject($row['is_subject'],40); ?></a>
|
||||
<?php echo $name; ?>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
if ($i == 0) echo '<li class="empty_list">자료가 없습니다.</li>';
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="btn_list03 btn_list">
|
||||
<a href="./itemuselist.php?sort1=is_confirm&sort2=asc">사용후기 더보기</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<?php
|
||||
} //end if
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,574 @@
|
||||
<?php
|
||||
$sub_menu = '400410';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
$od_id = isset($_REQUEST['od_id']) ? safe_replace_regex($_REQUEST['od_id'], 'od_id') : '';
|
||||
|
||||
$g5['title'] = "미완료주문 내역";
|
||||
include_once(G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// 주문서 정보
|
||||
//------------------------------------------------------------------------------
|
||||
$sql = " select * from {$g5['g5_shop_order_data_table']} where od_id = '$od_id' ";
|
||||
$od = sql_fetch($sql);
|
||||
if (!$od['od_id']) {
|
||||
alert("해당 주문번호로 미완료 주문서가 존재하지 않습니다.");
|
||||
}
|
||||
|
||||
// 주문정보
|
||||
$data = unserialize(base64_decode($od['dt_data']));
|
||||
|
||||
$sql_common = " from {$g5['g5_shop_cart_table']} where od_id = '{$od['cart_id']}' and ct_status = '쇼핑' and ct_select = '1' ";
|
||||
|
||||
// 주문금액
|
||||
$sql = " select SUM(IF(io_type = 1, io_price, (ct_price + io_price)) * ct_qty) as od_price, COUNT(distinct it_id) as cart_count $sql_common ";
|
||||
$row = sql_fetch($sql);
|
||||
$tot_ct_price = $row['od_price'];
|
||||
$cart_count = $row['cart_count'];
|
||||
$tot_od_price = $tot_ct_price;
|
||||
|
||||
// 쿠폰금액
|
||||
$tot_cp_price = 0;
|
||||
if($od['mb_id']) {
|
||||
// 상품쿠폰
|
||||
$tot_it_cp_price = $tot_od_cp_price = 0;
|
||||
$it_cp_cnt = (isset($data['cp_id']) && is_array($data['cp_id'])) ? count($data['cp_id']) : 0;
|
||||
$arr_it_cp_prc = array();
|
||||
for($i=0; $i<$it_cp_cnt; $i++) {
|
||||
$cid = $data['cp_id'][$i];
|
||||
$it_id = $data['it_id'][$i];
|
||||
$sql = " select cp_id, cp_method, cp_target, cp_type, cp_price, cp_trunc, cp_minimum, cp_maximum
|
||||
from {$g5['g5_shop_coupon_table']}
|
||||
where cp_id = '$cid'
|
||||
and mb_id IN ( '{$od['mb_id']}', '전체회원' )
|
||||
and cp_method IN ( 0, 1 ) ";
|
||||
$cp = sql_fetch($sql);
|
||||
if(! (isset($cp['cp_id']) && $cp['cp_id']))
|
||||
continue;
|
||||
|
||||
// 사용한 쿠폰인지
|
||||
if(is_used_coupon($od['mb_id'], $cp['cp_id']))
|
||||
continue;
|
||||
|
||||
// 분류할인인지
|
||||
if($cp['cp_method']) {
|
||||
$sql2 = " select it_id, ca_id, ca_id2, ca_id3
|
||||
from {$g5['g5_shop_item_table']}
|
||||
where it_id = '$it_id' ";
|
||||
$row2 = sql_fetch($sql2);
|
||||
|
||||
if(!$row2['it_id'])
|
||||
continue;
|
||||
|
||||
if($row2['ca_id'] != $cp['cp_target'] && $row2['ca_id2'] != $cp['cp_target'] && $row2['ca_id3'] != $cp['cp_target'])
|
||||
continue;
|
||||
} else {
|
||||
if($cp['cp_target'] != $it_id)
|
||||
continue;
|
||||
}
|
||||
|
||||
// 상품금액
|
||||
$sql = " select SUM( IF(io_type = '1', io_price * ct_qty, (ct_price + io_price) * ct_qty)) as sum_price $sql_common and it_id = '$it_id' ";
|
||||
$ct = sql_fetch($sql);
|
||||
$item_price = $ct['sum_price'];
|
||||
|
||||
if($cp['cp_minimum'] > $item_price)
|
||||
continue;
|
||||
|
||||
$dc = 0;
|
||||
if($cp['cp_type']) {
|
||||
$dc = floor(($item_price * ($cp['cp_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 = '<ul class="anchor">
|
||||
<li><a href="#anc_sodr_list">주문상품 목록</a></li>
|
||||
<li><a href="#anc_sodr_orderer">주문하신 분</a></li>
|
||||
<li><a href="#anc_sodr_taker">받으시는 분</a></li>
|
||||
</ul>';
|
||||
?>
|
||||
|
||||
<section id="anc_sodr_list">
|
||||
<h2 class="h2_frm">주문상품 목록</h2>
|
||||
<?php echo $pg_anchor; ?>
|
||||
<div class="local_desc02 local_desc">
|
||||
<p>
|
||||
주문일시 <strong><?php echo substr($od['dt_time'],0,16); ?> (<?php echo get_yoil($od['dt_time']); ?>)</strong>
|
||||
|
|
||||
주문합계 <strong><?php echo number_format($order_price); ?></strong>원
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption>주문 상품 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">상품명</th>
|
||||
<th scope="col">옵션항목</th>
|
||||
<th scope="col">상태</th>
|
||||
<th scope="col">수량</th>
|
||||
<th scope="col">판매가</th>
|
||||
<th scope="col">소계</th>
|
||||
<th scope="col">쿠폰</th>
|
||||
<th scope="col">포인트</th>
|
||||
<th scope="col">배송비</th>
|
||||
<th scope="col">포인트반영</th>
|
||||
<th scope="col">재고반영</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
// 상품이미지
|
||||
$image = get_it_image($row['it_id'], 50, 50);
|
||||
|
||||
// 상품의 옵션정보
|
||||
$sql = " select ct_id, it_id, ct_price, ct_point, ct_qty, ct_option, ct_status, cp_price, ct_stock_use, ct_point_use, ct_send_cost, io_type, io_price $sql_common and it_id = '{$row['it_id']}' order by io_type asc, ct_id asc ";
|
||||
$res = sql_query($sql);
|
||||
$rowspan = sql_num_rows($res);
|
||||
|
||||
// 합계금액 계산
|
||||
$sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price, SUM(ct_qty) as qty $sql_common and it_id = '{$row['it_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'], $od['cart_id']);
|
||||
|
||||
if($sendcost == 0)
|
||||
$ct_send_cost = '무료';
|
||||
}
|
||||
|
||||
for($k=0; $opt=sql_fetch_array($res); $k++) {
|
||||
if($opt['io_type'])
|
||||
$opt_price = $opt['io_price'];
|
||||
else
|
||||
$opt_price = $opt['ct_price'] + $opt['io_price'];
|
||||
|
||||
// 소계
|
||||
$ct_price['stotal'] = $opt_price * $opt['ct_qty'];
|
||||
$ct_point['stotal'] = $opt['ct_point'] * $opt['ct_qty'];
|
||||
|
||||
if($k == 0)
|
||||
$opt_cp_price = isset($arr_it_cp_prc[$row['it_id']]) ? (int) $arr_it_cp_prc[$row['it_id']] : 0;
|
||||
else
|
||||
$opt_cp_price = 0;
|
||||
?>
|
||||
<tr>
|
||||
<?php if($k == 0) { ?>
|
||||
<td rowspan="<?php echo $rowspan; ?>">
|
||||
<?php echo $image; ?> <?php echo stripslashes($row['it_name']); ?>
|
||||
<?php if(isset($od['od_tax_flag']) && $od['od_tax_flag'] && $row['ct_notax']) echo '[비과세상품]'; ?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<td><?php echo $opt['ct_option']; ?></td>
|
||||
<td class="td_mngsmall"><?php echo $opt['ct_status']; ?></td>
|
||||
<td class="td_num"><?php echo number_format($opt['ct_qty']); ?></td>
|
||||
<td class="td_num"><?php echo number_format($opt_price); ?></td>
|
||||
<td class="td_num"><?php echo number_format($ct_price['stotal']); ?></td>
|
||||
<td class="td_num"><?php echo number_format($opt_cp_price); ?></td>
|
||||
<td class="td_num"><?php echo number_format($ct_point['stotal']); ?></td>
|
||||
<td class="td_sendcost_by"><?php echo $ct_send_cost; ?></td>
|
||||
<td class="td_mngsmall"><?php echo get_yn($opt['ct_point_use']); ?></td>
|
||||
<td class="td_mngsmall"><?php echo get_yn($opt['ct_stock_use']); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="anc_sodr_pay">
|
||||
<h2 class="h2_frm">주문결제 내역</h2>
|
||||
<?php echo $pg_anchor; ?>
|
||||
|
||||
<?php
|
||||
// 주문금액 = 상품구입금액 + 배송비 + 추가배송비
|
||||
$amount['order'] = $tot_ct_price + $od_send_cost + $od_send_cost2;
|
||||
|
||||
// 입금액
|
||||
$amount['receipt'] = $od_temp_point;
|
||||
|
||||
// 쿠폰금액
|
||||
$amount['coupon'] = $tot_cp_price + $tot_sc_cp_price;
|
||||
|
||||
// 취소금액
|
||||
$amount['cancel'] = 0;
|
||||
|
||||
// 미수금 = 주문금액 - 취소금액 - 입금금액 - 쿠폰금액
|
||||
$amount['misu'] = $amount['order'] - $amount['receipt'] - $amount['coupon'];
|
||||
|
||||
// 결제방법
|
||||
$s_receipt_way = $data['od_settle_case'];
|
||||
|
||||
if($data['od_settle_case'] == '간편결제') {
|
||||
switch($od['dt_pg']) {
|
||||
case 'lg':
|
||||
$s_receipt_way = 'PAYNOW';
|
||||
break;
|
||||
case 'inicis':
|
||||
$s_receipt_way = 'KPAY';
|
||||
break;
|
||||
case 'kcp':
|
||||
$s_receipt_way = 'PAYCO';
|
||||
break;
|
||||
default:
|
||||
$s_receipt_way = $data['od_settle_case'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($od_temp_point > 0)
|
||||
$s_receipt_way .= "+포인트";
|
||||
?>
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<form name="frmorderform" method="post" action="./inorderformupdate.php" onsubmit="return form_submit(this);">
|
||||
<input type="hidden" name="od_id" value="<?php echo $od_id; ?>">
|
||||
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
|
||||
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
|
||||
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
|
||||
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
|
||||
<strong class="sodr_nonpay">미수금 <?php echo display_price($amount['misu']); ?></strong>
|
||||
|
||||
<table>
|
||||
<caption>주문결제 내역</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">주문번호</th>
|
||||
<th scope="col">결제방법</th>
|
||||
<th scope="col">주문총액</th>
|
||||
<th scope="col">배송비</th>
|
||||
<th scope="col">포인트결제</th>
|
||||
<th scope="col">총결제액</th>
|
||||
<th scope="col">쿠폰</th>
|
||||
<th scope="col">주문취소</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><?php echo $od['od_id']; ?></td>
|
||||
<td class="td_paybybig"><?php echo $s_receipt_way; ?></td>
|
||||
<td class="td_numbig td_numsum"><?php echo display_price($amount['order']); ?></td>
|
||||
<td class="td_numbig"><?php echo display_price($od_send_cost + $od_send_cost2); ?></td>
|
||||
<td class="td_numbig"><?php echo display_point($od_temp_point); ?></td>
|
||||
<td class="td_numbig td_numincome"><?php echo number_format($amount['receipt']); ?>원</td>
|
||||
<td class="td_numbig td_numcoupon"><?php echo display_price($amount['coupon']); ?></td>
|
||||
<td class="td_numbig td_numcancel"><?php echo number_format($amount['cancel']); ?>원</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="btn_confirm01 btn_confirm">
|
||||
<input type="submit" value="주문 복구" class="btn_submit">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
||||
<?php
|
||||
// 이니시스를 사용하고 있다면
|
||||
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 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 ) {
|
||||
?>
|
||||
<h2 class="h2_frm">이니시스 결제 로그</h2>
|
||||
<div class="local_desc01 local_desc">
|
||||
<p>실결제로 결제된 경우 반드시 이니시스 상점 관리자에서 해당 결제건을 확인 후에 주문을 처리해 주세요.</p>
|
||||
</div>
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption>이니시스 결제 로그</caption>
|
||||
<tbody>
|
||||
<?php foreach( $tmps as $tmp ){
|
||||
if( empty($tmp) ) continue;
|
||||
?>
|
||||
<tr>
|
||||
<th>주문번호</th>
|
||||
<td><?php echo $tmp['oid']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>결제 TID</th>
|
||||
<td><?php echo $tmp['P_TID']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>결제 MID</th>
|
||||
<td><?php echo $tmp['P_MID']; ?><?php echo in_array( strtolower($tmp['P_MID']), array('iniescrow0', 'inipaytest') ) ? ' ( 테스트결제 )' : ''; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>결제 시간</th>
|
||||
<td><?php echo date('Y-m-d H:i:s', strtotime(substr($tmp['P_AUTH_DT'], 0, 14))); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>결제 수단</th>
|
||||
<td><?php echo $tmp['P_TYPE'].' '.$tmp['P_FN_NM']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>결제된 금액</th>
|
||||
<td><?php echo $tmp['P_AMT'] ? number_format($tmp['P_AMT']) : 0; ?></td>
|
||||
</tr>
|
||||
<?php } //end foreach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
} //end if tmps
|
||||
} //end if inicis
|
||||
?>
|
||||
|
||||
<h2 class="h2_frm">주문자/배송지 정보</h2>
|
||||
<?php echo $pg_anchor; ?>
|
||||
|
||||
<div class="compare_wrap">
|
||||
|
||||
<section id="anc_sodr_orderer" class="compare_left">
|
||||
<h3>주문하신 분</h3>
|
||||
|
||||
<div class="tbl_frm01">
|
||||
<table>
|
||||
<caption>주문자/배송지 정보</caption>
|
||||
<colgroup>
|
||||
<col class="grid_4">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><span class="sound_only">주문하신 분 </span>이름</th>
|
||||
<td><?php echo get_text($data['od_name']); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><span class="sound_only">주문하신 분 </span>전화번호</th>
|
||||
<td><?php echo get_text($data['od_tel']); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><span class="sound_only">주문하신 분 </span>핸드폰</th>
|
||||
<td><?php echo get_text($data['od_hp']); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><span class="sound_only">주문하시는 분 </span>주소</th>
|
||||
<td>
|
||||
<span><?php echo $data['od_zip']; ?></span>
|
||||
<span><?php echo get_text($data['od_addr1']); ?></span>
|
||||
<span><?php echo get_text($data['od_addr2']); ?></span>
|
||||
<span><?php echo get_text($data['od_addr3']); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><span class="sound_only">주문하신 분 </span>E-mail</th>
|
||||
<td><?php echo get_text($data['od_email']); ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="anc_sodr_taker" class="compare_right">
|
||||
<h3>받으시는 분</h3>
|
||||
|
||||
<div class="tbl_frm01">
|
||||
<table>
|
||||
<caption>받으시는 분 정보</caption>
|
||||
<colgroup>
|
||||
<col class="grid_4">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><span class="sound_only">받으시는 분 </span>이름</th>
|
||||
<td><?php echo get_text($data['od_b_name']); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><span class="sound_only">받으시는 분 </span>전화번호</th>
|
||||
<td><?php echo get_text($data['od_b_tel']); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><span class="sound_only">받으시는 분 </span>핸드폰</th>
|
||||
<td><?php echo get_text($data['od_b_hp']); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><span class="sound_only">받으시는 분 </span>주소</th>
|
||||
<td>
|
||||
<span><?php echo $data['od_b_zip']; ?></span>
|
||||
<span><?php echo get_text($data['od_b_addr1']); ?></span>
|
||||
<span><?php echo get_text($data['od_b_addr2']); ?></span>
|
||||
<span><?php echo get_text($data['od_b_addr3']); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if ($default['de_hope_date_use']) { ?>
|
||||
<tr>
|
||||
<th scope="row">희망배송일</th>
|
||||
<td><?php echo $data['od_hope_date']; ?> (<?php echo get_yoil($data['od_hope_date']); ?>)</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<th scope="row">전달 메세지</th>
|
||||
<td><?php if ($data['od_memo']) echo get_text($data['od_memo'], 1);else echo "없음";?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script>
|
||||
function form_submit(f)
|
||||
{
|
||||
if (!confirm("현재 미완료 주문을 입금완료 주문건으로 복구하시겠습니까?")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function del_confirm()
|
||||
{
|
||||
if(confirm("주문서를 삭제하시겠습니까?")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,393 @@
|
||||
<?php
|
||||
$sub_menu = '400410';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
|
||||
if($w == 'd')
|
||||
auth_check_menu($auth, $sub_menu, "d");
|
||||
else
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$od_id = isset($_REQUEST['od_id']) ? safe_replace_regex($_REQUEST['od_id'], 'od_id') : '';
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// 주문서 정보
|
||||
//------------------------------------------------------------------------------
|
||||
$sql = " select * from {$g5['g5_shop_order_data_table']} where od_id = '$od_id' ";
|
||||
$od = sql_fetch($sql);
|
||||
if (! (isset($od['od_id']) && $od['od_id'])) {
|
||||
alert("해당 주문번호로 미완료 주문서가 존재하지 않습니다.");
|
||||
}
|
||||
|
||||
if($w == 'd') {
|
||||
$sql = " delete from {$g5['g5_shop_order_data_table']} where od_id = '$od_id' ";
|
||||
sql_query($sql, true);
|
||||
goto_url("./inorderlist.php?$qstr");
|
||||
}
|
||||
|
||||
// 주문정보
|
||||
$data = unserialize(base64_decode($od['dt_data']));
|
||||
|
||||
$sql_common = " from {$g5['g5_shop_cart_table']} where od_id = '{$od['cart_id']}' and ct_status = '쇼핑' ";
|
||||
|
||||
// 주문금액
|
||||
$sql = " select SUM(IF(io_type = 1, io_price, (ct_price + io_price)) * ct_qty) as od_price, COUNT(distinct it_id) as cart_count $sql_common ";
|
||||
$row = sql_fetch($sql);
|
||||
$tot_ct_price = $row['od_price'];
|
||||
$cart_count = $row['cart_count'];
|
||||
$tot_od_price = $tot_ct_price;
|
||||
$i_price = isset($data['od_price']) ? (int) $data['od_price'] : 0;
|
||||
$i_send_cost = isset($data['od_send_cost']) ? (int) $data['od_send_cost'] : 0;
|
||||
$i_send_cost2 = isset($data['od_send_cost2']) ? (int) $data['od_send_cost2'] : 0;
|
||||
$i_send_coupon = isset($data['od_send_coupon']) ? (int) $data['od_send_coupon'] : 0;
|
||||
$i_temp_point = isset($data['od_temp_point']) ? (int) $data['od_temp_point'] : 0;
|
||||
|
||||
// 쿠폰금액
|
||||
$tot_cp_price = 0;
|
||||
if($od['mb_id']) {
|
||||
// 상품쿠폰
|
||||
$tot_it_cp_price = $tot_od_cp_price = 0;
|
||||
$it_cp_cnt = (isset($data['cp_id']) && is_array($data['cp_id'])) ? count($data['cp_id']) : 0;
|
||||
$arr_it_cp_prc = array();
|
||||
for($i=0; $i<$it_cp_cnt; $i++) {
|
||||
$cid = $data['cp_id'][$i];
|
||||
$it_id = $data['it_id'][$i];
|
||||
$sql = " select cp_id, cp_method, cp_target, cp_type, cp_price, cp_trunc, cp_minimum, cp_maximum
|
||||
from {$g5['g5_shop_coupon_table']}
|
||||
where cp_id = '$cid'
|
||||
and mb_id IN ( '{$od['mb_id']}', '전체회원' )
|
||||
and cp_method IN ( 0, 1 ) ";
|
||||
$cp = sql_fetch($sql);
|
||||
if(! (isset($cp['cp_id']) && $cp['cp_id']))
|
||||
continue;
|
||||
|
||||
// 사용한 쿠폰인지
|
||||
if(is_used_coupon($od['mb_id'], $cp['cp_id']))
|
||||
continue;
|
||||
|
||||
// 분류할인인지
|
||||
if($cp['cp_method']) {
|
||||
$sql2 = " select it_id, ca_id, ca_id2, ca_id3
|
||||
from {$g5['g5_shop_item_table']}
|
||||
where it_id = '$it_id' ";
|
||||
$row2 = sql_fetch($sql2);
|
||||
|
||||
if(!$row2['it_id'])
|
||||
continue;
|
||||
|
||||
if($row2['ca_id'] != $cp['cp_target'] && $row2['ca_id2'] != $cp['cp_target'] && $row2['ca_id3'] != $cp['cp_target'])
|
||||
continue;
|
||||
} else {
|
||||
if($cp['cp_target'] != $it_id)
|
||||
continue;
|
||||
}
|
||||
|
||||
// 상품금액
|
||||
$sql = " select SUM( IF(io_type = '1', io_price * ct_qty, (ct_price + io_price) * ct_qty)) as sum_price $sql_common and it_id = '$it_id' ";
|
||||
$ct = sql_fetch($sql);
|
||||
$item_price = $ct['sum_price'];
|
||||
|
||||
if($cp['cp_minimum'] > $item_price)
|
||||
continue;
|
||||
|
||||
$dc = 0;
|
||||
if($cp['cp_type']) {
|
||||
$dc = floor(($item_price * ($cp['cp_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'], 0, 1, 0, 0);
|
||||
$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 '<meta http-equiv="content-type" content="text/html; charset=utf-8">'.PHP_EOL;
|
||||
echo '<script>'.PHP_EOL;
|
||||
echo 'if(confirm("복구하신 주문 상세페이지로 이동하시겠습니까?"))'.PHP_EOL;
|
||||
echo 'document.location.href = "./orderform.php?od_id='.$od_id.'";'.PHP_EOL;
|
||||
echo 'else'.PHP_EOL;
|
||||
echo 'document.location.href = "./inorderlist.php?'.str_replace('&', '&', $qstr).'";'.PHP_EOL;
|
||||
echo '</script>'.PHP_EOL;
|
||||
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
$sub_menu = '400410';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$sql_common = " from {$g5['g5_shop_order_data_table']} ";
|
||||
|
||||
$sql_search = " where cart_id <> '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;
|
||||
?>
|
||||
|
||||
<div class="local_ov01 local_ov">
|
||||
<span class="btn_ov01"><span class="ov_txt">전체 </span><span class="ov_num"> <?php echo number_format($total_count) ?> 건 </span></span>
|
||||
</div>
|
||||
|
||||
<form name="fsearch" id="fsearch" class="local_sch01 local_sch" method="get">
|
||||
<select name="sfl" title="검색대상">
|
||||
<option value="od_id"<?php echo get_selected($sfl, "od_id"); ?>>주문번호</option>
|
||||
</select>
|
||||
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
|
||||
<input type="text" name="stx" value="<?php echo $stx ?>" id="stx" required class="required frm_input">
|
||||
<input type="submit" class="btn_submit" value="검색">
|
||||
</form>
|
||||
|
||||
<form name="finorderlist" id="finorderlist" method="post" action="./inorderlistdelete.php" onsubmit="return finorderlist_submit(this);">
|
||||
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
|
||||
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
|
||||
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
|
||||
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
<input type="hidden" name="token" value="">
|
||||
|
||||
<div class="tbl_head01 tbl_wrap" id="inorderlist">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?> 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
<label for="chkall" class="sound_only">미완료주문 전체</label>
|
||||
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
|
||||
</th>
|
||||
<th scope="col"><?php echo subject_sort_link('od_id') ?>주문번호</a></th>
|
||||
<th scope="col">PG</th>
|
||||
<th scope="col">주문자</th>
|
||||
<th scope="col">주문자전화</th>
|
||||
<th scope="col">받는분</th>
|
||||
<th scope="col">주문금액</th>
|
||||
<th scope="col">결제방법</th>
|
||||
<th scope="col">주문일시</th>
|
||||
<th scope="col">관리</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
$data = unserialize(base64_decode($row['dt_data']));
|
||||
|
||||
switch($row['dt_pg']) {
|
||||
case 'inicis':
|
||||
$pg = 'KG이니시스';
|
||||
break;
|
||||
case 'lg':
|
||||
$pg = 'LGU+';
|
||||
break;
|
||||
default:
|
||||
$pg = 'KCP';
|
||||
break;
|
||||
}
|
||||
|
||||
// 주문금액
|
||||
$sql = " select sum(if(io_type = '1', io_price, (ct_price + io_price)) * ct_qty) as price from {$g5['g5_shop_cart_table']} where od_id = '{$row['cart_id']}' and ct_status = '쇼핑' ";
|
||||
$ct = sql_fetch($sql);
|
||||
|
||||
$bg = 'bg'.($i%2);
|
||||
?>
|
||||
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td class="td_chk">
|
||||
<input type="hidden" id="od_id_<?php echo $i; ?>" name="od_id[<?php echo $i; ?>]" value="<?php echo $row['od_id']; ?>">
|
||||
<input type="checkbox" id="chk_<?php echo $i; ?>" name="chk[]" value="<?php echo $i; ?>" title="내역선택">
|
||||
</td>
|
||||
<td class="td_odrnum2"><?php echo $row['od_id']; ?></td>
|
||||
<td class="td_center"><?php echo $pg; ?></td>
|
||||
<td class="td_name"><?php echo get_text($data['od_name']); ?></td>
|
||||
<td class="td_center"><?php echo get_text($data['od_tel']); ?></td>
|
||||
<td class="td_name"><?php echo get_text($data['od_b_name']); ?></td>
|
||||
<td class="td_price"><?php echo number_format($ct['price']); ?></td>
|
||||
<td class="td_center"><?php echo $data['od_settle_case']; ?></td>
|
||||
<td class="td_time"><?php echo $row['dt_time']; ?></td>
|
||||
<td class="td_mng td_mng_m">
|
||||
<a href="./inorderform.php?od_id=<?php echo $row['od_id']; ?>&<?php echo $qstr; ?>" class="btn btn_03"><span class="sound_only"><?php echo $row['od_id']; ?> </span>보기</a>
|
||||
<a href="./inorderformupdate.php?w=d&od_id=<?php echo $row['od_id']; ?>&<?php echo $qstr; ?>" onclick="return delete_confirm(this);" class="btn btn_02"><span class="sound_only"><?php echo $row['od_id']; ?> </span>삭제</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($i == 0)
|
||||
echo '<tr><td colspan="'.$colspan.'" class="empty_table">자료가 없습니다.</td></tr>';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value" class="btn btn_02">
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<?php echo get_paging($config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page="); ?>
|
||||
|
||||
<script>
|
||||
function finorderlist_submit(f)
|
||||
{
|
||||
if (!is_checked("chk[]")) {
|
||||
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(document.pressed == "선택삭제") {
|
||||
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
$sub_menu = '400410';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
|
||||
auth_check_menu($auth, $sub_menu, 'd');
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$count = (isset($_POST['chk']) && is_array($_POST['chk'])) ? count($_POST['chk']) : 0;
|
||||
if(!$count)
|
||||
alert('선택삭제 하실 항목을 하나이상 선택해 주세요.');
|
||||
|
||||
for ($i=0; $i<$count; $i++)
|
||||
{
|
||||
// 실제 번호를 넘김
|
||||
$k = isset($_POST['chk'][$i]) ? (int) $_POST['chk'][$i] : 0;
|
||||
$od_id = isset($_POST['od_id'][$k]) ? safe_replace_regex($_POST['od_id'][$k], 'od_id') : '';
|
||||
$sql = " delete from {$g5['g5_shop_order_data_table']} where od_id = '{$od_id}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
goto_url('./inorderlist.php');
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
$sub_menu = '400300';
|
||||
include_once('./_common.php');
|
||||
|
||||
$ca_id = isset($_REQUEST['ca_id']) ? preg_replace('/[^0-9a-z]/i', '', $_REQUEST['ca_id']) : '';
|
||||
$it_id = isset($_REQUEST['it_id']) ? safe_replace_regex($_REQUEST['it_id'], 'it_id') : '';
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$g5['title'] = '상품 복사';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
?>
|
||||
|
||||
<div class="new_win">
|
||||
<h1>상품 복사</h1>
|
||||
<form name="fitemcopy">
|
||||
|
||||
<div id="sit_copy">
|
||||
<label for="new_it_id">상품코드</label>
|
||||
<input type="text" name="new_it_id" value="<?php echo time(); ?>" id="new_it_id" class="frm_input" maxlength="20">
|
||||
</div>
|
||||
|
||||
<div class="win_btn btn_confirm">
|
||||
<input type="button" value="복사하기" class="btn_submit" onclick="_copy('itemcopyupdate.php?it_id=<?php echo $it_id; ?>&ca_id=<?php echo $ca_id; ?>');">
|
||||
<button type="button" onclick="self.close();">창닫기</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script src="<?php echo G5_ADMIN_URL ?>/admin.js"></script>
|
||||
|
||||
<script>
|
||||
// <![CDATA[
|
||||
var g5_admin_csrf_token_key = "<?php echo (function_exists('admin_csrf_token_key')) ? admin_csrf_token_key() : ''; ?>";
|
||||
|
||||
function _copy(link)
|
||||
{
|
||||
var new_it_id = document.getElementById('new_it_id').value;
|
||||
var t_it_id = new_it_id.replace(/[A-Za-z0-9\-_]/g, "");
|
||||
if(t_it_id.length > 0) {
|
||||
alert("상품코드는 영문자, 숫자, -, _ 만 사용할 수 있습니다.");
|
||||
return false;
|
||||
}
|
||||
var token = get_ajax_token();
|
||||
if(!token) {
|
||||
alert("토큰 정보가 올바르지 않습니다.");
|
||||
return false;
|
||||
}
|
||||
opener.parent.location.href = encodeURI(link+'&new_it_id='+new_it_id+"&token="+token);
|
||||
self.close();
|
||||
}
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
@@ -0,0 +1,207 @@
|
||||
<?php
|
||||
$sub_menu = '400300';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$ca_id = isset($_REQUEST['ca_id']) ? preg_replace('/[^0-9a-z]/i', '', $_REQUEST['ca_id']) : '';
|
||||
$it_id = isset($_REQUEST['it_id']) ? safe_replace_regex($_REQUEST['it_id'], 'it_id') : '';
|
||||
|
||||
if ($is_admin != "super")
|
||||
alert("최고관리자만 접근 가능합니다.");
|
||||
|
||||
if (!trim($it_id))
|
||||
alert("복사할 상품코드가 없습니다.");
|
||||
|
||||
if(isset($_POST['new_it_id']) && preg_match('/[^A-Za-z0-9\-_]+/', $_POST['new_it_id']))
|
||||
alert("상품코드는 영문자, 숫자, -, _ 만 사용할 수 있습니다.");
|
||||
|
||||
$new_it_id = isset($_REQUEST['new_it_id']) ? preg_replace("/[^A-Za-z0-9\-_]/", "", $_REQUEST['new_it_id']) : '';
|
||||
|
||||
if( ! $new_it_id ) alert('상품코드를 입력해 주세요.');
|
||||
|
||||
$row = sql_fetch(" select count(*) as cnt from {$g5['g5_shop_item_table']} where it_id = '$new_it_id' ");
|
||||
if (isset($row['cnt']) && $row['cnt'])
|
||||
alert('이미 존재하는 상품코드 입니다.');
|
||||
|
||||
$sql = " select * from {$g5['g5_shop_item_table']} where it_id = '$it_id' limit 1 ";
|
||||
$cp = sql_fetch($sql);
|
||||
|
||||
// 상품테이블의 필드가 추가되어도 수정하지 않도록 필드명을 추출하여 insert 퀴리를 생성한다. (상품코드만 새로운것으로 대체)
|
||||
$sql_common = "";
|
||||
$fields = sql_field_names($g5['g5_shop_item_table']);
|
||||
foreach($fields as $fld) {
|
||||
if ($fld == 'it_id' || $fld == 'it_sum_qty' || $fld == 'it_use_cnt' || $fld == 'it_use_avg')
|
||||
continue;
|
||||
|
||||
$sql_common .= " , $fld = '".addslashes($cp[$fld])."' ";
|
||||
}
|
||||
|
||||
$sql = " insert {$g5['g5_shop_item_table']}
|
||||
set it_id = '$new_it_id'
|
||||
$sql_common ";
|
||||
sql_query($sql);
|
||||
|
||||
// 선택/추가 옵션 copy
|
||||
$opt_sql = " insert ignore into {$g5['g5_shop_item_option_table']} ( io_id, io_type, it_id, io_price, io_stock_qty, io_noti_qty, io_use )
|
||||
select io_id, io_type, '$new_it_id', io_price, io_stock_qty, io_noti_qty, io_use
|
||||
from {$g5['g5_shop_item_option_table']}
|
||||
where it_id = '$it_id'
|
||||
order by io_no asc ";
|
||||
sql_query($opt_sql);
|
||||
|
||||
// html 에디터로 첨부된 이미지 파일 복사
|
||||
$copied_editor_images = array();
|
||||
if($cp['it_explan']) {
|
||||
$matchs = get_editor_image($cp['it_explan'], false);
|
||||
$count_matchs = (isset($matchs[1]) && is_array($matchs[1])) ? count($matchs[1]) : 0;
|
||||
|
||||
// 파일의 경로를 얻어 복사
|
||||
for($i=0;$i<$count_matchs;$i++) {
|
||||
$p = parse_url($matchs[1][$i]);
|
||||
if(strpos($p['path'], "/data/") != 0)
|
||||
$src_path = preg_replace("/^\/.*\/data/", "/data", $p['path']);
|
||||
else
|
||||
$src_path = $p['path'];
|
||||
|
||||
$srcfile = G5_PATH.$src_path;
|
||||
$dstfile = preg_replace("/\.([^\.]+)$/", "_".$new_it_id.".\\1", $srcfile);
|
||||
|
||||
if(is_file($srcfile)) {
|
||||
copy($srcfile, $dstfile);
|
||||
|
||||
$newfile = preg_replace("/\.([^\.]+)$/", "_".$new_it_id.".\\1", $matchs[1][$i]);
|
||||
$cp['it_explan'] = str_replace($matchs[1][$i], $newfile, $cp['it_explan']);
|
||||
|
||||
$copied_editor_images[] = array(
|
||||
'original' => $srcfile,
|
||||
'new' => $dstfile
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$sql = " update {$g5['g5_shop_item_table']} set it_explan = '".addslashes($cp['it_explan'])."' where it_id = '$new_it_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
if($cp['it_mobile_explan']) {
|
||||
$matchs = get_editor_image($cp['it_mobile_explan'], false);
|
||||
$count_matchs = (isset($matchs[1]) && is_array($matchs[1])) ? count($matchs[1]) : 0;
|
||||
|
||||
// 파일의 경로를 얻어 복사
|
||||
for($i=0;$i<$count_matchs;$i++) {
|
||||
$p = parse_url($matchs[1][$i]);
|
||||
if(strpos($p['path'], "/data/") != 0)
|
||||
$src_path = preg_replace("/^\/.*\/data/", "/data", $p['path']);
|
||||
else
|
||||
$src_path = $p['path'];
|
||||
|
||||
$srcfile = G5_PATH.$src_path;
|
||||
$dstfile = preg_replace("/\.([^\.]+)$/", "_".$new_it_id.".\\1", $srcfile);
|
||||
|
||||
if(is_file($srcfile)) {
|
||||
copy($srcfile, $dstfile);
|
||||
|
||||
$newfile = preg_replace("/\.([^\.]+)$/", "_".$new_it_id.".\\1", $matchs[1][$i]);
|
||||
$cp['it_mobile_explan'] = str_replace($matchs[1][$i], $newfile, $cp['it_mobile_explan']);
|
||||
|
||||
$copied_editor_images[] = array(
|
||||
'original' => $srcfile,
|
||||
'new' => $dstfile
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$sql = " update {$g5['g5_shop_item_table']} set it_mobile_explan = '".addslashes($cp['it_mobile_explan'])."' where it_id = '$new_it_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
// 상품이미지 복사
|
||||
function copy_directory($src_dir, $dest_dir)
|
||||
{
|
||||
if($src_dir == $dest_dir)
|
||||
return false;
|
||||
|
||||
if(!is_dir($src_dir))
|
||||
return false;
|
||||
|
||||
if(!is_dir($dest_dir)) {
|
||||
@mkdir($dest_dir, G5_DIR_PERMISSION);
|
||||
@chmod($dest_dir, G5_DIR_PERMISSION);
|
||||
}
|
||||
|
||||
$dir = opendir($src_dir);
|
||||
while (false !== ($filename = readdir($dir))) {
|
||||
if($filename == "." || $filename == "..")
|
||||
continue;
|
||||
|
||||
$files[] = $filename;
|
||||
}
|
||||
|
||||
for($i=0; $i<count($files); $i++) {
|
||||
$src_file = $src_dir.'/'.$files[$i];
|
||||
$dest_file = $dest_dir.'/'.$files[$i];
|
||||
if(is_file($src_file)) {
|
||||
copy($src_file, $dest_file);
|
||||
@chmod($dest_file, G5_FILE_PERMISSION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 파일복사
|
||||
$copied_item_files = array();
|
||||
$dest_path = G5_DATA_PATH.'/item/'.$new_it_id;
|
||||
@mkdir($dest_path, G5_DIR_PERMISSION);
|
||||
@chmod($dest_path, G5_DIR_PERMISSION);
|
||||
$comma = '';
|
||||
$sql_img = '';
|
||||
|
||||
for($i=1; $i<=10; $i++) {
|
||||
$file = G5_DATA_PATH.'/item/'.$cp['it_img'.$i];
|
||||
$new_img = '';
|
||||
|
||||
if(is_file($file)) {
|
||||
$dstfile = $dest_path.'/'.basename($file);
|
||||
copy($file, $dstfile);
|
||||
@chmod($dstfile, G5_FILE_PERMISSION);
|
||||
$new_img = $new_it_id.'/'.basename($file);
|
||||
|
||||
$copied_item_files[] = array(
|
||||
'original' => $file,
|
||||
'new' => $dstfile,
|
||||
);
|
||||
}
|
||||
|
||||
$sql_img .= $comma." it_img{$i} = '$new_img' ";
|
||||
$comma = ',';
|
||||
}
|
||||
|
||||
$sql = " update {$g5['g5_shop_item_table']}
|
||||
set $sql_img
|
||||
where it_id = '$new_it_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
if( function_exists('shop_seo_title_update') ) shop_seo_title_update($new_it_id, true);
|
||||
|
||||
/**
|
||||
* 아이템 복사 처리 후 Event Hook
|
||||
* @var string $it_id 원본 아이템 ID
|
||||
* @var string $new_it_id 복사한 새로운 아이템 ID
|
||||
* @var array $cp 복사한 아이템 정보
|
||||
* @var array $copied_item_files 복사한 파일 목록
|
||||
* @var array $copied_editor_images 복사한 에디터 이미지 목록
|
||||
*/
|
||||
run_event('shop_admin_itemcopy', array(
|
||||
'it_id' => (string) $it_id,
|
||||
'new_it_id' => (string) $new_it_id,
|
||||
'cp' => $cp,
|
||||
'copied_item_files' => $copied_item_files,
|
||||
'copied_editor_images' => $copied_editor_images
|
||||
));
|
||||
|
||||
$qstr = "ca_id=$ca_id&sfl=$sfl&sca=$sca&page=$page&stx=".urlencode($stx);
|
||||
|
||||
goto_url("itemlist.php?$qstr");
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
// itemlistdelete.php 에서 include 하는 파일
|
||||
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
if (!defined('_ITEM_DELETE_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
if (!function_exists("itemdelete")) {
|
||||
|
||||
// 상품삭제
|
||||
// 메세지출력후 주문개별내역페이지로 이동
|
||||
function itemdelete($it_id)
|
||||
{
|
||||
global $g5, $is_admin;
|
||||
|
||||
$sql = " select it_explan, it_mobile_explan, it_img1, it_img2, it_img3, it_img4, it_img5, it_img6, it_img7, it_img8, it_img9, it_img10
|
||||
from {$g5['g5_shop_item_table']} where it_id = '$it_id' ";
|
||||
$it = sql_fetch($sql);
|
||||
|
||||
// 상품 이미지 삭제
|
||||
$dir_list = array();
|
||||
for($i=1; $i<=10; $i++) {
|
||||
$file = G5_DATA_PATH.'/item/'.clean_relative_paths($it['it_img'.$i]);
|
||||
if(is_file($file) && $it['it_img'.$i]) {
|
||||
@unlink($file);
|
||||
$dir = dirname($file);
|
||||
delete_item_thumbnail($dir, basename($file));
|
||||
|
||||
if(!in_array($dir, $dir_list))
|
||||
$dir_list[] = $dir;
|
||||
}
|
||||
}
|
||||
|
||||
// 이미지디렉토리 삭제
|
||||
for($i=0; $i<count($dir_list); $i++) {
|
||||
if(is_dir($dir_list[$i]))
|
||||
rmdir($dir_list[$i]);
|
||||
}
|
||||
|
||||
// 상, 하단 이미지 삭제
|
||||
@unlink(G5_DATA_PATH."/item/$it_id"."_h");
|
||||
@unlink(G5_DATA_PATH."/item/$it_id"."_t");
|
||||
|
||||
// 장바구니 삭제
|
||||
$sql = " delete from {$g5['g5_shop_cart_table']} where it_id = '$it_id' and ct_status = '쇼핑' ";
|
||||
sql_query($sql);
|
||||
|
||||
// 이벤트삭제
|
||||
$sql = " delete from {$g5['g5_shop_event_item_table']} where it_id = '$it_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
// 사용후기삭제
|
||||
$sql = " delete from {$g5['g5_shop_item_use_table']} where it_id = '$it_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
// 상품문의삭제
|
||||
$sql = " delete from {$g5['g5_shop_item_qa_table']} where it_id = '$it_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
// 관련상품삭제
|
||||
$sql = " delete from {$g5['g5_shop_item_relation_table']} where it_id = '$it_id' or it_id2 = '$it_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
// 옵션삭제
|
||||
sql_query(" delete from {$g5['g5_shop_item_option_table']} where it_id = '$it_id' ");
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// HTML 내용에서 에디터에 올라간 이미지의 경로를 얻어 삭제함
|
||||
//------------------------------------------------------------------------
|
||||
$imgs = get_editor_image($it['it_explan'], false);
|
||||
$count_imgs = (isset($imgs[1]) && is_array($imgs[1])) ? count($imgs[1]) : 0;
|
||||
|
||||
for($i=0;$i<$count_imgs;$i++) {
|
||||
$p = parse_url($imgs[1][$i]);
|
||||
if(strpos($p['path'], "/data/editor/") === false)
|
||||
continue;
|
||||
if(strpos($p['path'], "/data/") != 0)
|
||||
$data_path = preg_replace("/^\/.*\/data/", "/data", $p['path']);
|
||||
else
|
||||
$data_path = $p['path'];
|
||||
|
||||
$destfile = G5_PATH.clean_relative_paths($data_path);
|
||||
|
||||
if(is_file($destfile) && preg_match('/(\.(gif|jpe?g|png))$/i', $destfile))
|
||||
@unlink($destfile);
|
||||
}
|
||||
|
||||
$imgs = get_editor_image($it['it_mobile_explan'], false);
|
||||
$count_imgs = (isset($imgs[1]) && is_array($imgs[1])) ? count($imgs[1]) : 0;
|
||||
|
||||
for($i=0;$i<$count_imgs;$i++) {
|
||||
$p = parse_url($imgs[1][$i]);
|
||||
if(strpos($p['path'], "/data/editor/") === false)
|
||||
continue;
|
||||
if(strpos($p['path'], "/data/") != 0)
|
||||
$data_path = preg_replace("/^\/.*\/data/", "/data", $p['path']);
|
||||
else
|
||||
$data_path = $p['path'];
|
||||
|
||||
$destfile = G5_PATH.clean_relative_paths($data_path);
|
||||
|
||||
if(is_file($destfile) && preg_match('/(\.(gif|jpe?g|png))$/i', $destfile))
|
||||
@unlink($destfile);
|
||||
}
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
|
||||
// 상품 삭제
|
||||
$sql = " delete from {$g5['g5_shop_item_table']} where it_id = '$it_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
run_event('shop_admin_delete_item_file', $it_id);
|
||||
|
||||
itemdelete($it_id);
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
$sub_menu = '500300';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$g5['title'] = '이벤트관리';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
$sql_common = " from {$g5['g5_shop_event_table']} ";
|
||||
|
||||
// 테이블의 전체 레코드수만 얻음
|
||||
$sql = " select count(*) as cnt " . $sql_common;
|
||||
$row = sql_fetch($sql);
|
||||
$total_count = $row['cnt'];
|
||||
|
||||
$sql = "select * $sql_common order by ev_id desc ";
|
||||
$result = sql_query($sql);
|
||||
?>
|
||||
|
||||
<div class="local_ov01 local_ov">
|
||||
<span class="btn_ov01"><span class="ov_txt">전체 이벤트</span><span class="ov_num"> <?php echo $total_count; ?>건</span></span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<a href="./itemeventform.php" class="btn btn_01">이벤트 추가</a>
|
||||
</div>
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?> 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">이벤트번호</th>
|
||||
<th scope="col">제목</th>
|
||||
<th scope="col">연결상품</th>
|
||||
<th scope="col">사용</th>
|
||||
<th scope="col">관리</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
|
||||
$href = '';
|
||||
$href_close = '';
|
||||
$sql = " select count(ev_id) as cnt from {$g5['g5_shop_event_item_table']} where ev_id = '{$row['ev_id']}' ";
|
||||
$ev = sql_fetch($sql);
|
||||
if ($ev['cnt']) {
|
||||
$href = '<a href="javascript:;" onclick="itemeventwin('.$row['ev_id'].');">';
|
||||
$href_close = '</a>';
|
||||
}
|
||||
if ($row['ev_subject_strong']) $subject = '<strong>'.$row['ev_subject'].'</strong>';
|
||||
else $subject = $row['ev_subject'];
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td class="td_num"><?php echo $row['ev_id']; ?></td>
|
||||
<td class="td_left"><?php echo $subject; ?></td>
|
||||
<td class="td_num"><?php echo $href; ?><?php echo $ev['cnt']; ?><?php echo $href_close; ?></td>
|
||||
<td class="td_boolean"><?php echo $row['ev_use'] ? '<span class="txt_true">예</span>' : '<span class="txt_false">아니오</span>'; ?></td>
|
||||
<td class="td_mng td_mng_l">
|
||||
<a href="./itemeventform.php?w=u&ev_id=<?php echo $row['ev_id']; ?>" class="btn btn_03">수정</a>
|
||||
<a href="<?php echo G5_SHOP_URL; ?>/event.php?ev_id=<?php echo $row['ev_id']; ?>" class="btn btn_02">보기</a>
|
||||
<a href="./itemeventformupdate.php?w=d&ev_id=<?php echo $row['ev_id']; ?>" onclick="return delete_confirm(this);" class="btn btn_02">삭제</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($i == 0) {
|
||||
echo '<tr><td colspan="5" class="empty_table">자료가 없습니다.</td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function itemeventwin(ev_id)
|
||||
{
|
||||
window.open("./itemeventwin.php?ev_id="+ev_id, "itemeventwin", "left=10,top=10,width=500,height=600,scrollbars=1");
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,456 @@
|
||||
<?php
|
||||
$sub_menu = '500300';
|
||||
include_once('./_common.php');
|
||||
include_once(G5_EDITOR_LIB);
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
$ev_id = isset($_REQUEST['ev_id']) ? preg_replace('/[^0-9]/', '', $_REQUEST['ev_id']) : '';
|
||||
$ev = array(
|
||||
'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 .= "<option value=\"{$row['ca_id']}\">$nbsp{$row['ca_name']}</option>\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');
|
||||
?>
|
||||
|
||||
<form name="feventform" action="./itemeventformupdate.php" onsubmit="return feventform_check(this);" method="post" enctype="MULTIPART/FORM-DATA">
|
||||
<input type="hidden" name="w" value="<?php echo $w; ?>">
|
||||
<input type="hidden" name="ev_id" value="<?php echo $ev_id; ?>">
|
||||
<input type="hidden" name="ev_item" value="">
|
||||
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?></caption>
|
||||
<colgroup>
|
||||
<col class="grid_4">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<?php if ($w == "u") { ?>
|
||||
<tr>
|
||||
<th>이벤트번호</th>
|
||||
<td>
|
||||
<span class="frm_ev_id"><?php echo $ev_id; ?></span>
|
||||
<a href="<?php echo G5_SHOP_URL; ?>/event.php?ev_id=<?php echo $ev['ev_id']; ?>" class="btn_frmline">이벤트바로가기</a>
|
||||
<button type="button" class="btn_frmline shop_event">테마설정 가져오기</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<th scope="row"><label for="ev_skin">출력스킨</label></th>
|
||||
<td>
|
||||
<?php echo help('기본으로 제공하는 스킨은 '.str_replace(G5_PATH.'/', '', G5_SHOP_SKIN_PATH).'/list.*.skin.php 입니다.'.PHP_EOL.G5_SHOP_DIR.'/event.php?ev_id=1234567890&skin=userskin.php 처럼 직접 만든 스킨을 사용할 수도 있습니다.'); ?>
|
||||
<select name="ev_skin" id="ev_skin">
|
||||
<?php echo get_list_skin_options("^list.[0-9]+\.skin\.php", G5_SHOP_SKIN_PATH, $ev['ev_skin']); ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ev_mobile_skin">모바일 출력스킨</label></th>
|
||||
<td>
|
||||
<?php echo help('기본으로 제공하는 스킨은 '.str_replace(G5_PATH.'/', '', G5_MSHOP_SKIN_PATH).'/list.*.skin.php 입니다.'.PHP_EOL.G5_SHOP_DIR.'/event.php?ev_id=1234567890&skin=userskin.php 처럼 직접 만든 스킨을 사용할 수도 있습니다.'); ?>
|
||||
<select name="ev_mobile_skin" id="ev_mobile_skin">
|
||||
<?php echo get_list_skin_options("^list.[0-9]+\.skin\.php", G5_MSHOP_SKIN_PATH, $ev['ev_mobile_skin']); ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ev_img_width">출력이미지 폭</label></th>
|
||||
<td>
|
||||
<input type="text" name="ev_img_width" value="<?php echo $ev['ev_img_width']; ?>" id="ev_img_width" required class="required frm_input" size="5"> 픽셀
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ev_img_height">출력이미지 높이</label></th>
|
||||
<td>
|
||||
<input type="text" name="ev_img_height" value="<?php echo $ev['ev_img_height']; ?>" id="ev_img_height" required class="required frm_input" size="5"> 픽셀
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ev_list_mod">1줄당 이미지 수</label></th>
|
||||
<td>
|
||||
<?php echo help("1행에 설정한 값만큼의 상품을 출력합니다. 스킨 설정에 따라 1행에 하나의 상품만 출력할 수도 있습니다."); ?>
|
||||
<input type="text" name="ev_list_mod" value="<?php echo $ev['ev_list_mod']; ?>" id="ev_list_mod" required class="required frm_input" size="3"> 개
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ev_list_row">이미지 줄 수</label></th>
|
||||
<td>
|
||||
<?php echo help("한 페이지에 출력할 이미지 줄 수를 설정합니다.\n한 페이지에 표시되는 상품수는 (1줄당 이미지 수 x 줄 수) 입니다."); ?>
|
||||
<input type="text" name="ev_list_row" value="<?php echo $ev['ev_list_row']; ?>" id="ev_list_row" required class="required frm_input" size="3"> 줄
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ev_mobile_img_width">모바일 출력이미지 폭</label></th>
|
||||
<td>
|
||||
<input type="text" name="ev_mobile_img_width" value="<?php echo $ev['ev_mobile_img_width']; ?>" id="ev_mobile_img_width" required class="required frm_input" size="5"> 픽셀
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ev_mobile_img_height">모바일 출력이미지 높이</label></th>
|
||||
<td>
|
||||
<input type="text" name="ev_mobile_img_height" value="<?php echo $ev['ev_mobile_img_height']; ?>" id="ev_mobile_img_height" required class="required frm_input" size="5"> 픽셀
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ev_mobile_list_mod">모바일 1줄당 이미지 수</label></th>
|
||||
<td>
|
||||
<?php echo help("1행에 설정한 값만큼의 상품을 출력합니다. 스킨 설정에 따라 1행에 하나의 상품만 출력할 수도 있습니다."); ?>
|
||||
<input type="text" name="ev_mobile_list_mod" value="<?php echo $ev['ev_mobile_list_mod']; ?>" id="ev_mobile_list_mod" required class="required frm_input" size="3"> 개
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ev_mobile_list_row">모바일 이미지 줄 수</label></th>
|
||||
<td>
|
||||
<?php echo help("한 페이지에 출력할 이미지 줄 수를 설정합니다.\n한 페이지에 표시되는 상품수는 (1줄당 이미지 수 x 줄 수) 입니다."); ?>
|
||||
<input type="text" name="ev_mobile_list_row" value="<?php echo $ev['ev_mobile_list_row']; ?>" id="ev_mobile_list_row" required class="required frm_input" size="3"> 개
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ev_use">사용</label></th>
|
||||
<td>
|
||||
<?php echo help("사용하지 않으면 레이아웃의 이벤트 메뉴 및 이벤트 관련 페이지에 접근할 수 없습니다."); ?>
|
||||
<select name="ev_use" id="ev_use">
|
||||
<option value="1" <?php echo get_selected($ev['ev_use'], 1); ?>>사용</option>
|
||||
<option value="0" <?php echo get_selected($ev['ev_use'], 0); ?>>사용안함</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ev_subject">이벤트제목</label></th>
|
||||
<td>
|
||||
<input type="text" name="ev_subject" value="<?php echo htmlspecialchars2($ev['ev_subject']); ?>" id="ev_subject" required class="required frm_input" size="60">
|
||||
<input type="checkbox" name="ev_subject_strong" value="1" id="ev_subject_strong" <?php if($ev['ev_subject_strong']) echo 'checked="checked"'; ?>>
|
||||
<label for="ev_subject_strong">제목 강조</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ev_mimg">배너이미지</label></th>
|
||||
<td>
|
||||
<?php echo help("쇼핑몰 레이아웃에서 글자 대신 이미지로 출력할 경우 사용합니다."); ?>
|
||||
<input type="file" name="ev_mimg" id="ev_mimg">
|
||||
<?php
|
||||
$mimg_str = "";
|
||||
$mimg = G5_DATA_PATH.'/event/'.$ev['ev_id'].'_m';
|
||||
if (file_exists($mimg)) {
|
||||
$size = @getimagesize($mimg);
|
||||
if($size[0] && $size[0] > 750)
|
||||
$width = 750;
|
||||
else
|
||||
$width = $size[0];
|
||||
|
||||
echo '<input type="checkbox" name="ev_mimg_del" value="1" id="ev_mimg_del"> <label for="ev_mimg_del">삭제</label>';
|
||||
$mimg_str = '<img src="'.G5_DATA_URL.'/event/'.$ev['ev_id'].'_m" width="'.$width.'" alt="">';
|
||||
}
|
||||
if ($mimg_str) {
|
||||
echo '<div class="banner_or_img">';
|
||||
echo $mimg_str;
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">관련상품</th>
|
||||
<td id="sev_it_rel" class="compare_wrap srel">
|
||||
|
||||
<section class="compare_left">
|
||||
<h3>상품검색</h3>
|
||||
<span class="srel_pad">
|
||||
<select name="ca_id" id="sch_ca_id">
|
||||
<option value="">분류선택</option>
|
||||
<?php echo $category_select; ?>
|
||||
</select>
|
||||
<label for="sch_name" class="sound_only">상품명</label>
|
||||
<input type="text" name="sch_name" id="sch_name" class="frm_input" size="15">
|
||||
<button type="button" id="btn_search_item" class="btn_frmline">검색</button>
|
||||
</span>
|
||||
<div id="sch_item_list" class="srel_list">
|
||||
<p>상품의 분류를 선택하시거나 상품명을 입력하신 후 검색하여 주십시오.</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="compare_right">
|
||||
<h3>등록된 상품</h3>
|
||||
<span class="srel_pad"></span>
|
||||
<div id="reg_item_list" class="srel_sel">
|
||||
<?php
|
||||
if( $res_item ) {
|
||||
for($i=0; $row=sql_fetch_array($res_item); $i++) {
|
||||
$it_name = get_it_image($row['it_id'], 50, 50).' '.$row['it_name'];
|
||||
|
||||
if($i==0)
|
||||
echo '<ul>';
|
||||
?>
|
||||
<li>
|
||||
<input type="hidden" name="it_id[]" value="<?php echo $row['it_id']; ?>">
|
||||
<div class="list_item"><?php echo $it_name; ?></div>
|
||||
<div class="list_item_btn"><button type="button" class="del_item btn_frmline">삭제</button></div>
|
||||
</li>
|
||||
<?php
|
||||
} // end for
|
||||
} // end if
|
||||
if($i > 0)
|
||||
echo '</ul>';
|
||||
else
|
||||
echo '<p>등록된 상품이 없습니다.</p>';
|
||||
?>
|
||||
</div>
|
||||
</section>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ev_himg">상단이미지</label></th>
|
||||
<td>
|
||||
<?php echo help("이벤트 페이지 상단에 업로드 한 이미지를 출력합니다."); ?>
|
||||
<input type="file" name="ev_himg" id="ev_himg">
|
||||
<?php
|
||||
$himg_str = "";
|
||||
$himg = G5_DATA_PATH.'/event/'.$ev['ev_id'].'_h';
|
||||
if (file_exists($himg)) {
|
||||
$size = @getimagesize($himg);
|
||||
if($size[0] && $size[0] > 750)
|
||||
$width = 750;
|
||||
else
|
||||
$width = $size[0];
|
||||
|
||||
echo '<input type="checkbox" name="ev_himg_del" value="1" id="ev_himg_del"> <label for="ev_himg_del">삭제</label>';
|
||||
$himg_str = '<img src="'.G5_DATA_URL.'/event/'.$ev['ev_id'].'_h" width="'.$width.'" alt="">';
|
||||
}
|
||||
if ($himg_str) {
|
||||
echo '<div class="banner_or_img">';
|
||||
echo $himg_str;
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="ev_timg">하단이미지</label></th>
|
||||
<td>
|
||||
<?php echo help("이벤트 페이지 하단에 업로드 한 이미지를 출력합니다."); ?>
|
||||
<input type="file" name="ev_timg" id="ev_timg">
|
||||
<?php
|
||||
$timg_str = "";
|
||||
$timg = G5_DATA_PATH.'/event/'.$ev['ev_id'].'_t';
|
||||
if (file_exists($timg)) {
|
||||
$size = @getimagesize($timg);
|
||||
if($size[0] && $size[0] > 750)
|
||||
$width = 750;
|
||||
else
|
||||
$width = $size[0];
|
||||
echo '<input type="checkbox" name="ev_timg_del" value="1" id="ev_timg_del"> <label for="ev_timg_del">삭제</label>';
|
||||
$timg_str = '<img src="'.G5_DATA_URL.'/event/'.$ev['ev_id'].'_t" width="'.$width.'" alt="">';
|
||||
}
|
||||
if ($timg_str) {
|
||||
echo '<div class="banner_or_img">';
|
||||
echo $timg_str;
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">상단내용</th>
|
||||
<td>
|
||||
<?php echo editor_html('ev_head_html', get_text(html_purifier($ev['ev_head_html']), 0)); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">하단내용</th>
|
||||
<td>
|
||||
<?php echo editor_html('ev_tail_html', get_text(html_purifier($ev['ev_tail_html']), 0)); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<a href="./itemevent.php" class="btn btn_02">목록</a>
|
||||
<input type="submit" value="확인" class="btn_submit btn" accesskey="s">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$(".shop_event").on("click", function() {
|
||||
if(!confirm("현재 테마의 스킨, 이미지 사이즈 등의 설정을 적용하시겠습니까?"))
|
||||
return false;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "../theme_config_load.php",
|
||||
cache: false,
|
||||
async: false,
|
||||
data: { type: 'shop_event' },
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.error) {
|
||||
alert(data.error);
|
||||
return false;
|
||||
}
|
||||
|
||||
$.each(data, function(key, val) {
|
||||
if(key == "error")
|
||||
return true;
|
||||
|
||||
$("#"+key).val(val);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#btn_search_item").click(function() {
|
||||
var ca_id = $("#sch_ca_id").val();
|
||||
var it_name = $.trim($("#sch_name").val());
|
||||
|
||||
if(ca_id == "" && it_name == "") {
|
||||
$("#sch_item_list").html("<p>상품의 분류를 선택하시거나 상품명을 입력하신 후 검색하여 주십시오.</p>");
|
||||
return false;
|
||||
}
|
||||
|
||||
$("#sch_item_list").load(
|
||||
"./itemeventsearch.php",
|
||||
{ w: "<?php echo $w; ?>", ev_id: "<?php echo $ev_id; ?>", ca_id: ca_id, it_name: it_name }
|
||||
);
|
||||
});
|
||||
|
||||
$(document).on("click", "#sch_item_list .add_item", function() {
|
||||
// 이미 등록된 상품인지 체크
|
||||
var $li = $(this).closest("li");
|
||||
var it_id = $li.find("input:hidden").val();
|
||||
var it_id2;
|
||||
var dup = false;
|
||||
$("#reg_item_list input[name='it_id[]']").each(function() {
|
||||
it_id2 = $(this).val();
|
||||
if(it_id == it_id2) {
|
||||
dup = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if(dup) {
|
||||
alert("이미 등록된 상품입니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
var cont = "<li>"+$li.html().replace("add_item", "del_item").replace("추가", "삭제")+"</li>";
|
||||
var count = $("#reg_item_list li").length;
|
||||
|
||||
if(count > 0) {
|
||||
$("#reg_item_list li:last").after(cont);
|
||||
} else {
|
||||
$("#reg_item_list").html("<ul>"+cont+"</ul>");
|
||||
}
|
||||
|
||||
$li.remove();
|
||||
});
|
||||
|
||||
$(document).on("click", "#reg_item_list .del_item", function() {
|
||||
if(!confirm("상품을 삭제하시겠습니까?"))
|
||||
return false;
|
||||
|
||||
$(this).closest("li").remove();
|
||||
|
||||
var count = $("#reg_item_list li").length;
|
||||
if(count < 1)
|
||||
$("#reg_item_list").html("<p>등록된 상품이 없습니다.</p>");
|
||||
});
|
||||
});
|
||||
function feventform_check(f)
|
||||
{
|
||||
var item = new Array();
|
||||
var ev_item = it_id = "";
|
||||
|
||||
$("#reg_item_list input[name='it_id[]']").each(function() {
|
||||
it_id = $(this).val();
|
||||
if(it_id == "")
|
||||
return true;
|
||||
|
||||
item.push(it_id);
|
||||
});
|
||||
|
||||
if(item.length > 0)
|
||||
ev_item = item.join();
|
||||
|
||||
$("input[name=ev_item]").val(ev_item);
|
||||
|
||||
<?php echo get_editor_js('ev_head_html'); ?>
|
||||
<?php echo get_editor_js('ev_tail_html'); ?>
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* document.feventform.ev_subject.focus(); 포커스해제*/
|
||||
</script>
|
||||
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
$sub_menu = '500300';
|
||||
include_once('./_common.php');
|
||||
|
||||
if ($w == "u" || $w == "d")
|
||||
check_demo();
|
||||
|
||||
if ($w == 'd')
|
||||
auth_check_menu($auth, $sub_menu, "d");
|
||||
else
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
check_admin_token();
|
||||
|
||||
@mkdir(G5_DATA_PATH."/event", G5_DIR_PERMISSION);
|
||||
@chmod(G5_DATA_PATH."/event", G5_DIR_PERMISSION);
|
||||
|
||||
$ev_mimg_del = isset($_POST['ev_mimg_del']) ? (int) $_POST['ev_mimg_del'] : 0;
|
||||
$ev_himg_del = isset($_POST['ev_himg_del']) ? (int) $_POST['ev_himg_del'] : 0;
|
||||
$ev_timg_del = isset($_POST['ev_timg_del']) ? (int) $_POST['ev_timg_del'] : 0;
|
||||
|
||||
$ev_skin = isset($_POST['ev_skin']) ? clean_xss_tags($_POST['ev_skin'], 1, 1) : '';
|
||||
$ev_mobile_skin = isset($_POST['ev_mobile_skin']) ? clean_xss_tags($_POST['ev_mobile_skin'], 1, 1) : '';
|
||||
|
||||
$ev_img_width = isset($_POST['ev_img_width']) ? (int) $_POST['ev_img_width'] : 0;
|
||||
$ev_img_height = isset($_POST['ev_img_height']) ? (int) $_POST['ev_img_height'] : 0;
|
||||
$ev_list_mod = isset($_POST['ev_list_mod']) ? (int) $_POST['ev_list_mod'] : 0;
|
||||
$ev_list_row = isset($_POST['ev_list_row']) ? (int) $_POST['ev_list_row'] : 0;
|
||||
$ev_mobile_img_width = isset($_POST['ev_mobile_img_width']) ? (int) $_POST['ev_mobile_img_width'] : 0;
|
||||
$ev_mobile_img_height = isset($_POST['ev_mobile_img_height']) ? (int) $_POST['ev_mobile_img_height'] : 0;
|
||||
$ev_mobile_list_mod = isset($_POST['ev_mobile_list_mod']) ? (int) $_POST['ev_mobile_list_mod'] : 0;
|
||||
$ev_mobile_list_row = isset($_POST['ev_mobile_list_row']) ? (int) $_POST['ev_mobile_list_row'] : 0;
|
||||
$ev_use = isset($_POST['ev_use']) ? (int) $_POST['ev_use'] : 0;
|
||||
$ev_subject_strong = isset($_POST['ev_subject_strong']) ? (int) $_POST['ev_subject_strong'] : 0;
|
||||
|
||||
$ev_subject = isset($_POST['ev_subject']) ? clean_xss_tags($_POST['ev_subject'], 1, 1) : '';
|
||||
$ev_head_html = isset($_POST['ev_head_html']) ? $_POST['ev_head_html'] : '';
|
||||
$ev_tail_html = isset($_POST['ev_tail_html']) ? $_POST['ev_tail_html'] : '';
|
||||
|
||||
if ($ev_mimg_del) @unlink(G5_DATA_PATH."/event/{$ev_id}_m");
|
||||
if ($ev_himg_del) @unlink(G5_DATA_PATH."/event/{$ev_id}_h");
|
||||
if ($ev_timg_del) @unlink(G5_DATA_PATH."/event/{$ev_id}_t");
|
||||
|
||||
$ev_skin = preg_replace(array('#\.+(\/|\\\)#', '#[\'\"]#'), array('', ''), $ev_skin);
|
||||
$ev_mobile_skin = preg_replace(array('#\.+(\/|\\\)#', '#[\'\"]#'), array('', ''), $ev_mobile_skin);
|
||||
|
||||
$skin_regex_patten = "^list.[0-9]+\.skin\.php";
|
||||
|
||||
$ev_skin = (preg_match("/$skin_regex_patten/", $ev_skin) && file_exists(G5_SHOP_SKIN_PATH.'/'.$ev_skin)) ? $ev_skin : '';
|
||||
$ev_mobile_skin = (preg_match("/$skin_regex_patten/", $ev_mobile_skin) && file_exists(G5_MSHOP_SKIN_PATH.'/'.$ev_mobile_skin)) ? $ev_mobile_skin : '';
|
||||
$ev_subject = strip_tags($ev_subject);
|
||||
|
||||
$sql_common = " set ev_skin = '$ev_skin',
|
||||
ev_mobile_skin = '$ev_mobile_skin',
|
||||
ev_img_width = '$ev_img_width',
|
||||
ev_img_height = '$ev_img_height',
|
||||
ev_list_mod = '$ev_list_mod',
|
||||
ev_list_row = '$ev_list_row',
|
||||
ev_mobile_img_width = '$ev_mobile_img_width',
|
||||
ev_mobile_img_height= '$ev_mobile_img_height',
|
||||
ev_mobile_list_mod = '$ev_mobile_list_mod',
|
||||
ev_mobile_list_row = '$ev_mobile_list_row',
|
||||
ev_subject = '$ev_subject',
|
||||
ev_head_html = '$ev_head_html',
|
||||
ev_tail_html = '$ev_tail_html',
|
||||
ev_use = '$ev_use',
|
||||
ev_subject_strong = '$ev_subject_strong'
|
||||
";
|
||||
|
||||
if ($w == "")
|
||||
{
|
||||
$ev_id = G5_SERVER_TIME;
|
||||
|
||||
$sql = " insert {$g5['g5_shop_event_table']}
|
||||
$sql_common
|
||||
, ev_id = '$ev_id' ";
|
||||
sql_query($sql);
|
||||
run_event('shop_admin_event_created', $ev_id);
|
||||
}
|
||||
else if ($w == "u")
|
||||
{
|
||||
$sql = " update {$g5['g5_shop_event_table']}
|
||||
$sql_common
|
||||
where ev_id = '$ev_id' ";
|
||||
sql_query($sql);
|
||||
run_event('shop_admin_event_updated', $ev_id);
|
||||
}
|
||||
else if ($w == "d")
|
||||
{
|
||||
@unlink(G5_DATA_PATH."/event/{$ev_id}_m");
|
||||
@unlink(G5_DATA_PATH."/event/{$ev_id}_h");
|
||||
@unlink(G5_DATA_PATH."/event/{$ev_id}_t");
|
||||
|
||||
// 이벤트상품삭제
|
||||
$sql = " delete from {$g5['g5_shop_event_item_table']} where ev_id = '$ev_id' ";
|
||||
sql_query($sql);
|
||||
run_event('shop_admin_event_deleted', $ev_id);
|
||||
|
||||
$sql = " delete from {$g5['g5_shop_event_table']} where ev_id = '$ev_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
if ($w == "" || $w == "u")
|
||||
{
|
||||
if ($_FILES['ev_mimg']['name']) upload_file($_FILES['ev_mimg']['tmp_name'], $ev_id."_m", G5_DATA_PATH."/event");
|
||||
if ($_FILES['ev_himg']['name']) upload_file($_FILES['ev_himg']['tmp_name'], $ev_id."_h", G5_DATA_PATH."/event");
|
||||
if ($_FILES['ev_timg']['name']) upload_file($_FILES['ev_timg']['tmp_name'], $ev_id."_t", G5_DATA_PATH."/event");
|
||||
|
||||
// 등록된 이벤트 상품 먼저 삭제
|
||||
$sql = " delete from {$g5['g5_shop_event_item_table']} where ev_id = '$ev_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
// 이벤트 상품등록
|
||||
$item = explode(',', $ev_item);
|
||||
$count = count($item);
|
||||
|
||||
for($i=0; $i<$count; $i++) {
|
||||
$it_id = isset($item[$i]) ? $item[$i] : '';
|
||||
if($it_id) {
|
||||
$sql = " insert into {$g5['g5_shop_event_item_table']}
|
||||
set ev_id = '$ev_id',
|
||||
it_id = '$it_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
goto_url("./itemeventform.php?w=u&ev_id=$ev_id");
|
||||
}
|
||||
else
|
||||
{
|
||||
goto_url("./itemevent.php");
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
$sub_menu = '500310';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$ev_id = isset($_GET['ev_id']) ? preg_replace('/[^0-9]/', '', $_GET['ev_id']) : '';
|
||||
$sort1 = (isset($_GET['sort1']) && in_array($_GET['sort1'], array('a.it_id', 'it_name'))) ? $_GET['sort1'] : 'a.it_id';
|
||||
$sort2 = (isset($_GET['sort2']) && in_array($_GET['sort2'], array('desc', 'asc'))) ? $_GET['sort2'] : 'desc';
|
||||
$sel_field = (isset($_GET['sel_field']) && in_array($_GET['sel_field'], array('a.it_id', 'it_name')) ) ? $_GET['sel_field'] : 'it_name';
|
||||
$sel_ca_id = isset($_GET['sel_ca_id']) ? get_search_string($_GET['sel_ca_id']) : '';
|
||||
$search = isset($_GET['search']) ? get_search_string($_GET['search']) : '';
|
||||
$ev_title = isset($ev_title) ? clean_xss_tags($ev_title, 1, 1) : '';
|
||||
|
||||
$g5['title'] = '이벤트일괄처리';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
$where = " where ";
|
||||
$sql_search = "";
|
||||
if ($search != "") {
|
||||
if ($sel_field != "") {
|
||||
$sql_search .= " $where $sel_field like '%$search%' ";
|
||||
$where = " and ";
|
||||
}
|
||||
}
|
||||
|
||||
if ($sel_ca_id != "") {
|
||||
$sql_search .= " $where ca_id like '$sel_ca_id%' ";
|
||||
}
|
||||
|
||||
$sql_common = " from {$g5['g5_shop_item_table']} a
|
||||
left join {$g5['g5_shop_event_item_table']} b on (a.it_id=b.it_id and b.ev_id='$ev_id') ";
|
||||
$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 (!$sort1) {
|
||||
$sort1 = "b.ev_id";
|
||||
}
|
||||
|
||||
if (!$sort2 || $sort2 != "asc") {
|
||||
$sort2 = "desc";
|
||||
}
|
||||
|
||||
$sql = " select a.*, b.ev_id
|
||||
$sql_common
|
||||
order by $sort1 $sort2
|
||||
limit $from_record, $rows ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
//$qstr1 = 'sel_ca_id='.$sel_ca_id.'&sel_field='.$sel_field.'&search='.$search;
|
||||
$qstr1 = 'ev_id='.$ev_id.'&sel_ca_id='.$sel_ca_id.'&sel_field='.$sel_field.'&search='.$search;
|
||||
$qstr = $qstr1.'&sort1='.$sort1.'&sort2='.$sort2.'&page='.$page;
|
||||
|
||||
$listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';
|
||||
|
||||
// 이벤트제목
|
||||
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'];
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="local_ov01 local_ov">
|
||||
<?php echo $listall; ?>
|
||||
<span class="btn_ov01"><span class="ov_txt">전체 이벤트</span><span class="ov_num"> <?php echo $total_count; ?>건</span></span>
|
||||
</div>
|
||||
|
||||
<form name="flist" class="local_sch01 local_sch" autocomplete="off">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
<label for="ev_id" class="sound_only">이벤트</label>
|
||||
<select name="ev_id" id="ev_id" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>">
|
||||
<?php
|
||||
// 이벤트 옵션처리
|
||||
$event_option = "<option value=''>이벤트를 선택하세요</option>";
|
||||
$sql1 = " select ev_id, ev_subject from {$g5['g5_shop_event_table']} order by ev_id desc ";
|
||||
$result1 = sql_query($sql1);
|
||||
while ($row1=sql_fetch_array($result1))
|
||||
$event_option .= '<option value="'.$row1['ev_id'].'" '.get_selected($ev_id, $row1['ev_id']).' >'.conv_subject($row1['ev_subject'], 20,"…").'</option>';
|
||||
echo $event_option;
|
||||
?>
|
||||
</select>
|
||||
<input type="submit" value="이동" class="btn_submit">
|
||||
|
||||
</form>
|
||||
|
||||
<form name="flist" class="local_sch01 local_sch" autocomplete="off">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
<input type="hidden" name="ev_id" value="<?php echo $ev_id; ?>">
|
||||
|
||||
<label for="sel_ca_id" class="sound_only">분류선택</label>
|
||||
<select name="sel_ca_id" id="sel_ca_id">
|
||||
<option value=''>전체분류</option>
|
||||
<?php
|
||||
$sql1 = " select ca_id, ca_name from {$g5['g5_shop_category_table']} order by ca_order, ca_id ";
|
||||
$result1 = sql_query($sql1);
|
||||
for ($i=0; $row1=sql_fetch_array($result1); $i++)
|
||||
{
|
||||
$len = strlen($row1['ca_id']) / 2 - 1;
|
||||
$nbsp = "";
|
||||
for ($i=0; $i<$len; $i++) $nbsp .= " ";
|
||||
echo '<option value="'.$row1['ca_id'].'" '.get_selected($sel_ca_id, $row1['ca_id']).'>'.$nbsp.$row1['ca_name'].'</option>'.PHP_EOL;
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
<label for="sel_field" class="sound_only">검색대상</label>
|
||||
<select name="sel_field" id="sel_field">
|
||||
<option value="it_name" <?php echo get_selected($sel_field, 'it_name'); ?>>상품명</option>
|
||||
<option value="a.it_id" <?php echo get_selected($sel_field, 'a.it_id'); ?>>상품코드</option>
|
||||
</select>
|
||||
|
||||
<label for="search" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
|
||||
<input type="text" name="search" value="<?php echo $search; ?>" id="search" required class="frm_input required">
|
||||
<input type="submit" value="검색" class="btn_submit">
|
||||
|
||||
</form>
|
||||
|
||||
<div class="local_desc01 local_desc">
|
||||
<p>상품을 이벤트별로 일괄 처리합니다. <?php echo ($ev_title ? '현재 선택된 이벤트는 '.$ev_title.'입니다.' : '이벤트를 선택해 주세요.'); ?></p>
|
||||
</div>
|
||||
|
||||
<form name="fitemeventlistupdate" method="post" action="./itemeventlistupdate.php" onsubmit="return fitemeventlistupdatecheck(this)">
|
||||
<input type="hidden" name="ev_id" value="<?php echo $ev_id; ?>">
|
||||
<input type="hidden" name="sel_ca_id" value="<?php echo $sel_ca_id; ?>">
|
||||
<input type="hidden" name="sel_field" value="<?php echo $sel_field; ?>">
|
||||
<input type="hidden" name="search" value="<?php echo $search; ?>">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
<input type="hidden" name="sort1" value="<?php echo $sort1; ?>">
|
||||
<input type="hidden" name="sort2" value="<?php echo $sort2; ?>">
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?> 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">이벤트</th>
|
||||
<th scope="col"><a href="<?php echo title_sort("a.it_id") . '&'.$qstr1.'&ev_id='.$ev_id; ?>">상품코드</a></th>
|
||||
<th scope="col"><a href="<?php echo title_sort("it_name") . '&&'.$qstr1.'&ev_id='.$ev_id; ?>">상품명</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
$href = shop_item_url($row['it_id']);
|
||||
|
||||
$sql = " select ev_id from {$g5['g5_shop_event_item_table']}
|
||||
where it_id = '{$row['it_id']}'
|
||||
and ev_id = '$ev_id' ";
|
||||
$ev = sql_fetch($sql);
|
||||
|
||||
$bg = 'bg'.($i%2);
|
||||
?>
|
||||
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td class="td_chk2">
|
||||
<input type="hidden" name="it_id[<?php echo $i; ?>]" value="<?php echo $row['it_id']; ?>">
|
||||
<label for="ev_chk_<?php echo $i; ?>" class="sound_only">이벤트 사용</label>
|
||||
<input type="checkbox" name="ev_chk[<?php echo $i; ?>]" value="1" id="ev_chk_<?php echo $i; ?>" <?php echo ($row['ev_id'] ? "checked" : ""); ?>>
|
||||
</td>
|
||||
<td class="td_num"><a href="<?php echo $href; ?>"><?php echo $row['it_id']; ?></a></td>
|
||||
<td class="td_left"><a href="<?php echo $href; ?>"><?php echo get_it_image($row['it_id'], 50, 50); ?> <?php echo cut_str(stripslashes($row['it_name']), 60, "…"); ?></a></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($i == 0)
|
||||
echo '<tr><td colspan="4" class="empty_table">자료가 없습니다.</td></tr>';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="local_desc01 local_desc">
|
||||
<p>
|
||||
<?php if ($ev_title) { ?>
|
||||
현재 선택된 이벤트는 <strong><?php echo $ev_title; ?></strong>입니다.<br>
|
||||
선택된 이벤트의 상품 수정 내용을 반영하시려면 일괄수정 버튼을 누르십시오.
|
||||
<?php } else { ?>
|
||||
이벤트를 선택하지 않으셨습니다. <strong>수정 내용을 반영하기 전에 이벤트를 선택해주십시오.</strong><br>
|
||||
<a href="#ev_id" class="sound_only">이벤트 선택</a>
|
||||
<?php } ?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="btn_fixed_top">
|
||||
<input type="submit" value="일괄수정" class="btn_submit btn" accesskey="s">
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page="); ?>
|
||||
|
||||
<script>
|
||||
function fitemeventlistupdatecheck(f)
|
||||
{
|
||||
if (!f.ev_id.value)
|
||||
{
|
||||
alert('이벤트를 선택하세요');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
$sub_menu = '500310';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
$post_it_id_count = (isset($_POST['it_id']) && is_array($_POST['it_id'])) ? count($_POST['it_id']) : 0;
|
||||
|
||||
for ($i=0; $i<$post_it_id_count; $i++)
|
||||
{
|
||||
$iit_id = isset($_POST['it_id'][$i]) ? preg_replace('/[^a-z0-9_\-]/i', '', $_POST['it_id'][$i]) : '';
|
||||
|
||||
$sql = " delete from {$g5['g5_shop_event_item_table']}
|
||||
where ev_id = '$ev_id'
|
||||
and it_id = '{$iit_id}' ";
|
||||
sql_query($sql);
|
||||
|
||||
if (isset($_POST['ev_chk'][$i]) && $_POST['ev_chk'][$i])
|
||||
{
|
||||
$sql = "insert into {$g5['g5_shop_event_item_table']}
|
||||
set ev_id = '$ev_id',
|
||||
it_id = '{$iit_id}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
goto_url('./itemeventlist.php?ev_id='.$ev_id.'&sort1='.$sort1.'&sort2='.$sort2.'&sel_ca_id='.$sel_ca_id.'&sel_field='.$sel_field.'&search='.$search.'&page='.$page);
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
$sub_menu = '500300';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
$ca_id = trim($ca_id);
|
||||
$it_name = trim(strip_tags($it_name));
|
||||
|
||||
if(!$ca_id && !$it_name)
|
||||
die('<p>상품의 분류를 선택하시거나 상품명을 입력하신 후 검색하여 주십시오.</p>');
|
||||
|
||||
$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 .= '<li>';
|
||||
$list .= '<input type="hidden" name="it_id[]" value="'.$row['it_id'].'">';
|
||||
$list .= '<div class="list_item">'.$it_name.'</div>';
|
||||
$list .= '<div class="list_item_btn"><button type="button" class="add_item btn_frmline">추가</button></div>';
|
||||
$list .= '</li>'.PHP_EOL;
|
||||
}
|
||||
|
||||
if($list)
|
||||
$list = '<ul>'.$list.'</ul>';
|
||||
else
|
||||
$list = '<p>등록된 상품이 없습니다.</p>';
|
||||
|
||||
echo $list;
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
$sub_menu = '500300';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$sql = " select ev_subject from {$g5['g5_shop_event_table']} where ev_id = '$ev_id' ";
|
||||
$ev = sql_fetch($sql);
|
||||
|
||||
$g5['title'] = $ev['ev_subject'].' 이벤트상품';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
?>
|
||||
|
||||
<div class="new_win">
|
||||
<h1><?php echo $g5['title']; ?></h1>
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?> 입력</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">상품명</th>
|
||||
<th scope="col">사용</th>
|
||||
<th scope="col">삭제</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$sql = " select b.it_id, b.it_name, b.it_use 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'
|
||||
order by b.it_id desc ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
$href = shop_item_url($row['it_id']);
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<?php echo $href; ?>" target="_blank">
|
||||
<?php echo get_it_image($row['it_id'], 40, 40); ?>
|
||||
<?php echo cut_str(stripslashes($row['it_name']), 60, "…"); ?>
|
||||
</a>
|
||||
</td>
|
||||
<td class="td_boolean"><?php echo ($row['it_use']?"사용":"미사용"); ?></td>
|
||||
<td class="td_mngsmall"><a href="javascript:del('./itemeventwindel.php?ev_id=<?php echo $ev_id; ?>&it_id=<?php echo $row['it_id']; ?>');">삭제</a></td>
|
||||
<tr>
|
||||
<?php
|
||||
}
|
||||
if ($i == 0)
|
||||
echo '<tr><td colspan="3" class="empty_table">자료가 없습니다.</td></tr>';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_win01 btn_win">
|
||||
<button type="button" onclick="javascript:window.close()">창 닫기</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
$sub_menu = '500300';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "d");
|
||||
|
||||
$ev_id = isset($_REQUEST['ev_id']) ? (int) $_REQUEST['ev_id'] : 0;
|
||||
$it_id = isset($_REQUEST['it_id']) ? safe_replace_regex($_REQUEST['it_id'], 'it_id') : '';
|
||||
|
||||
$sql = " delete from {$g5['g5_shop_event_item_table']} where ev_id = '$ev_id' and it_id = '$it_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
goto_url("./itemeventwin.php?ev_id=$ev_id");
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
$sub_menu = '400300';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
$g5['title'] = '엑셀파일로 상품 일괄 등록';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
?>
|
||||
|
||||
<div class="new_win">
|
||||
<h1><?php echo $g5['title']; ?></h1>
|
||||
|
||||
<div class="local_desc01 local_desc">
|
||||
<p>
|
||||
엑셀파일을 이용하여 상품을 일괄등록할 수 있습니다.<br>
|
||||
형식은 <strong>상품일괄등록용 엑셀파일</strong>을 다운로드하여 상품 정보를 입력하시면 됩니다.<br>
|
||||
수정 완료 후 엑셀파일을 업로드하시면 상품이 일괄등록됩니다.<br>
|
||||
엑셀파일을 저장하실 때는 <strong>Excel 97 - 2003 통합문서 (*.xls)</strong> 로 저장하셔야 합니다.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="<?php echo G5_URL; ?>/<?php echo G5_LIB_DIR; ?>/Excel/itemexcel.xls">상품일괄등록용 엑셀파일 다운로드</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<form name="fitemexcel" method="post" action="./itemexcelupdate.php" enctype="MULTIPART/FORM-DATA" autocomplete="off">
|
||||
|
||||
<div id="excelfile_upload">
|
||||
<label for="excelfile">파일선택</label>
|
||||
<input type="file" name="excelfile" id="excelfile">
|
||||
</div>
|
||||
|
||||
<div class="win_btn btn_confirm">
|
||||
<input type="submit" value="상품 엑셀파일 등록" class="btn_submit btn">
|
||||
<button type="button" onclick="window.close();" class="btn_close btn">닫기</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
@@ -0,0 +1,205 @@
|
||||
<?php
|
||||
$sub_menu = '400300';
|
||||
include_once('./_common.php');
|
||||
|
||||
// 상품이 많을 경우 대비 설정변경
|
||||
set_time_limit ( 0 );
|
||||
ini_set('memory_limit', '50M');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
function only_number($n)
|
||||
{
|
||||
return preg_replace('/[^0-9]/', '', (string)$n);
|
||||
}
|
||||
|
||||
$is_upload_file = (isset($_FILES['excelfile']['tmp_name']) && $_FILES['excelfile']['tmp_name']) ? 1 : 0;
|
||||
|
||||
if( ! $is_upload_file){
|
||||
alert("엑셀 파일을 업로드해 주세요.");
|
||||
}
|
||||
|
||||
if($is_upload_file) {
|
||||
$file = $_FILES['excelfile']['tmp_name'];
|
||||
|
||||
include_once(G5_LIB_PATH.'/PHPExcel/IOFactory.php');
|
||||
|
||||
$objPHPExcel = PHPExcel_IOFactory::load($file);
|
||||
$sheet = $objPHPExcel->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((string)$rowData[0][$j++]);
|
||||
$ca_id3 = addslashes((string)$rowData[0][$j++]);
|
||||
$it_name = addslashes($rowData[0][$j++]);
|
||||
$it_maker = addslashes((string)$rowData[0][$j++]);
|
||||
$it_origin = addslashes((string)$rowData[0][$j++]);
|
||||
$it_brand = addslashes((string)$rowData[0][$j++]);
|
||||
$it_model = addslashes((string)$rowData[0][$j++]);
|
||||
$it_type1 = addslashes((string)$rowData[0][$j++]);
|
||||
$it_type2 = addslashes((string)$rowData[0][$j++]);
|
||||
$it_type3 = addslashes((string)$rowData[0][$j++]);
|
||||
$it_type4 = addslashes((string)$rowData[0][$j++]);
|
||||
$it_type5 = addslashes((string)$rowData[0][$j++]);
|
||||
$it_basic = addslashes((string)$rowData[0][$j++]);
|
||||
$it_explan = addslashes((string)$rowData[0][$j++]);
|
||||
$it_mobile_explan = addslashes((string)$rowData[0][$j++]);
|
||||
$it_cust_price = addslashes(only_number($rowData[0][$j++]));
|
||||
$it_price = addslashes(only_number($rowData[0][$j++]));
|
||||
$it_tel_inq = addslashes((string)$rowData[0][$j++]);
|
||||
$it_point = addslashes(only_number($rowData[0][$j++]));
|
||||
$it_point_type = addslashes(only_number($rowData[0][$j++]));
|
||||
$it_sell_email = addslashes((string)$rowData[0][$j++]);
|
||||
$it_use = addslashes((string)$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((string)$rowData[0][$j++]);
|
||||
$it_img2 = addslashes((string)$rowData[0][$j++]);
|
||||
$it_img3 = addslashes((string)$rowData[0][$j++]);
|
||||
$it_img4 = addslashes((string)$rowData[0][$j++]);
|
||||
$it_img5 = addslashes((string)$rowData[0][$j++]);
|
||||
$it_img6 = addslashes((string)$rowData[0][$j++]);
|
||||
$it_img7 = addslashes((string)$rowData[0][$j++]);
|
||||
$it_img8 = addslashes((string)$rowData[0][$j++]);
|
||||
$it_img9 = addslashes((string)$rowData[0][$j++]);
|
||||
$it_img10 = addslashes((string)$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');
|
||||
?>
|
||||
|
||||
<div class="new_win">
|
||||
<h1><?php echo $g5['title']; ?></h1>
|
||||
|
||||
<div class="local_desc01 local_desc">
|
||||
<p>상품등록을 완료했습니다.</p>
|
||||
</div>
|
||||
|
||||
<dl id="excelfile_result">
|
||||
<dt>총상품수</dt>
|
||||
<dd><?php echo number_format($total_count); ?></dd>
|
||||
<dt>완료건수</dt>
|
||||
<dd><?php echo number_format($succ_count); ?></dd>
|
||||
<dt>실패건수</dt>
|
||||
<dd><?php echo number_format($fail_count); ?></dd>
|
||||
<?php if($fail_count > 0) { ?>
|
||||
<dt>실패상품코드</dt>
|
||||
<dd><?php echo implode(', ', $fail_it_id); ?></dd>
|
||||
<?php } ?>
|
||||
<?php if($dup_count > 0) { ?>
|
||||
<dt>상품코드중복건수</dt>
|
||||
<dd><?php echo number_format($dup_count); ?></dd>
|
||||
<dt>중복상품코드</dt>
|
||||
<dd><?php echo implode(', ', $dup_it_id); ?></dd>
|
||||
<?php } ?>
|
||||
</dl>
|
||||
|
||||
<div class="btn_win01 btn_win">
|
||||
<button type="button" onclick="window.close();">창닫기</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
$sub_menu = '400300';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
$ca_id = trim($ca_id);
|
||||
$it_name = trim(strip_tags($it_name));
|
||||
|
||||
if(!$ca_id && !$it_name)
|
||||
die('<p>상품의 분류를 선택하시거나 상품명을 입력하신 후 검색하여 주십시오.</p>');
|
||||
|
||||
$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 .= '<li class="list_res">';
|
||||
$list .= '<input type="hidden" name="re_it_id[]" value="'.$row['it_id'].'">';
|
||||
$list .= '<div class="list_item">'.$it_name.'</div>';
|
||||
$list .= '<div class="list_item_btn"><button type="button" class="add_item btn_frmline">추가</button></div>';
|
||||
$list .= '</li>'.PHP_EOL;
|
||||
}
|
||||
|
||||
if($list)
|
||||
$list = '<ul>'.$list.'</ul>';
|
||||
else
|
||||
$list = '<p>등록된 상품이 없습니다.';
|
||||
|
||||
echo $list;
|
||||
@@ -0,0 +1,614 @@
|
||||
<?php
|
||||
$sub_menu = '400300';
|
||||
include_once('./_common.php');
|
||||
|
||||
if ($w == "u" || $w == "d")
|
||||
check_demo();
|
||||
|
||||
if ($w == '' || $w == 'u')
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
else if ($w == 'd')
|
||||
auth_check_menu($auth, $sub_menu, "d");
|
||||
|
||||
check_admin_token();
|
||||
|
||||
@mkdir(G5_DATA_PATH."/item", G5_DIR_PERMISSION);
|
||||
@chmod(G5_DATA_PATH."/item", G5_DIR_PERMISSION);
|
||||
|
||||
// input vars 체크
|
||||
check_input_vars();
|
||||
|
||||
$ca_id = isset($_POST['ca_id']) ? preg_replace('/[^0-9a-z]/i', '', $_POST['ca_id']) : '';
|
||||
$ca_id2 = isset($_POST['ca_id2']) ? preg_replace('/[^0-9a-z]/i', '', $_POST['ca_id2']) : '';
|
||||
$ca_id3 = isset($_POST['ca_id3']) ? preg_replace('/[^0-9a-z]/i', '', $_POST['ca_id3']) : '';
|
||||
|
||||
if ($is_admin != 'super') { // 최고관리자가 아니면 체크
|
||||
if( $w === '' ){
|
||||
$sql = "select ca_mb_id from {$g5['g5_shop_category_table']} where ca_id = '$ca_id'";
|
||||
} else {
|
||||
$sql = "select b.ca_mb_id from {$g5['g5_shop_item_table']} a , {$g5['g5_shop_category_table']} b where (a.ca_id = b.ca_id) and a.it_id = '$it_id'";
|
||||
}
|
||||
$checks = sql_fetch($sql);
|
||||
|
||||
if( ! (isset($checks['ca_mb_id']) && $checks['ca_mb_id']) || $checks['ca_mb_id'] !== $member['mb_id'] ){
|
||||
alert("해당 분류의 관리회원이 아닙니다.");
|
||||
}
|
||||
}
|
||||
|
||||
$it_img1 = $it_img2 = $it_img3 = $it_img4 = $it_img5 = $it_img6 = $it_img7 = $it_img8 = $it_img9 = $it_img10 = '';
|
||||
// 파일정보
|
||||
if($w == "u") {
|
||||
$sql = " select it_img1, it_img2, it_img3, it_img4, it_img5, it_img6, it_img7, it_img8, it_img9, it_img10
|
||||
from {$g5['g5_shop_item_table']}
|
||||
where it_id = '$it_id' ";
|
||||
$file = sql_fetch($sql);
|
||||
|
||||
$it_img1 = $file['it_img1'];
|
||||
$it_img2 = $file['it_img2'];
|
||||
$it_img3 = $file['it_img3'];
|
||||
$it_img4 = $file['it_img4'];
|
||||
$it_img5 = $file['it_img5'];
|
||||
$it_img6 = $file['it_img6'];
|
||||
$it_img7 = $file['it_img7'];
|
||||
$it_img8 = $file['it_img8'];
|
||||
$it_img9 = $file['it_img9'];
|
||||
$it_img10 = $file['it_img10'];
|
||||
}
|
||||
|
||||
$it_img_dir = G5_DATA_PATH.'/item';
|
||||
|
||||
for($i=0;$i<=10;$i++){
|
||||
${'it_img'.$i.'_del'} = ! empty($_POST['it_img'.$i.'_del']) ? 1 : 0;
|
||||
}
|
||||
|
||||
// 파일삭제
|
||||
if ($it_img1_del) {
|
||||
$file_img1 = $it_img_dir.'/'.clean_relative_paths($it_img1);
|
||||
@unlink($file_img1);
|
||||
delete_item_thumbnail(dirname($file_img1), basename($file_img1));
|
||||
$it_img1 = '';
|
||||
}
|
||||
if ($it_img2_del) {
|
||||
$file_img2 = $it_img_dir.'/'.clean_relative_paths($it_img2);
|
||||
@unlink($file_img2);
|
||||
delete_item_thumbnail(dirname($file_img2), basename($file_img2));
|
||||
$it_img2 = '';
|
||||
}
|
||||
if ($it_img3_del) {
|
||||
$file_img3 = $it_img_dir.'/'.clean_relative_paths($it_img3);
|
||||
@unlink($file_img3);
|
||||
delete_item_thumbnail(dirname($file_img3), basename($file_img3));
|
||||
$it_img3 = '';
|
||||
}
|
||||
if ($it_img4_del) {
|
||||
$file_img4 = $it_img_dir.'/'.clean_relative_paths($it_img4);
|
||||
@unlink($file_img4);
|
||||
delete_item_thumbnail(dirname($file_img4), basename($file_img4));
|
||||
$it_img4 = '';
|
||||
}
|
||||
if ($it_img5_del) {
|
||||
$file_img5 = $it_img_dir.'/'.clean_relative_paths($it_img5);
|
||||
@unlink($file_img5);
|
||||
delete_item_thumbnail(dirname($file_img5), basename($file_img5));
|
||||
$it_img5 = '';
|
||||
}
|
||||
if ($it_img6_del) {
|
||||
$file_img6 = $it_img_dir.'/'.clean_relative_paths($it_img6);
|
||||
@unlink($file_img6);
|
||||
delete_item_thumbnail(dirname($file_img6), basename($file_img6));
|
||||
$it_img6 = '';
|
||||
}
|
||||
if ($it_img7_del) {
|
||||
$file_img7 = $it_img_dir.'/'.clean_relative_paths($it_img7);
|
||||
@unlink($file_img7);
|
||||
delete_item_thumbnail(dirname($file_img7), basename($file_img7));
|
||||
$it_img7 = '';
|
||||
}
|
||||
if ($it_img8_del) {
|
||||
$file_img8 = $it_img_dir.'/'.clean_relative_paths($it_img8);
|
||||
@unlink($file_img8);
|
||||
delete_item_thumbnail(dirname($file_img8), basename($file_img8));
|
||||
$it_img8 = '';
|
||||
}
|
||||
if ($it_img9_del) {
|
||||
$file_img9 = $it_img_dir.'/'.clean_relative_paths($it_img9);
|
||||
@unlink($file_img9);
|
||||
delete_item_thumbnail(dirname($file_img9), basename($file_img9));
|
||||
$it_img9 = '';
|
||||
}
|
||||
if ($it_img10_del) {
|
||||
$file_img10 = $it_img_dir.'/'.clean_relative_paths($it_img10);
|
||||
@unlink($file_img10);
|
||||
delete_item_thumbnail(dirname($file_img10), basename($file_img10));
|
||||
$it_img10 = '';
|
||||
}
|
||||
|
||||
// 이미지업로드
|
||||
if ($_FILES['it_img1']['name']) {
|
||||
if($w == 'u' && $it_img1) {
|
||||
$file_img1 = $it_img_dir.'/'.clean_relative_paths($it_img1);
|
||||
@unlink($file_img1);
|
||||
delete_item_thumbnail(dirname($file_img1), basename($file_img1));
|
||||
}
|
||||
$it_img1 = it_img_upload($_FILES['it_img1']['tmp_name'], $_FILES['it_img1']['name'], $it_img_dir.'/'.$it_id);
|
||||
}
|
||||
if ($_FILES['it_img2']['name']) {
|
||||
if($w == 'u' && $it_img2) {
|
||||
$file_img2 = $it_img_dir.'/'.clean_relative_paths($it_img2);
|
||||
@unlink($file_img2);
|
||||
delete_item_thumbnail(dirname($file_img2), basename($file_img2));
|
||||
}
|
||||
$it_img2 = it_img_upload($_FILES['it_img2']['tmp_name'], $_FILES['it_img2']['name'], $it_img_dir.'/'.$it_id);
|
||||
}
|
||||
if ($_FILES['it_img3']['name']) {
|
||||
if($w == 'u' && $it_img3) {
|
||||
$file_img3 = $it_img_dir.'/'.clean_relative_paths($it_img3);
|
||||
@unlink($file_img3);
|
||||
delete_item_thumbnail(dirname($file_img3), basename($file_img3));
|
||||
}
|
||||
$it_img3 = it_img_upload($_FILES['it_img3']['tmp_name'], $_FILES['it_img3']['name'], $it_img_dir.'/'.$it_id);
|
||||
}
|
||||
if ($_FILES['it_img4']['name']) {
|
||||
if($w == 'u' && $it_img4) {
|
||||
$file_img4 = $it_img_dir.'/'.clean_relative_paths($it_img4);
|
||||
@unlink($file_img4);
|
||||
delete_item_thumbnail(dirname($file_img4), basename($file_img4));
|
||||
}
|
||||
$it_img4 = it_img_upload($_FILES['it_img4']['tmp_name'], $_FILES['it_img4']['name'], $it_img_dir.'/'.$it_id);
|
||||
}
|
||||
if ($_FILES['it_img5']['name']) {
|
||||
if($w == 'u' && $it_img5) {
|
||||
$file_img5 = $it_img_dir.'/'.clean_relative_paths($it_img5);
|
||||
@unlink($file_img5);
|
||||
delete_item_thumbnail(dirname($file_img5), basename($file_img5));
|
||||
}
|
||||
$it_img5 = it_img_upload($_FILES['it_img5']['tmp_name'], $_FILES['it_img5']['name'], $it_img_dir.'/'.$it_id);
|
||||
}
|
||||
if ($_FILES['it_img6']['name']) {
|
||||
if($w == 'u' && $it_img6) {
|
||||
$file_img6 = $it_img_dir.'/'.clean_relative_paths($it_img6);
|
||||
@unlink($file_img6);
|
||||
delete_item_thumbnail(dirname($file_img6), basename($file_img6));
|
||||
}
|
||||
$it_img6 = it_img_upload($_FILES['it_img6']['tmp_name'], $_FILES['it_img6']['name'], $it_img_dir.'/'.$it_id);
|
||||
}
|
||||
if ($_FILES['it_img7']['name']) {
|
||||
if($w == 'u' && $it_img7) {
|
||||
$file_img7 = $it_img_dir.'/'.clean_relative_paths($it_img7);
|
||||
@unlink($file_img7);
|
||||
delete_item_thumbnail(dirname($file_img7), basename($file_img7));
|
||||
}
|
||||
$it_img7 = it_img_upload($_FILES['it_img7']['tmp_name'], $_FILES['it_img7']['name'], $it_img_dir.'/'.$it_id);
|
||||
}
|
||||
if ($_FILES['it_img8']['name']) {
|
||||
if($w == 'u' && $it_img8) {
|
||||
$file_img8 = $it_img_dir.'/'.clean_relative_paths($it_img8);
|
||||
@unlink($file_img8);
|
||||
delete_item_thumbnail(dirname($file_img8), basename($file_img8));
|
||||
}
|
||||
$it_img8 = it_img_upload($_FILES['it_img8']['tmp_name'], $_FILES['it_img8']['name'], $it_img_dir.'/'.$it_id);
|
||||
}
|
||||
if ($_FILES['it_img9']['name']) {
|
||||
if($w == 'u' && $it_img9) {
|
||||
$file_img9 = $it_img_dir.'/'.clean_relative_paths($it_img9);
|
||||
@unlink($file_img9);
|
||||
delete_item_thumbnail(dirname($file_img9), basename($file_img9));
|
||||
}
|
||||
$it_img9 = it_img_upload($_FILES['it_img9']['tmp_name'], $_FILES['it_img9']['name'], $it_img_dir.'/'.$it_id);
|
||||
}
|
||||
if ($_FILES['it_img10']['name']) {
|
||||
if($w == 'u' && $it_img10) {
|
||||
$file_img10 = $it_img_dir.'/'.clean_relative_paths($it_img10);
|
||||
@unlink($file_img10);
|
||||
delete_item_thumbnail(dirname($file_img10), basename($file_img10));
|
||||
}
|
||||
$it_img10 = it_img_upload($_FILES['it_img10']['tmp_name'], $_FILES['it_img10']['name'], $it_img_dir.'/'.$it_id);
|
||||
}
|
||||
|
||||
if ($w == "" || $w == "u")
|
||||
{
|
||||
// 다음 입력을 위해서 옵션값을 쿠키로 한달동안 저장함
|
||||
//@setcookie("ck_ca_id", $ca_id, time() + 86400*31, $default[de_cookie_dir], $default[de_cookie_domain]);
|
||||
//@setcookie("ck_maker", stripslashes($it_maker), time() + 86400*31, $default[de_cookie_dir], $default[de_cookie_domain]);
|
||||
//@setcookie("ck_origin", stripslashes($it_origin), time() + 86400*31, $default[de_cookie_dir], $default[de_cookie_domain]);
|
||||
@set_cookie("ck_ca_id", $ca_id, time() + 86400*31);
|
||||
@set_cookie("ck_ca_id2", $ca_id2, time() + 86400*31);
|
||||
@set_cookie("ck_ca_id3", $ca_id3, time() + 86400*31);
|
||||
@set_cookie("ck_maker", stripslashes($it_maker), time() + 86400*31);
|
||||
@set_cookie("ck_origin", stripslashes($it_origin), time() + 86400*31);
|
||||
}
|
||||
|
||||
// 관련상품을 삭제한 뒤에 경고가 노출되어 등록, 수정 없이 관련상품만 삭제될 수 있는 오류 수정 (squared2님,210617)
|
||||
// 포인트 비율 값 체크
|
||||
if(($it_point_type == 1 || $it_point_type == 2) && ($it_point < 0 || $it_point > 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]) ? html_purifier($_POST['ii_article'][$i]) : '';
|
||||
$val = isset($_POST['ii_value'][$i]) ? html_purifier($_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', // 상품유형(할인)
|
||||
'it_level', // 접근레벨
|
||||
'it_level_opt', // 접근레벨 옵션
|
||||
'it_use_addr', // 💡 [추가] 배송지 입력 여부
|
||||
);
|
||||
|
||||
foreach( $check_sanitize_keys as $key ){
|
||||
$$key = isset($_POST[$key]) ? strip_tags(clean_xss_attributes($_POST[$key])) : '';
|
||||
}
|
||||
|
||||
$it_basic = preg_replace('#<script(.*?)>(.*?)<\/script>#is', '', $it_basic);
|
||||
$it_explan = isset($_POST['it_explan']) ? $_POST['it_explan'] : '';
|
||||
|
||||
if ($it_name == "")
|
||||
alert("상품명을 입력해 주십시오.");
|
||||
|
||||
$sql_common = " ca_id = '$ca_id',
|
||||
ca_id2 = '$ca_id2',
|
||||
ca_id3 = '$ca_id3',
|
||||
it_skin = '$it_skin',
|
||||
it_mobile_skin = '$it_mobile_skin',
|
||||
it_name = '$it_name',
|
||||
it_level = '$it_level',
|
||||
it_level_opt = '$it_level_opt',
|
||||
it_maker = '$it_maker',
|
||||
it_origin = '$it_origin',
|
||||
it_brand = '$it_brand',
|
||||
it_model = '$it_model',
|
||||
it_option_subject = '$it_option_subject',
|
||||
it_supply_subject = '$it_supply_subject',
|
||||
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 = '".strip_tags(trim(clean_xss_attributes($it_explan)))."',
|
||||
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_supply_point = '$it_supply_point',
|
||||
it_notax = '$it_notax',
|
||||
it_sell_email = '$it_sell_email',
|
||||
it_use = '$it_use',
|
||||
it_nocoupon = '$it_nocoupon',
|
||||
it_soldout = '$it_soldout',
|
||||
it_stock_qty = '$it_stock_qty',
|
||||
it_stock_sms = '$it_stock_sms',
|
||||
it_noti_qty = '$it_noti_qty',
|
||||
it_sc_type = '$it_sc_type',
|
||||
it_sc_method = '$it_sc_method',
|
||||
it_sc_price = '$it_sc_price',
|
||||
it_sc_minimum = '$it_sc_minimum',
|
||||
it_sc_qty = '$it_sc_qty',
|
||||
it_buy_min_qty = '$it_buy_min_qty',
|
||||
it_buy_max_qty = '$it_buy_max_qty',
|
||||
it_head_html = '$it_head_html',
|
||||
it_tail_html = '$it_tail_html',
|
||||
it_mobile_head_html = '$it_mobile_head_html',
|
||||
it_mobile_tail_html = '$it_mobile_tail_html',
|
||||
it_ip = '{$_SERVER['REMOTE_ADDR']}',
|
||||
it_order = '$it_order',
|
||||
it_tel_inq = '$it_tel_inq',
|
||||
it_info_gubun = '$it_info_gubun',
|
||||
it_info_value = '$it_info_value',
|
||||
it_shop_memo = '$it_shop_memo',
|
||||
ec_mall_pid = '$ec_mall_pid',
|
||||
it_use_addr = '$it_use_addr',
|
||||
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',
|
||||
it_1_subj = '$it_1_subj',
|
||||
it_2_subj = '$it_2_subj',
|
||||
it_3_subj = '$it_3_subj',
|
||||
it_4_subj = '$it_4_subj',
|
||||
it_5_subj = '$it_5_subj',
|
||||
it_6_subj = '$it_6_subj',
|
||||
it_7_subj = '$it_7_subj',
|
||||
it_8_subj = '$it_8_subj',
|
||||
it_9_subj = '$it_9_subj',
|
||||
it_10_subj = '$it_10_subj',
|
||||
it_1 = '$it_1',
|
||||
it_2 = '$it_2',
|
||||
it_3 = '$it_3',
|
||||
it_4 = '$it_4',
|
||||
it_5 = '$it_5',
|
||||
it_6 = '$it_6',
|
||||
it_7 = '$it_7',
|
||||
it_8 = '$it_8',
|
||||
it_9 = '$it_9',
|
||||
it_10 = '$it_10'
|
||||
";
|
||||
|
||||
if ($w == "")
|
||||
{
|
||||
$it_id = isset($_POST['it_id']) ? $_POST['it_id'] : '';
|
||||
|
||||
if (!trim($it_id)) {
|
||||
alert('상품 코드가 없으므로 상품을 추가하실 수 없습니다.');
|
||||
}
|
||||
|
||||
$t_it_id = preg_replace("/[A-Za-z0-9\-_]/", "", $it_id);
|
||||
if($t_it_id)
|
||||
alert('상품 코드는 영문자, 숫자, -, _ 만 사용할 수 있습니다.');
|
||||
|
||||
$sql_common .= " , it_time = '".G5_TIME_YMDHIS."' ";
|
||||
$sql_common .= " , it_update_time = '".G5_TIME_YMDHIS."' ";
|
||||
$sql = " insert {$g5['g5_shop_item_table']}
|
||||
set it_id = '$it_id',
|
||||
$sql_common ";
|
||||
|
||||
sql_query($sql);
|
||||
}
|
||||
else if ($w == "u")
|
||||
{
|
||||
$sql_common .= " , it_update_time = '".G5_TIME_YMDHIS."' ";
|
||||
$sql = " update {$g5['g5_shop_item_table']}
|
||||
set $sql_common
|
||||
where it_id = '$it_id' ";
|
||||
|
||||
sql_query($sql);
|
||||
}
|
||||
/*
|
||||
else if ($w == "d")
|
||||
{
|
||||
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']}\' 님께서 삭제 할 권한이 없는 상품입니다.");
|
||||
}
|
||||
|
||||
itemdelete($it_id);
|
||||
}
|
||||
*/
|
||||
|
||||
if ($w == "" || $w == "u")
|
||||
{
|
||||
// 관련상품 등록
|
||||
$it_id2 = explode(",", $it_list);
|
||||
for ($i=0; $i<count($it_id2); $i++)
|
||||
{
|
||||
if (trim($it_id2[$i]))
|
||||
{
|
||||
$sql = " insert into {$g5['g5_shop_item_relation_table']}
|
||||
set it_id = '$it_id',
|
||||
it_id2 = '".sql_real_escape_string($it_id2[$i])."',
|
||||
ir_no = '$i' ";
|
||||
sql_query($sql, false);
|
||||
|
||||
// 관련상품의 반대로도 등록
|
||||
$sql = " insert into {$g5['g5_shop_item_relation_table']}
|
||||
set it_id = '".sql_real_escape_string($it_id2[$i])."',
|
||||
it_id2 = '$it_id',
|
||||
ir_no = '$i' ";
|
||||
sql_query($sql, false);
|
||||
}
|
||||
}
|
||||
|
||||
// 이벤트상품 등록
|
||||
$ev_id = explode(",", $ev_list);
|
||||
for ($i=0; $i<count($ev_id); $i++)
|
||||
{
|
||||
if (trim($ev_id[$i]))
|
||||
{
|
||||
$sql = " insert into {$g5['g5_shop_event_item_table']}
|
||||
set ev_id = '".sql_real_escape_string($ev_id[$i])."',
|
||||
it_id = '$it_id' ";
|
||||
sql_query($sql, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 선택옵션등록
|
||||
if($option_count) {
|
||||
$comma = '';
|
||||
$sql = " INSERT INTO {$g5['g5_shop_item_option_table']}
|
||||
( `io_id`, `io_type`, `it_id`, `io_price`, `io_stock_qty`, `io_noti_qty`, `io_use` )
|
||||
VALUES ";
|
||||
for($i=0; $i<$option_count; $i++) {
|
||||
$sql .= $comma . " ( '".sql_real_escape_string($_POST['opt_id'][$i])."', '0', '$it_id', '".sql_real_escape_string($_POST['opt_price'][$i])."', '".sql_real_escape_string($_POST['opt_stock_qty'][$i])."', '".sql_real_escape_string($_POST['opt_noti_qty'][$i])."', '".sql_real_escape_string($_POST['opt_use'][$i])."' )";
|
||||
$comma = ' , ';
|
||||
}
|
||||
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
// 추가옵션등록
|
||||
if($supply_count) {
|
||||
$comma = '';
|
||||
$sql = " INSERT INTO {$g5['g5_shop_item_option_table']}
|
||||
( `io_id`, `io_type`, `it_id`, `io_price`, `io_stock_qty`, `io_noti_qty`, `io_use` )
|
||||
VALUES ";
|
||||
for($i=0; $i<$supply_count; $i++) {
|
||||
$sql .= $comma . " ( '".sql_real_escape_string($_POST['spl_id'][$i])."', '1', '$it_id', '".sql_real_escape_string($_POST['spl_price'][$i])."', '".sql_real_escape_string($_POST['spl_stock_qty'][$i])."', '".sql_real_escape_string($_POST['spl_noti_qty'][$i])."', '".sql_real_escape_string($_POST['spl_use'][$i])."' )";
|
||||
$comma = ' , ';
|
||||
}
|
||||
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
// 동일 분류내 상품 동일 옵션 적용
|
||||
$ca_fields = '';
|
||||
if(is_checked('chk_ca_it_skin')) $ca_fields .= " , it_skin = '$it_skin' ";
|
||||
if(is_checked('chk_ca_it_mobile_skin')) $ca_fields .= " , it_mobile_skin = '$it_mobile_skin' ";
|
||||
if(is_checked('chk_ca_it_basic')) $ca_fields .= " , it_basic = '$it_basic' ";
|
||||
if(is_checked('chk_ca_it_level')) $ca_fields .= " , it_level = '$it_level' ";
|
||||
if(is_checked('chk_ca_it_level_opt')) $ca_fields .= " , it_level_opt = '$it_level_opt' ";
|
||||
if(is_checked('chk_ca_it_order')) $ca_fields .= " , it_order = '$it_order' ";
|
||||
if(is_checked('chk_ca_it_type')) $ca_fields .= " , it_type1 = '$it_type1', it_type2 = '$it_type2', it_type3 = '$it_type3', it_type4 = '$it_type4', it_type5 = '$it_type5' ";
|
||||
if(is_checked('chk_ca_it_maker')) $ca_fields .= " , it_maker = '$it_maker' ";
|
||||
if(is_checked('chk_ca_it_origin')) $ca_fields .= " , it_origin = '$it_origin' ";
|
||||
if(is_checked('chk_ca_it_brand')) $ca_fields .= " , it_brand = '$it_brand' ";
|
||||
if(is_checked('chk_ca_it_model')) $ca_fields .= " , it_model = '$it_model' ";
|
||||
if(is_checked('chk_ca_it_notax')) $ca_fields .= " , it_notax = '$it_notax' ";
|
||||
if(is_checked('chk_ca_it_sell_email')) $ca_fields .= " , it_sell_email = '$it_sell_email' ";
|
||||
if(is_checked('chk_ca_it_shop_memo')) $ca_fields .= " , it_shop_memo = '$it_shop_memo' ";
|
||||
if(is_checked('chk_ca_it_tel_inq')) $ca_fields .= " , it_tel_inq = '$it_tel_inq' ";
|
||||
if(is_checked('chk_ca_it_use')) $ca_fields .= " , it_use = '$it_use' ";
|
||||
if(is_checked('chk_ca_it_nocoupon')) $ca_fields .= " , it_nocoupon = '$it_nocoupon' ";
|
||||
if(is_checked('chk_ca_it_soldout')) $ca_fields .= " , it_soldout = '$it_soldout' ";
|
||||
if(is_checked('chk_ca_it_info')) $ca_fields .= " , it_info_gubun = '$it_info_gubun', it_info_value = '$it_info_value' ";
|
||||
if(is_checked('chk_ca_it_price')) $ca_fields .= " , it_price = '$it_price' ";
|
||||
if(is_checked('chk_ca_it_cust_price')) $ca_fields .= " , it_cust_price = '$it_cust_price' ";
|
||||
if(is_checked('chk_ca_it_point')) $ca_fields .= " , it_point = '$it_point' ";
|
||||
if(is_checked('chk_ca_it_point_type')) $ca_fields .= " , it_point_type = '$it_point_type' ";
|
||||
if(is_checked('chk_ca_it_supply_point')) $ca_fields .= " , it_supply_point = '$it_supply_point' ";
|
||||
if(is_checked('chk_ca_it_stock_qty')) $ca_fields .= " , it_stock_qty = '$it_stock_qty' ";
|
||||
if(is_checked('chk_ca_it_noti_qty')) $ca_fields .= " , it_noti_qty = '$it_noti_qty' ";
|
||||
if(is_checked('chk_ca_it_sendcost')) $ca_fields .= " , it_sc_type = '$it_sc_type', it_sc_method = '$it_sc_method', it_sc_price = '$it_sc_price', it_sc_minimum = '$it_sc_minimum', it_sc_qty = '$it_sc_qty' ";
|
||||
if(is_checked('chk_ca_it_buy_min_qty')) $ca_fields .= " , it_buy_min_qty = '$it_buy_min_qty' ";
|
||||
if(is_checked('chk_ca_it_buy_max_qty')) $ca_fields .= " , it_buy_max_qty = '$it_buy_max_qty' ";
|
||||
if(is_checked('chk_ca_it_head_html')) $ca_fields .= " , it_head_html = '$it_head_html' ";
|
||||
if(is_checked('chk_ca_it_tail_html')) $ca_fields .= " , it_tail_html = '$it_tail_html' ";
|
||||
if(is_checked('chk_ca_it_mobile_head_html')) $ca_fields .= " , it_mobile_head_html = '$it_mobile_head_html' ";
|
||||
if(is_checked('chk_ca_it_mobile_tail_html')) $ca_fields .= " , it_mobile_tail_html = '$it_mobile_tail_html' ";
|
||||
if(is_checked('chk_ca_it_use_addr')) $ca_fields .= " , it_use_addr = '$it_use_addr' "; // 💡 [추가]
|
||||
if(is_checked('chk_ca_1')) $ca_fields .= " , it_1_subj = '$it_1_subj', it_1 = '$it_1' ";
|
||||
if(is_checked('chk_ca_2')) $ca_fields .= " , it_2_subj = '$it_2_subj', it_2 = '$it_2' ";
|
||||
if(is_checked('chk_ca_3')) $ca_fields .= " , it_3_subj = '$it_3_subj', it_3 = '$it_3' ";
|
||||
if(is_checked('chk_ca_4')) $ca_fields .= " , it_4_subj = '$it_4_subj', it_4 = '$it_4' ";
|
||||
if(is_checked('chk_ca_5')) $ca_fields .= " , it_5_subj = '$it_5_subj', it_5 = '$it_5' ";
|
||||
if(is_checked('chk_ca_6')) $ca_fields .= " , it_6_subj = '$it_6_subj', it_6 = '$it_6' ";
|
||||
if(is_checked('chk_ca_7')) $ca_fields .= " , it_7_subj = '$it_7_subj', it_7 = '$it_7' ";
|
||||
if(is_checked('chk_ca_8')) $ca_fields .= " , it_8_subj = '$it_8_subj', it_8 = '$it_8' ";
|
||||
if(is_checked('chk_ca_9')) $ca_fields .= " , it_9_subj = '$it_9_subj', it_9 = '$it_9' ";
|
||||
if(is_checked('chk_ca_10')) $ca_fields .= " , it_10_subj = '$it_10_subj', it_10 = '$it_10' ";
|
||||
|
||||
if($all_fields) {
|
||||
sql_query(" update {$g5['g5_shop_item_table']} set it_name = it_name {$all_fields} ");
|
||||
}
|
||||
|
||||
$is_seo_title_edit = $w ? true : false;
|
||||
if( function_exists('shop_seo_title_update') ) shop_seo_title_update($it_id, $is_seo_title_edit);
|
||||
|
||||
run_event('shop_admin_itemformupdate', $it_id, $w);
|
||||
|
||||
$qstr = "$qstr&sca=$sca&page=$page";
|
||||
|
||||
if ($w == "u") {
|
||||
goto_url("./itemform.php?w=u&it_id=$it_id&$qstr");
|
||||
} else if ($w == "d") {
|
||||
$qstr = "ca_id=$ca_id&sfl=$sfl&sca=$sca&page=$page&stx=".urlencode($stx)."&save_stx=".urlencode($save_stx);
|
||||
goto_url("./itemlist.php?$qstr");
|
||||
}
|
||||
|
||||
echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">";
|
||||
?>
|
||||
<script>
|
||||
if (confirm("계속 입력하시겠습니까?"))
|
||||
location.href = "<?php echo "./itemform.php?".str_replace('&', '&', $qstr); ?>";
|
||||
else
|
||||
location.href = "<?php echo "./itemlist.php?".str_replace('&', '&', $qstr); ?>";
|
||||
</script>
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_LIB_PATH.'/iteminfo.lib.php');
|
||||
|
||||
if(isset($it['it_id']) && $it['it_id']) {
|
||||
//$it_id = $it['it_id'];
|
||||
$gubun = $it['it_info_gubun'];
|
||||
} else {
|
||||
$it_id = isset($_POST['it_id']) ? safe_replace_regex($_POST['it_id'], 'it_id') : '';
|
||||
$gubun = isset($_POST['gubun']) ? clean_xss_tags($_POST['gubun'], 1, 1) : 'wear';
|
||||
|
||||
if ( $it_id ){
|
||||
$sql = " select it_id, it_info_gubun, it_info_value from {$g5['g5_shop_item_table']} where it_id = '$it_id' ";
|
||||
if( $items = sql_fetch($sql) ) {
|
||||
$it = $items;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<caption>상품요약정보 입력</caption>
|
||||
<colgroup>
|
||||
<col class="grid_4">
|
||||
<col>
|
||||
<col class="grid_3">
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<?php
|
||||
if(isset($it['it_info_value']) && $it['it_info_value'])
|
||||
$info_value = unserialize($it['it_info_value']);
|
||||
|
||||
$article = isset($item_info[$gubun]['article']) ? $item_info[$gubun]['article'] : array();
|
||||
if ($article) {
|
||||
// $el_no : 분류적용, 전체적용을 한번만 넣기 위해, $el_length : 수직병합할 셀 값 - 지운아빠 2013-05-20
|
||||
$el_no = 0;
|
||||
$el_length = count($article);
|
||||
$it_info_gubun = isset($it['it_info_gubun']) ? $it['it_info_gubun'] : '';
|
||||
|
||||
foreach($article as $key=>$value) {
|
||||
$el_name = $key;
|
||||
$el_title = $value[0];
|
||||
$el_example = $value[1];
|
||||
$el_value = '상품페이지 참고';
|
||||
|
||||
if($gubun == $it_info_gubun && isset($info_value[$key]))
|
||||
$el_value = $info_value[$key];
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="ii_article_<?php echo $el_name; ?>"><?php echo $el_title; ?></label></th>
|
||||
<td>
|
||||
<input type="hidden" name="ii_article[]" value="<?php echo $el_name; ?>">
|
||||
<?php if ($el_example != "") echo help($el_example); ?>
|
||||
<input type="text" name="ii_value[]" value="<?php echo get_text($el_value); ?>" id="ii_article_<?php echo $el_name; ?>" required class="frm_input required" />
|
||||
</td>
|
||||
<?php if ($el_no == 0) { ?>
|
||||
<td rowspan="<?php echo $el_length; ?>" class="td_grpset">
|
||||
<input type="checkbox" name="chk_ca_it_info" value="1" id="chk_ca_it_info">
|
||||
<label for="chk_ca_it_info">분류적용</label>
|
||||
<input type="checkbox" name="chk_all_it_info" value="1" id="chk_all_it_info">
|
||||
<label for="chk_all_it_info">전체적용</label>
|
||||
</td>
|
||||
<?php } $el_no++; ?>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -0,0 +1,303 @@
|
||||
<?php
|
||||
$sub_menu = '400300';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
if (isset($sfl) && $sfl && !in_array($sfl, array('it_name','it_id','it_maker','it_brand','it_model','it_origin','it_sell_email'))) {
|
||||
$sfl = '';
|
||||
}
|
||||
|
||||
$g5['title'] = '상품관리';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
// 분류
|
||||
$ca_list = '<option value="">선택</option>'.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 .= '<option value="'.$row['ca_id'].'">'.$nbsp.$row['ca_name'].'</option>'.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 = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';
|
||||
?>
|
||||
|
||||
<div class="local_ov01 local_ov">
|
||||
<?php echo $listall; ?>
|
||||
<span class="btn_ov01"><span class="ov_txt">등록된 상품</span><span class="ov_num"> <?php echo $total_count; ?>건</span></span>
|
||||
</div>
|
||||
|
||||
<form name="flist" class="local_sch01 local_sch">
|
||||
<input type="hidden" name="save_stx" value="<?php echo $stx; ?>">
|
||||
|
||||
<label for="sca" class="sound_only">분류선택</label>
|
||||
<select name="sca" id="sca">
|
||||
<option value="">전체분류</option>
|
||||
<?php
|
||||
$sql1 = " select ca_id, ca_name from {$g5['g5_shop_category_table']} order by ca_order, ca_id ";
|
||||
$result1 = sql_query($sql1);
|
||||
for ($i=0; $row1=sql_fetch_array($result1); $i++) {
|
||||
$len = strlen($row1['ca_id']) / 2 - 1;
|
||||
$nbsp = '';
|
||||
for ($i=0; $i<$len; $i++) $nbsp .= ' ';
|
||||
echo '<option value="'.$row1['ca_id'].'" '.get_selected($sca, $row1['ca_id']).'>'.$nbsp.$row1['ca_name'].'</option>'.PHP_EOL;
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
<label for="sfl" class="sound_only">검색대상</label>
|
||||
<select name="sfl" id="sfl">
|
||||
<option value="it_name" <?php echo get_selected($sfl, 'it_name'); ?>>상품명</option>
|
||||
<option value="it_id" <?php echo get_selected($sfl, 'it_id'); ?>>상품코드</option>
|
||||
<option value="it_maker" <?php echo get_selected($sfl, 'it_maker'); ?>>제조사</option>
|
||||
<option value="it_origin" <?php echo get_selected($sfl, 'it_origin'); ?>>원산지</option>
|
||||
<option value="it_sell_email" <?php echo get_selected($sfl, 'it_sell_email'); ?>>판매자 e-mail</option>
|
||||
</select>
|
||||
|
||||
<label for="stx" class="sound_only">검색어</label>
|
||||
<input type="text" name="stx" value="<?php echo $stx; ?>" id="stx" class="frm_input">
|
||||
<input type="submit" value="검색" class="btn_submit">
|
||||
|
||||
</form>
|
||||
|
||||
<form name="fitemlistupdate" method="post" action="./itemlistupdate.php" onsubmit="return fitemlist_submit(this);" autocomplete="off" id="fitemlistupdate">
|
||||
<input type="hidden" name="sca" value="<?php echo $sca; ?>">
|
||||
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
|
||||
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
|
||||
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
|
||||
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?> 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" rowspan="3">
|
||||
<label for="chkall" class="sound_only">상품 전체</label>
|
||||
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
|
||||
</th>
|
||||
<th scope="col" rowspan="3"><?php echo subject_sort_link('it_id', 'sca='.$sca); ?>상품코드</a></th>
|
||||
<th scope="col" colspan="5">분류</th>
|
||||
<th scope="col" rowspan="3"><?php echo subject_sort_link('it_order', 'sca='.$sca); ?>순서</a></th>
|
||||
<th scope="col" rowspan="3"><?php echo subject_sort_link('it_use', 'sca='.$sca, 1); ?>판매</a></th>
|
||||
<th scope="col" rowspan="3"><?php echo subject_sort_link('it_soldout', 'sca='.$sca, 1); ?>품절</a></th>
|
||||
<th scope="col" rowspan="3"><?php echo subject_sort_link('it_hit', 'sca='.$sca, 1); ?>조회</a></th>
|
||||
<th scope="col" rowspan="3">관리</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col" rowspan="2" id="th_img">이미지</th>
|
||||
<th scope="col" rowspan="2" id="th_pc_title"><?php echo subject_sort_link('it_name', 'sca='.$sca); ?>상품명</a></th>
|
||||
<th scope="col" id="th_amt"><?php echo subject_sort_link('it_price', 'sca='.$sca); ?>판매가격</a></th>
|
||||
<th scope="col" id="th_camt"><?php echo subject_sort_link('it_cust_price', 'sca='.$sca); ?>시중가격</a></th>
|
||||
<th scope="col" id="th_skin">PC스킨</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col" id="th_pt"><?php echo subject_sort_link('it_point', 'sca='.$sca); ?>포인트</a></th>
|
||||
<th scope="col" id="th_qty"><?php echo subject_sort_link('it_stock_qty', 'sca='.$sca); ?>재고</a></th>
|
||||
<th scope="col" id="th_mskin">모바일스킨</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
$href = shop_item_url($row['it_id']);
|
||||
$bg = 'bg'.($i%2);
|
||||
|
||||
$it_point = $row['it_point'];
|
||||
if($row['it_point_type'])
|
||||
$it_point .= '%';
|
||||
?>
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td rowspan="3" class="td_chk">
|
||||
<label for="chk_<?php echo $i; ?>" class="sound_only"><?php echo get_text($row['it_name']); ?></label>
|
||||
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i; ?>">
|
||||
</td>
|
||||
<td rowspan="3" class="td_num">
|
||||
<input type="hidden" name="it_id[<?php echo $i; ?>]" value="<?php echo $row['it_id']; ?>">
|
||||
<?php echo $row['it_id']; ?>
|
||||
</td>
|
||||
<td colspan="5" class="td_sort">
|
||||
<label for="ca_id_<?php echo $i; ?>" class="sound_only"><?php echo get_text($row['it_name']); ?> 기본분류</label>
|
||||
<select name="ca_id[<?php echo $i; ?>]" id="ca_id_<?php echo $i; ?>">
|
||||
<?php echo conv_selected_option($ca_list, $row['ca_id']); ?>
|
||||
</select>
|
||||
<label for="ca_id2_<?php echo $i; ?>" class="sound_only"><?php echo get_text($row['it_name']); ?> 2차분류</label>
|
||||
<select name="ca_id2[<?php echo $i; ?>]" id="ca_id2_<?php echo $i; ?>">
|
||||
<?php echo conv_selected_option($ca_list, $row['ca_id2']); ?>
|
||||
</select>
|
||||
<label for="ca_id3_<?php echo $i; ?>" class="sound_only"><?php echo get_text($row['it_name']); ?> 3차분류</label>
|
||||
<select name="ca_id3[<?php echo $i; ?>]" id="ca_id3_<?php echo $i; ?>">
|
||||
<?php echo conv_selected_option($ca_list, $row['ca_id3']); ?>
|
||||
</select>
|
||||
</td>
|
||||
<td rowspan="3" class="td_num">
|
||||
<label for="order_<?php echo $i; ?>" class="sound_only">순서</label>
|
||||
<input type="text" name="it_order[<?php echo $i; ?>]" value="<?php echo $row['it_order']; ?>" id="order_<?php echo $i; ?>" class="tbl_input" size="3">
|
||||
</td>
|
||||
<td rowspan="3">
|
||||
<label for="use_<?php echo $i; ?>" class="sound_only">판매여부</label>
|
||||
<input type="checkbox" name="it_use[<?php echo $i; ?>]" <?php echo ($row['it_use'] ? 'checked' : ''); ?> value="1" id="use_<?php echo $i; ?>">
|
||||
</td>
|
||||
<td rowspan="3">
|
||||
<label for="soldout_<?php echo $i; ?>" class="sound_only">품절</label>
|
||||
<input type="checkbox" name="it_soldout[<?php echo $i; ?>]" <?php echo ($row['it_soldout'] ? 'checked' : ''); ?> value="1" id="soldout_<?php echo $i; ?>">
|
||||
</td>
|
||||
<td rowspan="3" class="td_num"><?php echo $row['it_hit']; ?></td>
|
||||
<td rowspan="3" class="td_mng td_mng_s">
|
||||
<a href="./itemform.php?w=u&it_id=<?php echo $row['it_id']; ?>&ca_id=<?php echo $row['ca_id']; ?>&<?php echo $qstr; ?>" class="btn btn_03"><span class="sound_only"><?php echo htmlspecialchars2(cut_str($row['it_name'],250, "")); ?> </span>수정</a>
|
||||
<a href="./itemcopy.php?it_id=<?php echo $row['it_id']; ?>&ca_id=<?php echo $row['ca_id']; ?>" class="itemcopy btn btn_02" target="_blank"><span class="sound_only"><?php echo htmlspecialchars2(cut_str($row['it_name'],250, "")); ?> </span>복사</a>
|
||||
<a href="<?php echo $href; ?>" class="btn btn_02"><span class="sound_only"><?php echo htmlspecialchars2(cut_str($row['it_name'],250, "")); ?> </span>보기</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td rowspan="2" class="td_img"><a href="<?php echo $href; ?>"><?php echo get_it_image($row['it_id'], 50, 50); ?></a></td>
|
||||
<td headers="th_pc_title" rowspan="2" class="td_input">
|
||||
<label for="name_<?php echo $i; ?>" class="sound_only">상품명</label>
|
||||
<input type="text" name="it_name[<?php echo $i; ?>]" value="<?php echo htmlspecialchars2(cut_str($row['it_name'],250, "")); ?>" id="name_<?php echo $i; ?>" required class="tbl_input required" size="30">
|
||||
</td>
|
||||
<td headers="th_amt" class="td_numbig td_input">
|
||||
<label for="price_<?php echo $i; ?>" class="sound_only">판매가격</label>
|
||||
<input type="text" name="it_price[<?php echo $i; ?>]" value="<?php echo $row['it_price']; ?>" id="price_<?php echo $i; ?>" class="tbl_input sit_amt" size="7">
|
||||
</td>
|
||||
<td headers="th_camt" class="td_numbig td_input">
|
||||
<label for="cust_price_<?php echo $i; ?>" class="sound_only">시중가격</label>
|
||||
<input type="text" name="it_cust_price[<?php echo $i; ?>]" value="<?php echo $row['it_cust_price']; ?>" id="cust_price_<?php echo $i; ?>" class="tbl_input sit_camt" size="7">
|
||||
</td>
|
||||
<td headers="th_skin" class="td_numbig td_input">
|
||||
<label for="it_skin_<?php echo $i; ?>" class="sound_only">PC 스킨</label>
|
||||
<?php echo get_skin_select('shop', 'it_skin_'.$i, 'it_skin['.$i.']', $row['it_skin']); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td headers="th_pt" class="td_numbig td_input"><?php echo $it_point; ?></td>
|
||||
<td headers="th_qty" class="td_numbig td_input">
|
||||
<label for="stock_qty_<?php echo $i; ?>" class="sound_only">재고</label>
|
||||
<input type="text" name="it_stock_qty[<?php echo $i; ?>]" value="<?php echo $row['it_stock_qty']; ?>" id="stock_qty_<?php echo $i; ?>" class="tbl_input sit_qty" size="7">
|
||||
</td>
|
||||
<td headers="th_mskin" class="td_numbig td_input">
|
||||
<label for="it_mobile_skin_<?php echo $i; ?>" class="sound_only">모바일 스킨</label>
|
||||
<?php echo get_mobile_skin_select('shop', 'it_mobile_skin_'.$i, 'it_mobile_skin['.$i.']', $row['it_mobile_skin']); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
if ($i == 0)
|
||||
echo '<tr><td colspan="12" class="empty_table">자료가 한건도 없습니다.</td></tr>';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
|
||||
<a href="./itemform.php" class="btn btn_01">상품등록</a>
|
||||
<a href="./itemexcel.php" onclick="return excelform(this.href);" target="_blank" class="btn btn_02">상품일괄등록</a>
|
||||
<input type="submit" name="act_button" value="선택수정" onclick="document.pressed=this.value" class="btn btn_02">
|
||||
<?php if ($is_admin == 'super') { ?>
|
||||
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value" class="btn btn_02">
|
||||
<?php } ?>
|
||||
</div>
|
||||
<!-- <div class="btn_confirm01 btn_confirm">
|
||||
<input type="submit" value="일괄수정" class="btn_submit" accesskey="s">
|
||||
</div> -->
|
||||
</form>
|
||||
|
||||
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page="); ?>
|
||||
|
||||
<script>
|
||||
function fitemlist_submit(f)
|
||||
{
|
||||
if (!is_checked("chk[]")) {
|
||||
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(document.pressed == "선택삭제") {
|
||||
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$(".itemcopy").click(function() {
|
||||
var href = $(this).attr("href");
|
||||
window.open(href, "copywin", "left=100, top=100, width=300, height=200, scrollbars=0");
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
function excelform(url)
|
||||
{
|
||||
var opt = "width=600,height=450,left=10,top=10";
|
||||
window.open(url, "win_excel", opt);
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
$sub_menu = '400300';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$count_post_chk = (isset($_POST['chk']) && is_array($_POST['chk'])) ? count($_POST['chk']) : 0;
|
||||
$post_act_button = isset($_POST['act_button']) ? $_POST['act_button'] : '';
|
||||
|
||||
if (! $count_post_chk) {
|
||||
alert($post_act_button." 하실 항목을 하나 이상 체크하세요.");
|
||||
}
|
||||
|
||||
if ($post_act_button == "선택수정") {
|
||||
|
||||
auth_check_menu($auth, $sub_menu, 'w');
|
||||
|
||||
for ($i=0; $i< $count_post_chk; $i++) {
|
||||
|
||||
// 실제 번호를 넘김
|
||||
$k = isset($_POST['chk'][$i]) ? (int) $_POST['chk'][$i] : 0;
|
||||
|
||||
if( ! (isset($_POST['ca_id'][$k]) && $_POST['ca_id'][$k])) {
|
||||
alert("기본분류는 반드시 선택해야 합니다.");
|
||||
}
|
||||
|
||||
$p_ca_id = (isset($_POST['ca_id']) && is_array($_POST['ca_id'])) ? strip_tags($_POST['ca_id'][$k]) : '';
|
||||
$p_ca_id2 = (isset($_POST['ca_id2']) && is_array($_POST['ca_id2'])) ? strip_tags($_POST['ca_id2'][$k]) : '';
|
||||
$p_ca_id3 = (isset($_POST['ca_id3']) && is_array($_POST['ca_id3'])) ? strip_tags($_POST['ca_id3'][$k]) : '';
|
||||
$p_it_name = (isset($_POST['it_name']) && is_array($_POST['it_name'])) ? strip_tags(clean_xss_attributes($_POST['it_name'][$k])) : '';
|
||||
$p_it_cust_price = (isset($_POST['it_cust_price']) && is_array($_POST['it_cust_price'])) ? strip_tags($_POST['it_cust_price'][$k]) : '';
|
||||
$p_it_price = (isset($_POST['it_price']) && is_array($_POST['it_price'])) ? strip_tags($_POST['it_price'][$k]) : '';
|
||||
$p_it_stock_qty = (isset($_POST['it_stock_qty']) && is_array($_POST['it_stock_qty'])) ? strip_tags($_POST['it_stock_qty'][$k]) : '';
|
||||
$p_it_skin = (isset($_POST['it_skin']) && is_array($_POST['it_skin'])) ? strip_tags($_POST['it_skin'][$k]) : '';
|
||||
$p_it_mobile_skin = (isset($_POST['it_mobile_skin']) && is_array($_POST['it_mobile_skin'])) ? strip_tags($_POST['it_mobile_skin'][$k]) : '';
|
||||
$p_it_use = isset($_POST['it_use'][$k]) ? clean_xss_tags($_POST['it_use'][$k], 1, 1) : 0;
|
||||
$p_it_soldout = isset($_POST['it_soldout'][$k]) ? clean_xss_tags($_POST['it_soldout'][$k], 1, 1) : 0;
|
||||
$p_it_order = (isset($_POST['it_order']) && is_array($_POST['it_order'])) ? strip_tags($_POST['it_order'][$k]) : '';
|
||||
$p_it_id = isset($_POST['it_id'][$k]) ? preg_replace('/[^a-z0-9_\-]/i', '', $_POST['it_id'][$k]) : '';
|
||||
|
||||
if ($is_admin != 'super') { // 최고관리자가 아니면 체크
|
||||
$sql = "select a.it_id, b.ca_mb_id from {$g5['g5_shop_item_table']} a , {$g5['g5_shop_category_table']} b where (a.ca_id = b.ca_id) and a.it_id = '$p_it_id'";
|
||||
$checks = sql_fetch($sql);
|
||||
|
||||
if( ! $checks['ca_mb_id'] || $checks['ca_mb_id'] !== $member['mb_id'] ){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "update {$g5['g5_shop_item_table']}
|
||||
set ca_id = '".sql_real_escape_string($p_ca_id)."',
|
||||
ca_id2 = '".sql_real_escape_string($p_ca_id2)."',
|
||||
ca_id3 = '".sql_real_escape_string($p_ca_id3)."',
|
||||
it_name = '".$p_it_name."',
|
||||
it_cust_price = '".sql_real_escape_string($p_it_cust_price)."',
|
||||
it_price = '".sql_real_escape_string($p_it_price)."',
|
||||
it_stock_qty = '".sql_real_escape_string($p_it_stock_qty)."',
|
||||
it_skin = '".sql_real_escape_string($p_it_skin)."',
|
||||
it_mobile_skin = '".sql_real_escape_string($p_it_mobile_skin)."',
|
||||
it_use = '".sql_real_escape_string($p_it_use)."',
|
||||
it_soldout = '".sql_real_escape_string($p_it_soldout)."',
|
||||
it_order = '".sql_real_escape_string($p_it_order)."',
|
||||
it_update_time = '".G5_TIME_YMDHIS."'
|
||||
where it_id = '".$p_it_id."' ";
|
||||
|
||||
sql_query($sql);
|
||||
|
||||
if( function_exists('shop_seo_title_update') ) shop_seo_title_update($p_it_id, true);
|
||||
}
|
||||
} else if ($post_act_button == "선택삭제") {
|
||||
|
||||
if ($is_admin != 'super')
|
||||
alert('상품 삭제는 최고관리자만 가능합니다.');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, 'd');
|
||||
|
||||
// _ITEM_DELETE_ 상수를 선언해야 itemdelete.inc.php 가 정상 작동함
|
||||
define('_ITEM_DELETE_', true);
|
||||
|
||||
for ($i=0; $i<$count_post_chk; $i++) {
|
||||
// 실제 번호를 넘김
|
||||
$k = isset($_POST['chk'][$i]) ? (int) $_POST['chk'][$i] : 0;
|
||||
|
||||
// include 전에 $it_id 값을 반드시 넘겨야 함
|
||||
$it_id = isset($_POST['it_id'][$k]) ? preg_replace('/[^a-z0-9_\-]/i', '', $_POST['it_id'][$k]) : '';
|
||||
include ('./itemdelete.inc.php');
|
||||
}
|
||||
}
|
||||
|
||||
goto_url("./itemlist.php?sca=$sca&sst=$sst&sod=$sod&sfl=$sfl&stx=$stx&page=$page");
|
||||
@@ -0,0 +1,223 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$po_run = false;
|
||||
|
||||
if(isset($it['it_id']) && $it['it_id']) {
|
||||
$opt_subject = explode(',', $it['it_option_subject']);
|
||||
$opt1_subject = isset($opt_subject[0]) ? $opt_subject[0] : '';
|
||||
$opt2_subject = isset($opt_subject[1]) ? $opt_subject[1] : '';
|
||||
$opt3_subject = isset($opt_subject[2]) ? $opt_subject[2] : '';
|
||||
|
||||
$sql = " select * from {$g5['g5_shop_item_option_table']} where io_type = '0' and it_id = '{$it['it_id']}' order by io_no asc ";
|
||||
$result = sql_query($sql);
|
||||
if(sql_num_rows($result))
|
||||
$po_run = true;
|
||||
} else if(!empty($_POST)) {
|
||||
$opt1_subject = isset($_POST['opt1_subject']) ? preg_replace(G5_OPTION_ID_FILTER, '', trim(stripslashes($_POST['opt1_subject']))) : '';
|
||||
$opt2_subject = isset($_POST['opt2_subject']) ? preg_replace(G5_OPTION_ID_FILTER, '', trim(stripslashes($_POST['opt2_subject']))) : '';
|
||||
$opt3_subject = isset($_POST['opt3_subject']) ? preg_replace(G5_OPTION_ID_FILTER, '', trim(stripslashes($_POST['opt3_subject']))) : '';
|
||||
|
||||
$opt1_val = isset($_POST['opt1']) ? preg_replace(G5_OPTION_ID_FILTER, '', trim(stripslashes($_POST['opt1']))) : '';
|
||||
$opt2_val = isset($_POST['opt2']) ? preg_replace(G5_OPTION_ID_FILTER, '', trim(stripslashes($_POST['opt2']))) : '';
|
||||
$opt3_val = isset($_POST['opt3']) ? preg_replace(G5_OPTION_ID_FILTER, '', trim(stripslashes($_POST['opt3']))) : '';
|
||||
|
||||
if(!$opt1_subject || !$opt1_val) {
|
||||
echo '옵션1과 옵션1 항목을 입력해 주십시오.';
|
||||
exit;
|
||||
}
|
||||
|
||||
$po_run = true;
|
||||
|
||||
$opt1_count = $opt2_count = $opt3_count = 0;
|
||||
|
||||
if($opt1_val) {
|
||||
$opt1 = explode(',', $opt1_val);
|
||||
$opt1_count = count($opt1);
|
||||
}
|
||||
|
||||
if($opt2_val) {
|
||||
$opt2 = explode(',', $opt2_val);
|
||||
$opt2_count = count($opt2);
|
||||
}
|
||||
|
||||
if($opt3_val) {
|
||||
$opt3 = explode(',', $opt3_val);
|
||||
$opt3_count = count($opt3);
|
||||
}
|
||||
}
|
||||
|
||||
if($po_run) {
|
||||
?>
|
||||
|
||||
<div class="sit_option_frm_wrapper">
|
||||
<table>
|
||||
<caption>옵션 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
<label for="opt_chk_all" class="sound_only">전체 옵션</label>
|
||||
<input type="checkbox" name="opt_chk_all" value="1" id="opt_chk_all">
|
||||
</th>
|
||||
<th scope="col">옵션</th>
|
||||
<th scope="col">추가금액</th>
|
||||
<th scope="col">재고수량</th>
|
||||
<th scope="col">통보수량</th>
|
||||
<th scope="col">사용여부</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
if(isset($it['it_id']) && $it['it_id']) {
|
||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
$opt_id = $row['io_id'];
|
||||
$opt_val = explode(chr(30), $opt_id);
|
||||
$opt_1 = $opt_val[0];
|
||||
$opt_2 = isset($opt_val[1]) ? $opt_val[1] : '';
|
||||
$opt_3 = isset($opt_val[2]) ? $opt_val[2] : '';
|
||||
$opt_2_len = strlen($opt_2);
|
||||
$opt_3_len = strlen($opt_3);
|
||||
$opt_price = $row['io_price'];
|
||||
$opt_stock_qty = $row['io_stock_qty'];
|
||||
$opt_noti_qty = $row['io_noti_qty'];
|
||||
$opt_use = $row['io_use'];
|
||||
?>
|
||||
<tr>
|
||||
<td class="td_chk">
|
||||
<input type="hidden" name="opt_id[]" value="<?php echo $opt_id; ?>">
|
||||
<label for="opt_chk_<?php echo $i; ?>" class="sound_only"></label>
|
||||
<input type="checkbox" name="opt_chk[]" id="opt_chk_<?php echo $i; ?>" value="1">
|
||||
</td>
|
||||
<td class="opt-cell"><?php echo $opt_1; if ($opt_2_len) echo ' <small>></small> '.$opt_2; if ($opt_3_len) echo ' <small>></small> '.$opt_3; ?></td>
|
||||
<td class="td_numsmall">
|
||||
<label for="opt_price_<?php echo $i; ?>" class="sound_only"></label>
|
||||
<input type="text" name="opt_price[]" value="<?php echo $opt_price; ?>" id="opt_price_<?php echo $i; ?>" class="frm_input" size="9">
|
||||
</td>
|
||||
<td class="td_num">
|
||||
<label for="opt_stock_qty_<?php echo $i; ?>" class="sound_only"></label>
|
||||
<input type="text" name="opt_stock_qty[]" value="<?php echo $opt_stock_qty; ?>" id="op_stock_qty_<?php echo $i; ?>" class="frm_input" size="5">
|
||||
</td>
|
||||
<td class="td_num">
|
||||
<label for="opt_noti_qty_<?php echo $i; ?>" class="sound_only"></label>
|
||||
<input type="text" name="opt_noti_qty[]" value="<?php echo $opt_noti_qty; ?>" id="opt_noti_qty_<?php echo $i; ?>" class="frm_input" size="5">
|
||||
</td>
|
||||
<td class="td_mng">
|
||||
<label for="opt_use_<?php echo $i; ?>" class="sound_only"></label>
|
||||
<select name="opt_use[]" id="opt_use_<?php echo $i; ?>">
|
||||
<option value="1" <?php echo get_selected('1', $opt_use); ?>>사용함</option>
|
||||
<option value="0" <?php echo get_selected('0', $opt_use); ?>>사용안함</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
} // for
|
||||
} else {
|
||||
|
||||
$w = isset($_POST['w']) ? $_POST['w'] : '';
|
||||
$post_it_id = isset($_POST['it_id']) ? safe_replace_regex($_POST['it_id'], 'it_id') : '';
|
||||
|
||||
for($i=0; $i<$opt1_count; $i++) {
|
||||
$j = 0;
|
||||
do {
|
||||
$k = 0;
|
||||
do {
|
||||
$opt_1 = isset($opt1[$i]) ? strip_tags(trim($opt1[$i])) : '';
|
||||
$opt_2 = isset($opt2[$j]) ? strip_tags(trim($opt2[$j])) : '';
|
||||
$opt_3 = isset($opt3[$k]) ? strip_tags(trim($opt3[$k])) : '';
|
||||
|
||||
$opt_2_len = strlen($opt_2);
|
||||
$opt_3_len = strlen($opt_3);
|
||||
|
||||
$opt_id = $opt_1;
|
||||
if($opt_2_len)
|
||||
$opt_id .= chr(30).$opt_2;
|
||||
if($opt_3_len)
|
||||
$opt_id .= chr(30).$opt_3;
|
||||
$opt_price = 0;
|
||||
$opt_stock_qty = 9999;
|
||||
$opt_noti_qty = 100;
|
||||
$opt_use = 1;
|
||||
|
||||
// 기존에 설정된 값이 있는지 체크
|
||||
if($w === 'u') {
|
||||
$sql = " select io_price, io_stock_qty, io_noti_qty, io_use
|
||||
from {$g5['g5_shop_item_option_table']}
|
||||
where it_id = '{$post_it_id}'
|
||||
and io_id = '$opt_id'
|
||||
and io_type = '0' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if($row) {
|
||||
$opt_price = (int)$row['io_price'];
|
||||
$opt_stock_qty = (int)$row['io_stock_qty'];
|
||||
$opt_noti_qty = (int)$row['io_noti_qty'];
|
||||
$opt_use = (int)$row['io_use'];
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td class="td_chk">
|
||||
<input type="hidden" name="opt_id[]" value="<?php echo $opt_id; ?>">
|
||||
<label for="opt_chk_<?php echo $i; ?>" class="sound_only"></label>
|
||||
<input type="checkbox" name="opt_chk[]" id="opt_chk_<?php echo $i; ?>" value="1">
|
||||
</td>
|
||||
<td class="opt1-cell"><?php echo $opt_1; if ($opt_2_len) echo ' <small>></small> '.$opt_2; if ($opt_3_len) echo ' <small>></small> '.$opt_3; ?></td>
|
||||
<td class="td_numsmall">
|
||||
<label for="opt_price_<?php echo $i; ?>" class="sound_only"></label>
|
||||
<input type="text" name="opt_price[]" value="<?php echo $opt_price; ?>" id="opt_price_<?php echo $i; ?>" class="frm_input" size="9">
|
||||
</td>
|
||||
<td class="td_num">
|
||||
<label for="opt_stock_qty_<?php echo $i; ?>" class="sound_only"></label>
|
||||
<input type="text" name="opt_stock_qty[]" value="<?php echo $opt_stock_qty; ?>" id="opt_stock_qty_<?php echo $i; ?>" class="frm_input" size="5">
|
||||
</td>
|
||||
<td class="td_num">
|
||||
<label for="opt_noti_qty_<?php echo $i; ?>" class="sound_only"></label>
|
||||
<input type="text" name="opt_noti_qty[]" value="<?php echo $opt_noti_qty; ?>" id="opt_noti_qty_<?php echo $i; ?>" class="frm_input" size="5">
|
||||
</td>
|
||||
<td class="td_mng">
|
||||
<label for="opt_use_<?php echo $i; ?>" class="sound_only"></label>
|
||||
<select name="opt_use[]" id="opt_use_<?php echo $i; ?>">
|
||||
<option value="1" <?php echo get_selected('1', $opt_use); ?>>사용함</option>
|
||||
<option value="0" <?php echo get_selected('0', $opt_use); ?>>사용안함</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$k++;
|
||||
} while($k < $opt3_count);
|
||||
|
||||
$j++;
|
||||
} while($j < $opt2_count);
|
||||
} // for
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_list01 btn_list">
|
||||
<input type="button" value="선택삭제" id="sel_option_delete" class="btn btn_02">
|
||||
</div>
|
||||
|
||||
<fieldset>
|
||||
<legend>옵션 일괄 적용</legend>
|
||||
<?php echo help('전체 옵션의 추가금액, 재고/통보수량 및 사용여부를 일괄 적용할 수 있습니다. 단, 체크된 수정항목만 일괄 적용됩니다.'); ?>
|
||||
<label for="opt_com_price">추가금액</label>
|
||||
<label for="opt_com_price_chk" class="sound_only">추가금액일괄수정</label><input type="checkbox" name="opt_com_price_chk" value="1" id="opt_com_price_chk" class="opt_com_chk">
|
||||
<input type="text" name="opt_com_price" value="0" id="opt_com_price" class="frm_input" size="5">
|
||||
<label for="opt_com_stock">재고수량</label>
|
||||
<label for="opt_com_stock_chk" class="sound_only">재고수량일괄수정</label><input type="checkbox" name="opt_com_stock_chk" value="1" id="opt_com_stock_chk" class="opt_com_chk">
|
||||
<input type="text" name="opt_com_stock" value="0" id="opt_com_stock" class="frm_input" size="5">
|
||||
<label for="opt_com_noti">통보수량</label>
|
||||
<label for="opt_com_noti_chk" class="sound_only">통보수량일괄수정</label><input type="checkbox" name="opt_com_noti_chk" value="1" id="opt_com_noti_chk" class="opt_com_chk">
|
||||
<input type="text" name="opt_com_noti" value="0" id="opt_com_noti" class="frm_input" size="5">
|
||||
<label for="opt_com_use">사용여부</label>
|
||||
<label for="opt_com_use_chk" class="sound_only">사용여부일괄수정</label><input type="checkbox" name="opt_com_use_chk" value="1" id="opt_com_use_chk" class="opt_com_chk">
|
||||
<select name="opt_com_use" id="opt_com_use">
|
||||
<option value="1">사용함</option>
|
||||
<option value="0">사용안함</option>
|
||||
</select>
|
||||
<button type="button" id="opt_value_apply" class="btn_frmline">일괄적용</button>
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
$sub_menu = '400660';
|
||||
include_once('./_common.php');
|
||||
include_once(G5_EDITOR_LIB);
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
$iq_id = isset($_REQUEST['iq_id']) ? preg_replace('/[^0-9]/', '', $_REQUEST['iq_id']) : 0;
|
||||
|
||||
$sql = " select *
|
||||
from {$g5['g5_shop_item_qa_table']} a
|
||||
left join {$g5['member_table']} b on (a.mb_id = b.mb_id)
|
||||
where iq_id = '$iq_id' ";
|
||||
$iq = sql_fetch($sql);
|
||||
if (! (isset($iq['iq_id']) && $iq['iq_id'])) alert('등록된 자료가 없습니다.');
|
||||
|
||||
//$name = get_sideview($iq['mb_id'], get_text($iq['iq_name']), $iq['mb_email'], $iq['mb_homepage']);
|
||||
$name = get_text($iq['iq_name']);
|
||||
|
||||
$g5['title'] = '상품문의';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
$qstr .= ($qstr ? '&' : '').'sca='.$sca;
|
||||
?>
|
||||
|
||||
<form name="fitemqaform" method="post" action="./itemqaformupdate.php" onsubmit="return fitemqaform_submit(this);">
|
||||
<input type="hidden" name="w" value="<?php echo $w; ?>">
|
||||
<input type="hidden" name="iq_id" value="<?php echo $iq_id; ?>">
|
||||
<input type="hidden" name="sca" value="<?php echo $sca; ?>">
|
||||
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
|
||||
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
|
||||
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
|
||||
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
|
||||
<div class="local_desc01 local_desc">
|
||||
<p>상품에 대한 문의에 답변하실 수 있습니다. 상품 문의 내용의 수정도 가능합니다.</p>
|
||||
</div>
|
||||
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?> 수정</caption>
|
||||
<colgroup>
|
||||
<col class="grid_4">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">이름</th>
|
||||
<td><?php echo $name; ?></td>
|
||||
</tr>
|
||||
<?php if($iq['iq_email']) { ?>
|
||||
<tr>
|
||||
<th scope="row">이메일</th>
|
||||
<td><?php echo get_text($iq['iq_email']); ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php if($iq['iq_hp']) { ?>
|
||||
<tr>
|
||||
<th scope="row">휴대폰</th>
|
||||
<td><?php echo hyphen_hp_number($iq['iq_hp']); ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<th scope="row"><label for="iq_subject">제목</label></th>
|
||||
<td><input type="text" name="iq_subject" value="<?php echo conv_subject($iq['iq_subject'],120); ?>" id="iq_subject" required class="frm_input required" size="95"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="iq_question">질문</label></th>
|
||||
<td><?php echo editor_html('iq_question', get_text(html_purifier($iq['iq_question']), 0)); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="iq_answer">답변</label></th>
|
||||
<td><?php echo editor_html('iq_answer', get_text(html_purifier($iq['iq_answer']), 0)); ?></td>
|
||||
<!-- <td><textarea name="iq_answer" id="iq_answer" rows="7"><?php echo get_text($iq['iq_answer']); ?></textarea></td> -->
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<a href="./itemqalist.php?<?php echo $qstr; ?>" class="btn btn_02">목록</a>
|
||||
<input type="submit" accesskey='s' value="확인" class="btn_submit btn">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
function fitemqaform_submit(f)
|
||||
{
|
||||
<?php echo get_editor_js('iq_question'); ?>
|
||||
<?php echo get_editor_js('iq_answer'); ?>
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
$sub_menu = '400660';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
|
||||
if ($w == 'd')
|
||||
auth_check_menu($auth, $sub_menu, "d");
|
||||
else
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
check_admin_token();
|
||||
|
||||
if ($w == "u")
|
||||
{
|
||||
$sql = "update {$g5['g5_shop_item_qa_table']}
|
||||
set iq_subject = '$iq_subject',
|
||||
iq_question = '$iq_question',
|
||||
iq_answer = '$iq_answer'
|
||||
where iq_id = '$iq_id' ";
|
||||
sql_query($sql);
|
||||
run_event('shop_admin_item_qa_updated', $iq_id);
|
||||
|
||||
if(trim($iq_answer)) {
|
||||
$sql = " select a.iq_email, a.iq_hp, a.mb_id, b.it_name, b.it_id
|
||||
from {$g5['g5_shop_item_qa_table']} a left join {$g5['g5_shop_item_table']} b on ( a.it_id = b.it_id )
|
||||
where a.iq_id = '$iq_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
// SMS 알림
|
||||
if($config['cf_sms_use'] == 'icode' && $row['iq_hp']) {
|
||||
$sms_content = get_text($row['it_name']).' 상품문의에 답변이 등록되었습니다.';
|
||||
$send_number = preg_replace('/[^0-9]/', '', $default['de_admin_company_tel']);
|
||||
$recv_number = preg_replace('/[^0-9]/', '', $row['iq_hp']);
|
||||
|
||||
if($recv_number) {
|
||||
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);
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
if($row['mb_id']) {
|
||||
|
||||
$od_al = "[".$row['it_name']."] 상품 문의에 답변이 등록 되었습니다.";
|
||||
memo_auto_send($od_al, shop_item_url($row['it_id']), $row['mb_id'], "system-msg");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
goto_url("./itemqaform.php?w=$w&iq_id=$iq_id&sca=$sca&$qstr");
|
||||
}
|
||||
else {
|
||||
alert();
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
<?php
|
||||
$sub_menu = '400660';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
if (isset($sfl) && $sfl && !in_array($sfl, array('it_name','a.it_id'))) {
|
||||
$sfl = '';
|
||||
}
|
||||
|
||||
$g5['title'] = '상품문의';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
$where = " where ";
|
||||
$sql_search = "";
|
||||
if ($stx != "") {
|
||||
if ($sfl != "") {
|
||||
$sql_search .= " $where $sfl like '%$stx%' ";
|
||||
$where = " and ";
|
||||
}
|
||||
if ($save_stx != $stx)
|
||||
$page = 1;
|
||||
}
|
||||
|
||||
if ($sca != "") {
|
||||
$sql_search .= " and ca_id like '$sca%' ";
|
||||
}
|
||||
|
||||
if ($sfl == "") $sfl = "it_name";
|
||||
if (!$sst) {
|
||||
$sst = "iq_id";
|
||||
$sod = "desc";
|
||||
}
|
||||
|
||||
$sql_common = " from {$g5['g5_shop_item_qa_table']} a
|
||||
left join {$g5['g5_shop_item_table']} b on (a.it_id = b.it_id)
|
||||
left join {$g5['member_table']} c on (a.mb_id = c.mb_id) ";
|
||||
$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; // 시작 열을 구함
|
||||
|
||||
$sql = " select *
|
||||
$sql_common
|
||||
order by $sst $sod, iq_id desc
|
||||
limit $from_record, $rows ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
//$qstr = 'page='.$page.'&sst='.$sst.'&sod='.$sod.'&stx='.$stx;
|
||||
$qstr .= ($qstr ? '&' : '').'sca='.$sca.'&save_stx='.$stx;
|
||||
|
||||
$listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';
|
||||
?>
|
||||
|
||||
<div class="local_ov01 local_ov">
|
||||
<?php echo $listall; ?>
|
||||
<span class="btn_ov01"><span class="ov_txt"> 전체 문의내역</span><span class="ov_num"> <?php echo $total_count; ?>건</span></span>
|
||||
</div>
|
||||
|
||||
<form name="flist" class="local_sch01 local_sch">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
<input type="hidden" name="save_stx" value="<?php echo $stx; ?>">
|
||||
|
||||
<label for="sca" class="sound_only">분류선택</label>
|
||||
<select name="sca" id="sca">
|
||||
<option value="">전체분류</option>
|
||||
<?php
|
||||
$sql1 = " select ca_id, ca_name from {$g5['g5_shop_category_table']} order by ca_order, ca_id ";
|
||||
$result1 = sql_query($sql1);
|
||||
for ($i=0; $row1=sql_fetch_array($result1); $i++) {
|
||||
$len = strlen($row1['ca_id']) / 2 - 1;
|
||||
$nbsp = "";
|
||||
for ($i=0; $i<$len; $i++) $nbsp .= " ";
|
||||
$selected = ($row1['ca_id'] == $sca) ? ' selected="selected"' : '';
|
||||
echo '<option value="'.$row1['ca_id'].'"'.$selected.'>'.$nbsp.$row1['ca_name'].'</option>'.PHP_EOL;
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
<label for="sfl" class="sound_only">검색대상</label>
|
||||
<select name="sfl" id="sfl">
|
||||
<option value="it_name" <?php echo get_selected($sfl, 'it_name'); ?>>상품명</option>
|
||||
<option value="a.it_id" <?php echo get_selected($sfl, 'a.it_id'); ?>>상품코드</option>
|
||||
</select>
|
||||
|
||||
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
|
||||
<input type="text" name="stx" value="<?php echo $stx; ?>" id="stx" required class="frm_input required">
|
||||
<input type="submit" value="검색" class="btn_submit">
|
||||
|
||||
</form>
|
||||
|
||||
<form name="fitemqalist" method="post" action="./itemqalistupdate.php" onsubmit="return fitemqalist_submit(this);" autocomplete="off">
|
||||
<input type="hidden" name="sca" value="<?php echo $sca; ?>">
|
||||
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
|
||||
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
|
||||
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
|
||||
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
|
||||
<div class="tbl_head01 tbl_wrap" id="itemqalist">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?> 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
<label for="chkall" class="sound_only">상품문의 전체</label>
|
||||
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
|
||||
</th>
|
||||
<th scope="col"><?php echo subject_sort_link('it_name'); ?>상품명</a></th>
|
||||
<th scope="col"><?php echo subject_sort_link('iq_subject'); ?>질문</a></th>
|
||||
<th scope="col"><?php echo subject_sort_link('mb_name'); ?>이름</a></th>
|
||||
<th scope="col"><?php echo subject_sort_link('iq_answer'); ?>답변</a></th>
|
||||
<th scope="col">관리</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
$row['iq_subject'] = cut_str($row['iq_subject'], 30, "...");
|
||||
$href = shop_item_url($row['it_id']);
|
||||
$name = get_sideview($row['mb_id'], get_text($row['iq_name']), $row['mb_email'], $row['mb_homepage']);
|
||||
$answer = $row['iq_answer'] ? 'Y' : ' ';
|
||||
$iq_question = get_view_thumbnail(conv_content($row['iq_question'], 1), 300);
|
||||
$iq_answer = $row['iq_answer'] ? get_view_thumbnail(conv_content($row['iq_answer'], 1), 300) : "답변이 등록되지 않았습니다.";
|
||||
|
||||
$bg = 'bg'.($i%2);
|
||||
?>
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td class="td_chk">
|
||||
<label for="chk_<?php echo $i; ?>" class="sound_only"><?php echo get_text($row['iq_subject']) ?> 상품문의</label>
|
||||
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i; ?>">
|
||||
<input type="hidden" name="iq_id[<?php echo $i; ?>]" value="<?php echo $row['iq_id']; ?>">
|
||||
</td>
|
||||
<td class="td_left"><a href="<?php echo $href; ?>"><?php echo get_it_image($row['it_id'], 50, 50); ?> <?php echo cut_str($row['it_name'],30); ?></a></td>
|
||||
<td class="td_left">
|
||||
<a href="#" class="qa_href" onclick="return false;" target="<?php echo $i; ?>"><?php echo get_text($row['iq_subject']); ?> <span class="tit_op">열기</span></a>
|
||||
<div id="qa_div<?php echo $i; ?>" class="qa_div" style="display:none;">
|
||||
<div class="qa_q">
|
||||
<strong>문의내용</strong>
|
||||
|
||||
<?php echo $iq_question; ?>
|
||||
</div>
|
||||
<div class="qa_a">
|
||||
<strong>답변</strong>
|
||||
<?php echo $iq_answer; ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="td_name"><?php echo $name; ?></td>
|
||||
<td class="td_boolean"><?php echo $answer; ?></td>
|
||||
<td class="td_mng td_mng_s">
|
||||
<a href="./itemqaform.php?w=u&iq_id=<?php echo $row['iq_id']; ?>&<?php echo $qstr; ?>" class="btn btn_03"><span class="sound_only"><?php echo get_text($row['iq_subject']); ?> </span>수정</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
if ($i == 0) {
|
||||
echo '<tr><td colspan="6" class="empty_table"><span>자료가 없습니다.</span></td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value" class="btn btn_02">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page="); ?>
|
||||
|
||||
<script>
|
||||
function fitemqalist_submit(f)
|
||||
{
|
||||
if (!is_checked("chk[]")) {
|
||||
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(document.pressed == "선택삭제") {
|
||||
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$(".qa_href").click(function(){
|
||||
var $content = $("#qa_div"+$(this).attr("target"));
|
||||
$(".qa_div").each(function(index, value){
|
||||
if ($(this).get(0) == $content.get(0)) { // 객체의 비교시 .get(0) 를 사용한다.
|
||||
$(this).is(":hidden") ? $(this).show() : $(this).hide();
|
||||
} else {
|
||||
$(this).hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
$sub_menu = '400660';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$count_post_chk = (isset($_POST['chk']) && is_array($_POST['chk'])) ? count($_POST['chk']) : 0;
|
||||
|
||||
if (! $count_post_chk) {
|
||||
alert($_POST['act_button']." 하실 항목을 하나 이상 체크하세요.");
|
||||
}
|
||||
|
||||
if ($_POST['act_button'] == "선택삭제") {
|
||||
|
||||
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;
|
||||
$iiq_id = isset($_POST['iq_id'][$i]) ? (int) $_POST['iq_id'][$k] : 0;
|
||||
|
||||
$sql = "delete from {$g5['g5_shop_item_qa_table']} where iq_id = '{$iiq_id}' ";
|
||||
sql_query($sql);
|
||||
run_event('shop_admin_item_qa_deleted', $iiq_id);
|
||||
}
|
||||
}
|
||||
|
||||
goto_url("./itemqalist.php?sca=$sca&sst=$sst&sod=$sod&sfl=$sfl&stx=$stx&page=$page");
|
||||
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
$sub_menu = '500100';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$g5['title'] = '상품판매순위';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');
|
||||
|
||||
$fr_date = (isset($_GET['fr_date']) && preg_match("/[0-9]/", $_GET['fr_date'])) ? $_GET['fr_date'] : '';
|
||||
$to_date = (isset($_GET['to_date']) && preg_match("/[0-9]/", $_GET['to_date'])) ? $_GET['to_date'] : date("Ymd", time());
|
||||
|
||||
$doc = isset($_GET['doc']) ? clean_xss_tags($_GET['doc'], 1, 1) : '';
|
||||
$sort1 = (isset($_GET['sort1']) && in_array($_GET['sort1'], array('ct_status_1', 'ct_status_2', 'ct_status_3', 'ct_status_4', 'ct_status_5', 'ct_status_6', 'ct_status_7', 'ct_status_8', 'ct_status_9', 'ct_status_sum'))) ? $_GET['sort1'] : 'ct_status_sum';
|
||||
$sort2 = (isset($_GET['sort2']) && in_array($_GET['sort2'], array('desc', 'asc'))) ? $_GET['sort2'] : 'desc';
|
||||
|
||||
$sel_ca_id = isset($_GET['sel_ca_id']) ? get_search_string($_GET['sel_ca_id']) : '';
|
||||
|
||||
$sql = " select a.it_id,
|
||||
b.*,
|
||||
SUM(IF(ct_status = '쇼핑',ct_qty, 0)) as ct_status_1,
|
||||
SUM(IF(ct_status = '주문',ct_qty, 0)) as ct_status_2,
|
||||
SUM(IF(ct_status = '입금',ct_qty, 0)) as ct_status_3,
|
||||
SUM(IF(ct_status = '준비',ct_qty, 0)) as ct_status_4,
|
||||
SUM(IF(ct_status = '배송',ct_qty, 0)) as ct_status_5,
|
||||
SUM(IF(ct_status = '완료',ct_qty, 0)) as ct_status_6,
|
||||
SUM(IF(ct_status = '취소',ct_qty, 0)) as ct_status_7,
|
||||
SUM(IF(ct_status = '반품',ct_qty, 0)) as ct_status_8,
|
||||
SUM(IF(ct_status = '품절',ct_qty, 0)) as ct_status_9,
|
||||
SUM(ct_qty) as ct_status_sum
|
||||
from {$g5['g5_shop_cart_table']} a, {$g5['g5_shop_item_table']} b ";
|
||||
$sql .= " where a.it_id = b.it_id ";
|
||||
if ($fr_date && $to_date)
|
||||
{
|
||||
$fr = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\1-\\2-\\3", $fr_date);
|
||||
$to = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\1-\\2-\\3", $to_date);
|
||||
$sql .= " and ct_time between '$fr 00:00:00' and '$to 23:59:59' ";
|
||||
}
|
||||
if ($sel_ca_id)
|
||||
{
|
||||
$sql .= " and b.ca_id like '$sel_ca_id%' ";
|
||||
}
|
||||
$sql .= " group by a.it_id
|
||||
order by $sort1 $sort2 ";
|
||||
$result = sql_query($sql);
|
||||
$total_count = sql_num_rows($result);
|
||||
|
||||
$rows = $config['cf_page_rows'];
|
||||
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
|
||||
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
|
||||
$from_record = ($page - 1) * $rows; // 시작 열을 구함
|
||||
|
||||
$rank = ($page - 1) * $rows;
|
||||
|
||||
$sql = $sql . " limit $from_record, $rows ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
//$qstr = 'page='.$page.'&sort1='.$sort1.'&sort2='.$sort2;
|
||||
$qstr1 = $qstr.'&fr_date='.$fr_date.'&to_date='.$to_date.'&sel_ca_id='.$sel_ca_id;
|
||||
|
||||
$listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';
|
||||
?>
|
||||
|
||||
<div class="local_ov01 local_ov">
|
||||
<?php echo $listall; ?>
|
||||
<span class="btn_ov01"><span class="ov_txt">등록상품 </span><span class="ov_num"> <?php echo $total_count; ?>건 </span></span>
|
||||
</div>
|
||||
|
||||
<form name="flist" class="local_sch01 local_sch">
|
||||
<input type="hidden" name="doc" value="<?php echo get_sanitize_input($doc); ?>">
|
||||
<input type="hidden" name="sort1" value="<?php echo get_sanitize_input($sort1); ?>">
|
||||
<input type="hidden" name="sort2" value="<?php echo get_sanitize_input($sort2); ?>">
|
||||
<input type="hidden" name="page" value="<?php echo get_sanitize_input($page); ?>">
|
||||
|
||||
<label for="sel_ca_id" class="sound_only">검색대상</label>
|
||||
<select name="sel_ca_id" id="sel_ca_id">
|
||||
<option value=''>전체분류</option>
|
||||
<?php
|
||||
$sql1 = " select ca_id, ca_name from {$g5['g5_shop_category_table']} order by ca_order, ca_id ";
|
||||
$result1 = sql_query($sql1);
|
||||
for ($i=0; $row1=sql_fetch_array($result1); $i++) {
|
||||
$len = strlen($row1['ca_id']) / 2 - 1;
|
||||
$nbsp = "";
|
||||
for ($i=0; $i<$len; $i++) $nbsp .= " ";
|
||||
echo '<option value="'.$row1['ca_id'].'" '.get_selected($sel_ca_id, $row1['ca_id']).'>'.$nbsp.$row1['ca_name'].'</option>'.PHP_EOL;
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
기간설정
|
||||
<label for="fr_date" class="sound_only">시작일</label>
|
||||
<input type="text" name="fr_date" value="<?php echo $fr_date; ?>" id="fr_date" required class="required frm_input" size="8" maxlength="8"> 에서
|
||||
<label for="to_date" class="sound_only">종료일</label>
|
||||
<input type="text" name="to_date" value="<?php echo $to_date; ?>" id="to_date" required class="required frm_input" size="8" maxlength="8"> 까지
|
||||
<input type="submit" value="검색" class="btn_submit">
|
||||
|
||||
</form>
|
||||
|
||||
<div class="local_desc01 local_desc">
|
||||
<p>판매량을 합산하여 상품판매순위를 집계합니다.</p>
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<a href="./itemstocklist.php" class="btn_02 btn">상품재고관리</a>
|
||||
<a href="./itemlist.php" class="btn_01 btn">상품등록</a>
|
||||
</div>
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?> 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">순위</th>
|
||||
<th scope="col">상품명</th>
|
||||
<th scope="col"><a href="<?php echo title_sort("ct_status_1",1)."&$qstr1"; ?>">쇼핑</a></th>
|
||||
<th scope="col"><a href="<?php echo title_sort("ct_status_2",1)."&$qstr1"; ?>">주문</a></th>
|
||||
<th scope="col"><a href="<?php echo title_sort("ct_status_3",1)."&$qstr1"; ?>">입금</a></th>
|
||||
<th scope="col"><a href="<?php echo title_sort("ct_status_4",1)."&$qstr1"; ?>">준비</a></th>
|
||||
<th scope="col"><a href="<?php echo title_sort("ct_status_5",1)."&$qstr1"; ?>">배송</a></th>
|
||||
<th scope="col"><a href="<?php echo title_sort("ct_status_6",1)."&$qstr1"; ?>">완료</a></th>
|
||||
<th scope="col"><a href="<?php echo title_sort("ct_status_7",1)."&$qstr1"; ?>">취소</a></th>
|
||||
<th scope="col"><a href="<?php echo title_sort("ct_status_8",1)."&$qstr1"; ?>">반품</a></th>
|
||||
<th scope="col"><a href="<?php echo title_sort("ct_status_9",1)."&$qstr1"; ?>">품절</a></th>
|
||||
<th scope="col"><a href="<?php echo title_sort("ct_status_sum",1)."&$qstr1"; ?>">합계</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
$href = shop_item_url($row['it_id']);
|
||||
|
||||
$num = $rank + $i + 1;
|
||||
|
||||
$bg = 'bg'.($i%2);
|
||||
?>
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td class="td_num"><?php echo $num; ?></td>
|
||||
<td class="td_left"><a href="<?php echo $href; ?>"><?php echo get_it_image($row['it_id'], 50, 50); ?> <?php echo cut_str($row['it_name'],30); ?></a></td>
|
||||
<td class="td_num"><?php echo $row['ct_status_1']; ?></td>
|
||||
<td class="td_num"><?php echo $row['ct_status_2']; ?></td>
|
||||
<td class="td_num"><?php echo $row['ct_status_3']; ?></td>
|
||||
<td class="td_num"><?php echo $row['ct_status_4']; ?></td>
|
||||
<td class="td_num"><?php echo $row['ct_status_5']; ?></td>
|
||||
<td class="td_num"><?php echo $row['ct_status_6']; ?></td>
|
||||
<td class="td_num"><?php echo $row['ct_status_7']; ?></td>
|
||||
<td class="td_num"><?php echo $row['ct_status_8']; ?></td>
|
||||
<td class="td_num"><?php echo $row['ct_status_9']; ?></td>
|
||||
<td class="td_num"><?php echo $row['ct_status_sum']; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($i == 0) {
|
||||
echo '<tr><td colspan="12" class="empty_table">자료가 없습니다.</td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr1&page="); ?>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$("#fr_date, #to_date").datepicker({
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
dateFormat: "yymmdd",
|
||||
showButtonPanel: true,
|
||||
yearRange: "c-99:c+99",
|
||||
maxDate: "+0d"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,217 @@
|
||||
<?php
|
||||
$sub_menu = '400620';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$doc = isset($_GET['doc']) ? clean_xss_tags($_GET['doc'], 1, 1) : '';
|
||||
$sort1 = (isset($_GET['sort1']) && in_array($_GET['sort1'], array('it_id', 'it_name', 'it_stock_qty', 'it_use', 'it_soldout', 'it_stock_sms'))) ? $_GET['sort1'] : '';
|
||||
$sort2 = (isset($_GET['sort2']) && in_array($_GET['sort2'], array('desc', 'asc'))) ? $_GET['sort2'] : 'desc';
|
||||
$sel_field = (isset($_GET['sel_field']) && in_array($_GET['sel_field'], array('it_id', 'it_name', 'it_stock_qty', 'it_use', 'it_soldout', 'it_stock_sms')) ) ? $_GET['sel_field'] : '';
|
||||
$sel_ca_id = isset($_GET['sel_ca_id']) ? get_search_string($_GET['sel_ca_id']) : '';
|
||||
$search = isset($_GET['search']) ? get_search_string($_GET['search']) : '';
|
||||
|
||||
$g5['title'] = '상품재고관리';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
$sql_search = " where 1 ";
|
||||
if ($search != "") {
|
||||
if ($sel_field != "") {
|
||||
$sql_search .= " and $sel_field like '%$search%' ";
|
||||
}
|
||||
}
|
||||
|
||||
if ($sel_ca_id != "") {
|
||||
$sql_search .= " and ca_id like '$sel_ca_id%' ";
|
||||
}
|
||||
|
||||
if ($sel_field == "") $sel_field = "it_name";
|
||||
if ($sort1 == "") $sort1 = "it_stock_qty";
|
||||
if ($sort2 == "") $sort2 = "asc";
|
||||
|
||||
$sql_common = " from {$g5['g5_shop_item_table']} ";
|
||||
$sql_common .= $sql_search;
|
||||
|
||||
// 테이블의 전체 레코드수만 얻음
|
||||
$sql = " select count(*) as cnt " . $sql_common;
|
||||
$row = sql_fetch($sql);
|
||||
$total_count = isset($row['cnt']) ? $row['cnt'] : 0;
|
||||
|
||||
$rows = $config['cf_page_rows'];
|
||||
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
|
||||
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
|
||||
$from_record = ($page - 1) * $rows; // 시작 열을 구함
|
||||
|
||||
$sql = " select it_id,
|
||||
it_name,
|
||||
it_use,
|
||||
it_stock_qty,
|
||||
it_stock_sms,
|
||||
it_noti_qty,
|
||||
it_soldout,
|
||||
ca_id
|
||||
$sql_common
|
||||
order by $sort1 $sort2
|
||||
limit $from_record, $rows ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
$qstr1 = 'sel_ca_id='.$sel_ca_id.'&sel_field='.$sel_field.'&search='.$search;
|
||||
$qstr = $qstr1.'&sort1='.$sort1.'&sort2='.$sort2.'&page='.$page;
|
||||
|
||||
$listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';
|
||||
?>
|
||||
|
||||
<div class="local_ov01 local_ov">
|
||||
<?php echo $listall; ?>
|
||||
<span class="btn_ov01"><span class="ov_txt">전체 상품</span><span class="ov_num"> <?php echo $total_count; ?>개</span></span>
|
||||
</div>
|
||||
|
||||
<form name="flist" class="local_sch01 local_sch">
|
||||
<input type="hidden" name="doc" value="<?php echo get_sanitize_input($doc); ?>">
|
||||
<input type="hidden" name="sort1" value="<?php echo get_sanitize_input($sort1); ?>">
|
||||
<input type="hidden" name="sort2" value="<?php echo get_sanitize_input($sort2); ?>">
|
||||
<input type="hidden" name="page" value="<?php echo get_sanitize_input($page); ?>">
|
||||
|
||||
<label for="sel_ca_id" class="sound_only">분류선택</label>
|
||||
<select name="sel_ca_id" id="sel_ca_id">
|
||||
<option value=''>전체분류</option>
|
||||
<?php
|
||||
$sql1 = " select ca_id, ca_name from {$g5['g5_shop_category_table']} order by ca_order, ca_id ";
|
||||
$result1 = sql_query($sql1);
|
||||
for ($i=0; $row1=sql_fetch_array($result1); $i++) {
|
||||
$len = strlen($row1['ca_id']) / 2 - 1;
|
||||
$nbsp = "";
|
||||
for ($i=0; $i<$len; $i++) $nbsp .= " ";
|
||||
echo '<option value="'.$row1['ca_id'].'" '.get_selected($sel_ca_id, $row1['ca_id']).'>'.$nbsp.$row1['ca_name'].'</option>'.PHP_EOL;
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
<label for="sel_field" class="sound_only">검색대상</label>
|
||||
<select name="sel_field" id="sel_field">
|
||||
<option value="it_name" <?php echo get_selected($sel_field, 'it_name'); ?>>상품명</option>
|
||||
<option value="it_id" <?php echo get_selected($sel_field, 'it_id'); ?>>상품코드</option>
|
||||
</select>
|
||||
|
||||
<label for="search" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
|
||||
<input type="text" name="search" id="search" value="<?php echo $search; ?>" required class="frm_input required">
|
||||
<input type="submit" value="검색" class="btn_submit">
|
||||
|
||||
</form>
|
||||
|
||||
<div class="local_desc01 local_desc">
|
||||
<p>재고수정의 수치를 수정하시면 창고재고의 수치가 변경됩니다.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<form name="fitemstocklist" action="./itemstocklistupdate.php" method="post">
|
||||
<input type="hidden" name="sort1" value="<?php echo $sort1; ?>">
|
||||
<input type="hidden" name="sort2" value="<?php echo $sort2; ?>">
|
||||
<input type="hidden" name="sel_ca_id" value="<?php echo $sel_ca_id; ?>">
|
||||
<input type="hidden" name="sel_field" value="<?php echo $sel_field; ?>">
|
||||
<input type="hidden" name="search" value="<?php echo $search; ?>">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?> 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><a href="<?php echo title_sort("it_id") . "&$qstr1"; ?>">상품코드</a></th>
|
||||
<th scope="col"><a href="<?php echo title_sort("it_name") . "&$qstr1"; ?>">상품명</a></th>
|
||||
<th scope="col"><a href="<?php echo title_sort("it_stock_qty") . "&$qstr1"; ?>">창고재고</a></th>
|
||||
<th scope="col">주문대기</th>
|
||||
<th scope="col">가재고</th>
|
||||
<th scope="col">재고수정</th>
|
||||
<th scope="col">통보수량</th>
|
||||
<th scope="col"><a href="<?php echo title_sort("it_use") . "&$qstr1"; ?>">판매</a></th>
|
||||
<th scope="col"><a href="<?php echo title_sort("it_soldout") . "&$qstr1"; ?>">품절</a></th>
|
||||
<th scope="col"><a href="<?php echo title_sort("it_stock_sms") . "&$qstr1"; ?>">재입고알림</a></th>
|
||||
<th scope="col">관리</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
$href = shop_item_url($row['it_id']);
|
||||
|
||||
// 선택옵션이 있을 경우 주문대기 수량 계산하지 않음
|
||||
$sql2 = " select count(*) as cnt from {$g5['g5_shop_item_option_table']} where it_id = '{$row['it_id']}' and io_type = '0' and io_use = '1' ";
|
||||
$row2 = sql_fetch($sql2);
|
||||
$wait_qty = 0;
|
||||
|
||||
if(! (isset($row2['cnt']) && $row2['cnt'])) {
|
||||
$sql1 = " select SUM(ct_qty) as sum_qty
|
||||
from {$g5['g5_shop_cart_table']}
|
||||
where it_id = '{$row['it_id']}'
|
||||
and ct_stock_use = '0'
|
||||
and ct_status in ('쇼핑', '주문', '입금', '준비') ";
|
||||
$row1 = sql_fetch($sql1);
|
||||
$wait_qty = $row1['sum_qty'];
|
||||
}
|
||||
|
||||
// 가재고 (미래재고)
|
||||
$temporary_qty = $row['it_stock_qty'] - $wait_qty;
|
||||
|
||||
// 통보수량보다 재고수량이 작을 때
|
||||
$it_stock_qty = number_format($row['it_stock_qty']);
|
||||
$it_stock_qty_st = ''; // 스타일 정의
|
||||
if($row['it_stock_qty'] <= $row['it_noti_qty']) {
|
||||
$it_stock_qty_st = ' sit_stock_qty_alert';
|
||||
}
|
||||
|
||||
$bg = 'bg'.($i%2);
|
||||
|
||||
?>
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td class="td_numbig">
|
||||
<input type="hidden" name="it_id[<?php echo $i; ?>]" value="<?php echo $row['it_id']; ?>">
|
||||
<?php echo $row['it_id']; ?>
|
||||
</td>
|
||||
<td class="td_left"><a href="<?php echo $href; ?>"><?php echo get_it_image($row['it_id'], 50, 50); ?> <?php echo cut_str(stripslashes($row['it_name']), 60, "…"); ?></a></td>
|
||||
<td class="td_num<?php echo $it_stock_qty_st; ?>"><?php echo $it_stock_qty; ?></td>
|
||||
<td class="td_num"><?php echo number_format((float)$wait_qty); ?></td>
|
||||
<td class="td_num"><?php echo number_format((float)$temporary_qty); ?></td>
|
||||
<td class="td_num">
|
||||
<label for="stock_qty_<?php echo $i; ?>" class="sound_only">재고수정</label>
|
||||
<input type="text" name="it_stock_qty[<?php echo $i; ?>]" value="<?php echo $row['it_stock_qty']; ?>" id="stock_qty_<?php echo $i; ?>" class="frm_input" size="10" autocomplete="off">
|
||||
</td>
|
||||
<td class="td_num">
|
||||
<label for="noti_qty_<?php echo $i; ?>" class="sound_only">통보수량</label>
|
||||
<input type="text" name="it_noti_qty[<?php echo $i; ?>]" value="<?php echo $row['it_noti_qty']; ?>" id="noti_qty_<?php echo $i; ?>" class="frm_input" size="10" autocomplete="off">
|
||||
</td>
|
||||
<td class="td_chk2">
|
||||
<label for="use_<?php echo $i; ?>" class="sound_only">판매</label>
|
||||
<input type="checkbox" name="it_use[<?php echo $i; ?>]" value="1" id="use_<?php echo $i; ?>" <?php echo ($row['it_use'] ? "checked" : ""); ?>>
|
||||
</td>
|
||||
<td class="td_chk2">
|
||||
<label for="soldout_<?php echo $i; ?>" class="sound_only">품절</label>
|
||||
<input type="checkbox" name="it_soldout[<?php echo $i; ?>]" value="1" id="soldout_<?php echo $i; ?>" <?php echo ($row['it_soldout'] ? "checked" : ""); ?>>
|
||||
</td>
|
||||
<td class="td_chk2">
|
||||
<label for="stock_sms_<?php echo $i; ?>" class="sound_only">재입고 알림</label>
|
||||
<input type="checkbox" name="it_stock_sms[<?php echo $i; ?>]" value="1" id="stock_sms_<?php echo $i; ?>" <?php echo ($row['it_stock_sms'] ? "checked" : ""); ?>>
|
||||
</td>
|
||||
<td class="td_mng td_mng_s"><a href="./itemform.php?w=u&it_id=<?php echo $row['it_id']; ?>&ca_id=<?php echo $row['ca_id']; ?>&<?php echo $qstr; ?>" class="btn btn_03">수정</a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
if (!$i)
|
||||
echo '<tr><td colspan="11" class="empty_table"><span>자료가 없습니다.</span></td></tr>';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<a href="./optionstocklist.php" class="btn btn_02">상품옵션재고</a>
|
||||
<a href="./itemsellrank.php" class="btn btn_02">상품판매순위</a>
|
||||
<input type="submit" value="일괄수정" class="btn_submit btn">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page="); ?>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
$sub_menu = '400620';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$count_post_it_id = (isset($_POST['it_id']) && is_array($_POST['it_id'])) ? count($_POST['it_id']) : 0;
|
||||
|
||||
$search = isset($_REQUEST['search']) ? get_search_string($_REQUEST['search']) : '';
|
||||
$sort1 = isset($_REQUEST['sort1']) ? clean_xss_tags($_REQUEST['sort1'], 1, 1) : '';
|
||||
$sort2 = isset($_REQUEST['sort2']) ? clean_xss_tags($_REQUEST['sort2'], 1, 1) : '';
|
||||
$sel_ca_id = isset($_REQUEST['sel_ca_id']) ? clean_xss_tags($_REQUEST['sel_ca_id'], 1, 1) : '';
|
||||
$sel_field = isset($_REQUEST['sel_field']) ? clean_xss_tags($_REQUEST['sel_field'], 1, 1) : '';
|
||||
|
||||
// 재고 일괄수정
|
||||
for ($i=0; $i<$count_post_it_id; $i++)
|
||||
{
|
||||
$it_stock_qty = isset($_POST['it_stock_qty'][$i]) ? (int) $_POST['it_stock_qty'][$i] : 0;
|
||||
$it_noti_qty = isset($_POST['it_noti_qty'][$i]) ? (int) $_POST['it_noti_qty'][$i] : 0;
|
||||
$it_use = isset($_POST['it_use'][$i]) ? (int) $_POST['it_use'][$i] : 0;
|
||||
$it_soldout = isset($_POST['it_soldout'][$i]) ? (int) $_POST['it_soldout'][$i] : 0;
|
||||
$it_stock_sms = isset($_POST['it_stock_sms'][$i]) ? (int) $_POST['it_stock_sms'][$i] : 0;
|
||||
$it_id = isset($_POST['it_id'][$i]) ? safe_replace_regex($_POST['it_id'][$i], 'it_id') : '';
|
||||
|
||||
$sql = "update {$g5['g5_shop_item_table']}
|
||||
set it_stock_qty = '".$it_stock_qty."',
|
||||
it_noti_qty = '".$it_noti_qty."',
|
||||
it_use = '".$it_use."',
|
||||
it_soldout = '".$it_soldout."',
|
||||
it_stock_sms = '".$it_stock_sms."'
|
||||
where it_id = '".$it_id."' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
goto_url("./itemstocklist.php?sort1=$sort1&sort2=$sort2&sel_ca_id=$sel_ca_id&sel_field=$sel_field&search=$search&page=$page");
|
||||
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
$sub_menu = '500400';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$g5['title'] = '재입고SMS 알림';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
// 테이블 생성
|
||||
if(!isset($g5['g5_shop_item_stocksms_table']))
|
||||
die('<meta charset="utf-8">dbconfig.php 파일에 <strong>$g5[\'g5_shop_item_stocksms_table\'] = G5_SHOP_TABLE_PREFIX.\'item_stocksms\';</strong> 를 추가해 주세요.');
|
||||
|
||||
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 = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';
|
||||
?>
|
||||
|
||||
<div class="local_ov01 local_ov">
|
||||
<?php echo $listall; ?>
|
||||
<span class="btn_ov01"><span class="ov_txt">전체 </span><span class="ov_num"> <?php echo number_format($total_count); ?>건</span></span>
|
||||
<span class="btn_ov01"><span class="ov_txt">미전송 </span><span class="ov_num"><?php echo number_format($unsend_count); ?>건</span></span>
|
||||
</div>
|
||||
|
||||
<form name="flist" class="local_sch01 local_sch">
|
||||
<input type="hidden" name="doc" value="<?php echo get_sanitize_input($doc); ?>">
|
||||
<input type="hidden" name="sort1" value="<?php echo get_sanitize_input($sort1); ?>">
|
||||
<input type="hidden" name="sort2" value="<?php echo get_sanitize_input($sort2); ?>">
|
||||
<input type="hidden" name="page" value="<?php echo get_sanitize_input($page); ?>">
|
||||
|
||||
<label for="sel_field" class="sound_only">검색대상</label>
|
||||
<select name="sel_field" id="sel_field">
|
||||
<option value="it_id" <?php echo get_selected($sel_field, 'it_id'); ?>>상품코드</option>
|
||||
<option value="ss_hp" <?php echo get_selected($sel_field, 'ss_hp'); ?>>휴대폰번호</option>
|
||||
</select>
|
||||
|
||||
<label for="search" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
|
||||
<input type="text" name="search" id="search" value="<?php echo $search; ?>" required class="frm_input required">
|
||||
<input type="submit" value="검색" class="btn_submit">
|
||||
|
||||
</form>
|
||||
|
||||
<form name="fitemstocksms" action="./itemstocksmsupdate.php" method="post" onsubmit="return fitemstocksms_submit(this);">
|
||||
<input type="hidden" name="sort1" value="<?php echo $sort1; ?>">
|
||||
<input type="hidden" name="sort2" value="<?php echo $sort2; ?>">
|
||||
<input type="hidden" name="sel_field" value="<?php echo $sel_field; ?>">
|
||||
<input type="hidden" name="search" value="<?php echo $search; ?>">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?> 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
<label for="chkall" class="sound_only">알림요청 전체</label>
|
||||
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
|
||||
</th>
|
||||
<th scope="col">상품명</th>
|
||||
<th scope="col">휴대폰번호</th>
|
||||
<th scope="col">SMS전송</th>
|
||||
<th scope="col">SMS전송일시</th>
|
||||
<th scope="col">등록일시</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
// 상품정보
|
||||
$sql = " select it_name from {$g5['g5_shop_item_table']} where it_id = '{$row['it_id']}' ";
|
||||
$it = sql_fetch($sql);
|
||||
|
||||
if($it['it_name'])
|
||||
$it_name = get_text($it['it_name']);
|
||||
else
|
||||
$it_name = '상품정보 없음';
|
||||
|
||||
$bg = 'bg'.($i%2);
|
||||
|
||||
?>
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td class="td_chk">
|
||||
<label for="chk_<?php echo $i; ?>" class="sound_only"><?php echo $it_name; ?> 알림요청</label>
|
||||
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i; ?>">
|
||||
<input type="hidden" name="ss_id[<?php echo $i; ?>]" value="<?php echo $row['ss_id']; ?>">
|
||||
</td>
|
||||
<td class="td_left"><?php echo $it_name; ?></td>
|
||||
<td class="td_telbig"><?php echo $row['ss_hp']; ?></td>
|
||||
<td class="td_stat"><?php echo ($row['ss_send'] ? '전송완료' : '전송전'); ?></td>
|
||||
<td class="td_datetime"><?php echo (is_null_time($row['ss_send_time']) ? '' : $row['ss_send_time']); ?></td>
|
||||
<td class="td_datetime"><?php echo (is_null_time($row['ss_datetime']) ? '' : $row['ss_datetime']); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
if (!$i)
|
||||
echo '<tr><td colspan="6" class="empty_table"><span>자료가 없습니다.</span></td></tr>';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<?php if ($is_admin == 'super') { ?>
|
||||
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value" class="btn btn_02">
|
||||
<?php } ?>
|
||||
<input type="submit" name="act_button" value="선택SMS전송" class="btn_submit btn" onclick="document.pressed=this.value">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page="); ?>
|
||||
|
||||
<script>
|
||||
function fitemstocksms_submit(f)
|
||||
{
|
||||
if (!is_checked("chk[]")) {
|
||||
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(document.pressed == "선택삭제") {
|
||||
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
$sub_menu = '500400';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$count_post_chk = (isset($_POST['chk']) && is_array($_POST['chk'])) ? count($_POST['chk']) : 0;
|
||||
|
||||
if (! $count_post_chk) {
|
||||
alert($_POST['act_button']." 하실 항목을 하나 이상 체크하세요.");
|
||||
}
|
||||
|
||||
if ($_POST['act_button'] == "선택SMS전송") {
|
||||
|
||||
auth_check_menu($auth, $sub_menu, 'w');
|
||||
|
||||
$sms_messages = array();
|
||||
|
||||
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 = " select a.ss_id, a.ss_hp, a.ss_send, b.it_id, b.it_name
|
||||
from {$g5['g5_shop_item_stocksms_table']} a left join {$g5['g5_shop_item_table']} b on ( a.it_id = b.it_id )
|
||||
where a.ss_id = '$ss_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if(!$row['ss_id'] || !$row['it_id'] || $row['ss_send'])
|
||||
continue;
|
||||
|
||||
// SMS
|
||||
if($config['cf_sms_use'] == 'icode') {
|
||||
$sms_contents = get_text($row['it_name']).' 상품이 재입고 되었습니다. '.$default['de_admin_company_name'];
|
||||
$receive_number = preg_replace("/[^0-9]/", "", $row['ss_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);
|
||||
}
|
||||
|
||||
// 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);
|
||||
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$ps_run = false;
|
||||
$post_it_id = isset($_POST['it_id']) ? safe_replace_regex($_POST['it_id'], 'it_id') : '';
|
||||
|
||||
if(isset($it['it_id']) && $it['it_id']) {
|
||||
$sql = " select * from {$g5['g5_shop_item_option_table']} where io_type = '1' and it_id = '{$it['it_id']}' order by io_no asc ";
|
||||
$result = sql_query($sql);
|
||||
if(sql_num_rows($result))
|
||||
$ps_run = true;
|
||||
} else if(!empty($_POST)) {
|
||||
$subject_count = (isset($_POST['subject']) && is_array($_POST['subject'])) ? count($_POST['subject']) : 0;
|
||||
$supply_count = (isset($_POST['supply']) && is_array($_POST['supply'])) ? count($_POST['supply']) : 0;
|
||||
|
||||
if(!$subject_count || !$supply_count) {
|
||||
echo '추가옵션명과 추가옵션항목을 입력해 주십시오.';
|
||||
exit;
|
||||
}
|
||||
|
||||
$ps_run = true;
|
||||
}
|
||||
|
||||
if($ps_run) {
|
||||
?>
|
||||
<div class="sit_option_frm_wrapper">
|
||||
<table>
|
||||
<caption>추가옵션 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
<label for="spl_chk_all" class="sound_only">전체 추가옵션</label>
|
||||
<input type="checkbox" name="spl_chk_all" value="1">
|
||||
</th>
|
||||
<th scope="col">옵션명</th>
|
||||
<th scope="col">옵션항목</th>
|
||||
<th scope="col">상품금액</th>
|
||||
<th scope="col">재고수량</th>
|
||||
<th scope="col">통보수량</th>
|
||||
<th scope="col">사용여부</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
if(isset($it['it_id']) && $it['it_id']) {
|
||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
$spl_id = $row['io_id'];
|
||||
$spl_val = explode(chr(30), $spl_id);
|
||||
$spl_subject = $spl_val[0];
|
||||
$spl = $spl_val[1];
|
||||
$spl_price = $row['io_price'];
|
||||
$spl_stock_qty = $row['io_stock_qty'];
|
||||
$spl_noti_qty = $row['io_noti_qty'];
|
||||
$spl_use = $row['io_use'];
|
||||
?>
|
||||
<tr>
|
||||
<td class="td_chk">
|
||||
<input type="hidden" name="spl_id[]" value="<?php echo $spl_id; ?>">
|
||||
<label for="spl_chk_<?php echo $i; ?>" class="sound_only"><?php echo $spl_subject.' '.$spl; ?></label>
|
||||
<input type="checkbox" name="spl_chk[]" id="spl_chk_<?php echo $i; ?>" value="1">
|
||||
</td>
|
||||
<td class="spl-subject-cell"><?php echo $spl_subject; ?></td>
|
||||
<td class="spl-cell"><?php echo $spl; ?></td>
|
||||
<td class="td_numsmall">
|
||||
<label for="spl_price_<?php echo $i; ?>" class="sound_only">상품금액</label>
|
||||
<input type="text" name="spl_price[]" value="<?php echo $spl_price; ?>" id="spl_price_<?php echo $i; ?>" class="frm_input" size="5">
|
||||
</td>
|
||||
<td class="td_num">
|
||||
<label for="spl_stock_qty_<?php echo $i; ?>" class="sound_only">재고수량</label>
|
||||
<input type="text" name="spl_stock_qty[]" value="<?php echo $spl_stock_qty; ?>" id="spl_stock_qty_<?php echo $i; ?>" class="frm_input" size="5">
|
||||
</td>
|
||||
<td class="td_num">
|
||||
<label for="spl_noti_qty_<?php echo $i; ?>" class="sound_only">통보수량</label>
|
||||
<input type="text" name="spl_noti_qty[]" value="<?php echo $spl_noti_qty; ?>" id="spl_noti_qty_<?php echo $i; ?>" class="frm_input" size="5">
|
||||
</td>
|
||||
<td class="td_mng">
|
||||
<label for="spl_use_<?php echo $i; ?>" class="sound_only">사용여부</label>
|
||||
<select name="spl_use[]" id="spl_use_<?php echo $i; ?>">
|
||||
<option value="1" <?php echo get_selected('1', $spl_use); ?>>사용함</option>
|
||||
<option value="0" <?php echo get_selected('0', $spl_use); ?>>사용안함</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
} // for
|
||||
} else {
|
||||
for($i=0; $i<$subject_count; $i++) {
|
||||
$spl_subject = isset($_POST['subject'][$i]) ? preg_replace(G5_OPTION_ID_FILTER, '', strip_tags(trim(stripslashes($_POST['subject'][$i])))) : '';
|
||||
$spl_val = isset($_POST['supply'][$i]) ? explode(',', preg_replace(G5_OPTION_ID_FILTER, '', trim(stripslashes($_POST['supply'][$i])))) : '';
|
||||
$spl_count = count($spl_val);
|
||||
|
||||
for($j=0; $j<$spl_count; $j++) {
|
||||
$spl = isset($spl_val[$j]) ? strip_tags(trim($spl_val[$j])) : '';
|
||||
if($spl_subject && strlen($spl)) {
|
||||
$spl_id = $spl_subject.chr(30).$spl;
|
||||
$spl_price = 0;
|
||||
$spl_stock_qty = 9999;
|
||||
$spl_noti_qty = 100;
|
||||
$spl_use = 1;
|
||||
|
||||
// 기존에 설정된 값이 있는지 체크
|
||||
if(isset($_POST['w']) && $_POST['w'] === 'u') {
|
||||
$sql = " select io_price, io_stock_qty, io_noti_qty, io_use
|
||||
from {$g5['g5_shop_item_option_table']}
|
||||
where it_id = '{$post_it_id}'
|
||||
and io_id = '".sql_real_escape_string($spl_id)."'
|
||||
and io_type = '1' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if($row) {
|
||||
$spl_price = (int)$row['io_price'];
|
||||
$spl_stock_qty = (int)$row['io_stock_qty'];
|
||||
$spl_noti_qty = (int)$row['io_noti_qty'];
|
||||
$spl_use = (int)$row['io_use'];
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td class="td_chk">
|
||||
<input type="hidden" name="spl_id[]" value="<?php echo get_text($spl_id); ?>">
|
||||
<label for="spl_chk_<?php echo $i; ?>" class="sound_only"><?php echo get_text($spl_subject.' '.$spl); ?></label>
|
||||
<input type="checkbox" name="spl_chk[]" id="spl_chk_<?php echo $i; ?>" value="1">
|
||||
</td>
|
||||
<td class="spl-subject-cell"><?php echo get_text($spl_subject); ?></td>
|
||||
<td class="spl-cell"><?php echo $spl; ?></td>
|
||||
<td class="td_numsmall">
|
||||
<label for="spl_price_<?php echo $i; ?>" class="sound_only">상품금액</label>
|
||||
<input type="text" name="spl_price[]" value="<?php echo $spl_price; ?>" id="spl_price_<?php echo $i; ?>" class="frm_input" size="9">
|
||||
</td>
|
||||
<td class="td_num">
|
||||
<label for="spl_stock_qty_<?php echo $i; ?>" class="sound_only">재고수량</label>
|
||||
<input type="text" name="spl_stock_qty[]" value="<?php echo $spl_stock_qty; ?>" id="spl_stock_qty_<?php echo $i; ?>" class="frm_input" size="5">
|
||||
</td>
|
||||
<td class="td_num">
|
||||
<label for="spl_noti_qty_<?php echo $i; ?>" class="sound_only">통보수량</label>
|
||||
<input type="text" name="spl_noti_qty[]" value="<?php echo $spl_noti_qty; ?>" id="spl_noti_qty_<?php echo $i; ?>" class="frm_input" size="5">
|
||||
</td>
|
||||
<td class="td_mng">
|
||||
<label for="spl_use_<?php echo $i; ?>" class="sound_only">사용여부</label>
|
||||
<select name="spl_use[]" id="spl_use_<?php echo $i; ?>">
|
||||
<option value="1" <?php echo get_selected('1', $spl_use); ?>>사용함</option>
|
||||
<option value="0" <?php echo get_selected('0', $spl_use); ?>>사용안함</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
} // if
|
||||
} // for
|
||||
} // for
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_list01 btn_list">
|
||||
<button type="button" id="sel_supply_delete" class="btn btn_02">선택삭제</button>
|
||||
</div>
|
||||
|
||||
<fieldset>
|
||||
<?php echo help('전체 추가 옵션의 상품금액, 재고/통보수량 및 사용여부를 일괄 적용할 수 있습니다. 단, 체크된 수정항목만 일괄 적용됩니다.'); ?>
|
||||
<label for="spl_com_price">상품금액</label>
|
||||
<label for="spl_com_price_chk" class="sound_only">상품금액일괄수정</label><input type="checkbox" name="spl_com_price_chk" value="1" id="spl_com_price_chk" class="spl_com_chk">
|
||||
<input type="text" name="spl_com_price" value="0" id="spl_com_price" class="frm_input" size="9">
|
||||
<label for="spl_com_stock">재고수량</label>
|
||||
<label for="spl_com_stock_chk" class="sound_only">재고수량일괄수정</label><input type="checkbox" name="spl_com_stock_chk" value="1" id="spl_com_stock_chk" class="spl_com_chk">
|
||||
<input type="text" name="spl_com_stock" value="0" id="spl_com_stock" class="frm_input" size="5">
|
||||
<label for="spl_com_noti">통보수량</label>
|
||||
<label for="spl_com_noti_chk" class="sound_only">통보수량일괄수정</label><input type="checkbox" name="spl_com_noti_chk" value="1" id="spl_com_noti_chk" class="spl_com_chk">
|
||||
<input type="text" name="spl_com_noti" value="0" id="spl_com_noti" class="frm_input" size="5">
|
||||
<label for="spl_com_use">사용여부</label>
|
||||
<label for="spl_com_use_chk" class="sound_only">사용여부일괄수정</label><input type="checkbox" name="spl_com_use_chk" value="1" id="spl_com_use_chk" class="spl_com_chk">
|
||||
<select name="spl_com_use" id="spl_com_use">
|
||||
<option value="1">사용함</option>
|
||||
<option value="0">사용안함</option>
|
||||
</select>
|
||||
<button type="button" id="spl_value_apply" class="btn_frmline">일괄적용</button>
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
<?php
|
||||
$sub_menu = '400610';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$doc = isset($_GET['doc']) ? clean_xss_tags($_GET['doc'], 1, 1) : '';
|
||||
$sfl = in_array($sfl, array('it_name', 'it_id')) ? $sfl : '';
|
||||
|
||||
$g5['title'] = '상품유형관리';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
/*
|
||||
$sql_search = " where 1 ";
|
||||
if ($search != "") {
|
||||
if ($sel_field != "") {
|
||||
$sql_search .= " and $sel_field like '%$search%' ";
|
||||
}
|
||||
}
|
||||
|
||||
if ($sel_ca_id != "") {
|
||||
$sql_search .= " and (ca_id like '$sel_ca_id%' or ca_id2 like '$sel_ca_id%' or ca_id3 like '$sel_ca_id%') ";
|
||||
}
|
||||
|
||||
if ($sel_field == "") $sel_field = "it_name";
|
||||
*/
|
||||
|
||||
$where = " where ";
|
||||
$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 (ca_id like '$sca%' or ca_id2 like '$sca%' or ca_id3 like '$sca%') ";
|
||||
}
|
||||
|
||||
if ($sfl == "") $sfl = "it_name";
|
||||
|
||||
if (!$sst) {
|
||||
$sst = "it_id";
|
||||
$sod = "desc";
|
||||
}
|
||||
$sql_order = "order by $sst $sod";
|
||||
|
||||
$sql_common = " from {$g5['g5_shop_item_table']} ";
|
||||
$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; // 시작 열을 구함
|
||||
|
||||
$sql = " select it_id,
|
||||
it_name,
|
||||
it_type1,
|
||||
it_type2,
|
||||
it_type3,
|
||||
it_type4,
|
||||
it_type5,
|
||||
ca_id
|
||||
$sql_common
|
||||
$sql_order
|
||||
limit $from_record, $rows ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
$qstr = $qstr.'&sca='.$sca.'&page='.$page.'&save_stx='.$stx;
|
||||
|
||||
$listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';
|
||||
?>
|
||||
|
||||
<div class="local_ov01 local_ov">
|
||||
<?php echo $listall; ?>
|
||||
<span class="btn_ov01"><span class="ov_txt">전체 상품</span><span class="ov_num"> <?php echo $total_count; ?>개</span></span>
|
||||
</div>
|
||||
|
||||
<form name="flist" class="local_sch01 local_sch">
|
||||
<input type="hidden" name="doc" value="<?php echo get_sanitize_input($doc); ?>">
|
||||
<input type="hidden" name="page" value="<?php echo get_sanitize_input($page); ?>">
|
||||
|
||||
<label for="sca" class="sound_only">분류선택</label>
|
||||
<select name="sca" id="sca">
|
||||
<option value="">전체분류</option>
|
||||
<?php
|
||||
$sql1 = " select ca_id, ca_name from {$g5['g5_shop_category_table']} order by ca_order, ca_id ";
|
||||
$result1 = sql_query($sql1);
|
||||
for ($i=0; $row1=sql_fetch_array($result1); $i++) {
|
||||
$len = strlen($row1['ca_id']) / 2 - 1;
|
||||
$nbsp = "";
|
||||
for ($i=0; $i<$len; $i++) $nbsp .= " ";
|
||||
echo '<option value="'.$row1['ca_id'].'" '.get_selected($sca, $row1['ca_id']).'>'.$nbsp.$row1['ca_name'].PHP_EOL;
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
<label for="sfl" class="sound_only">검색대상</label>
|
||||
<select name="sfl" id="sfl">
|
||||
<option value="it_name" <?php echo get_selected($sfl, 'it_name'); ?>>상품명</option>
|
||||
<option value="it_id" <?php echo get_selected($sfl, 'it_id'); ?>>상품코드</option>
|
||||
</select>
|
||||
|
||||
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
|
||||
<input type="text" name="stx" value="<?php echo $stx; ?>" id="stx" required class="frm_input required">
|
||||
<input type="submit" value="검색" class="btn_submit">
|
||||
|
||||
</form>
|
||||
|
||||
<form name="fitemtypelist" method="post" action="./itemtypelistupdate.php">
|
||||
<input type="hidden" name="sca" value="<?php echo $sca; ?>">
|
||||
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
|
||||
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
|
||||
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
|
||||
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?> 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php echo subject_sort_link("it_id", $qstr, 1); ?>상품코드</a></th>
|
||||
<th scope="col"><?php echo subject_sort_link("it_name"); ?>상품명</a></th>
|
||||
<th scope="col"><?php echo subject_sort_link("it_type1", $qstr, 1); ?>히트<br>상품</a></th>
|
||||
<th scope="col"><?php echo subject_sort_link("it_type2", $qstr, 1); ?>추천<br>상품</a></th>
|
||||
<th scope="col"><?php echo subject_sort_link("it_type3", $qstr, 1); ?>신규<br>상품</a></th>
|
||||
<th scope="col"><?php echo subject_sort_link("it_type4", $qstr, 1); ?>인기<br>상품</a></th>
|
||||
<th scope="col"><?php echo subject_sort_link("it_type5", $qstr, 1); ?>할인<br>상품</a></th>
|
||||
<th scope="col">관리</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
$href = shop_item_url($row['it_id']);
|
||||
|
||||
$bg = 'bg'.($i%2);
|
||||
?>
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td class="td_code">
|
||||
<input type="hidden" name="it_id[<?php echo $i; ?>]" value="<?php echo $row['it_id']; ?>">
|
||||
<?php echo $row['it_id']; ?>
|
||||
</td>
|
||||
<td class="td_left"><a href="<?php echo $href; ?>"><?php echo get_it_image($row['it_id'], 50, 50); ?><?php echo cut_str(stripslashes($row['it_name']), 60, "…"); ?></a></td>
|
||||
<td class="td_chk2">
|
||||
<label for="type1_<?php echo $i; ?>" class="sound_only">히트상품</label>
|
||||
<input type="checkbox" name="it_type1[<?php echo $i; ?>]" value="1" id="type1_<?php echo $i; ?>" <?php echo ($row['it_type1'] ? 'checked' : ''); ?>>
|
||||
</td>
|
||||
<td class="td_chk2">
|
||||
<label for="type2_<?php echo $i; ?>" class="sound_only">추천상품</label>
|
||||
<input type="checkbox" name="it_type2[<?php echo $i; ?>]" value="1" id="type2_<?php echo $i; ?>" <?php echo ($row['it_type2'] ? 'checked' : ''); ?>>
|
||||
</td>
|
||||
<td class="td_chk2">
|
||||
<label for="type3_<?php echo $i; ?>" class="sound_only">신규상품</label>
|
||||
<input type="checkbox" name="it_type3[<?php echo $i; ?>]" value="1" id="type3_<?php echo $i; ?>" <?php echo ($row['it_type3'] ? 'checked' : ''); ?>>
|
||||
</td>
|
||||
<td class="td_chk2">
|
||||
<label for="type4_<?php echo $i; ?>" class="sound_only">인기상품</label>
|
||||
<input type="checkbox" name="it_type4[<?php echo $i; ?>]" value="1" id="type4_<?php echo $i; ?>" <?php echo ($row['it_type4'] ? 'checked' : ''); ?>>
|
||||
</td>
|
||||
<td class="td_chk2">
|
||||
<label for="type5_<?php echo $i; ?>" class="sound_only">할인상품</label>
|
||||
<input type="checkbox" name="it_type5[<?php echo $i; ?>]" value="1" id="type5_<?php echo $i; ?>" <?php echo ($row['it_type5'] ? 'checked' : ''); ?>>
|
||||
</td>
|
||||
<td class="td_mng td_mng_s">
|
||||
<a href="./itemform.php?w=u&it_id=<?php echo $row['it_id']; ?>&ca_id=<?php echo $row['ca_id']; ?>&<?php echo $qstr; ?>" class="btn btn_03"><span class="sound_only"><?php echo cut_str(stripslashes($row['it_name']), 60, "…"); ?> </span>수정</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
if (!$i)
|
||||
echo '<tr><td colspan="8" class="empty_table"><span>자료가 없습니다.</span></td></tr>';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_confirm03 btn_confirm">
|
||||
<input type="submit" value="일괄수정" class="btn_submit">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page="); ?>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
$sub_menu = '400610';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$count_post_it_id = (isset($_POST['it_id']) && is_array($_POST['it_id'])) ? count($_POST['it_id']) : 0;
|
||||
|
||||
for ($i=0; $i<$count_post_it_id; $i++)
|
||||
{
|
||||
$it_type1 = isset($_POST['it_type1'][$i]) ? (int) $_POST['it_type1'][$i] : 0;
|
||||
$it_type2 = isset($_POST['it_type2'][$i]) ? (int) $_POST['it_type2'][$i] : 0;
|
||||
$it_type3 = isset($_POST['it_type3'][$i]) ? (int) $_POST['it_type3'][$i] : 0;
|
||||
$it_type4 = isset($_POST['it_type4'][$i]) ? (int) $_POST['it_type4'][$i] : 0;
|
||||
$it_type5 = isset($_POST['it_type5'][$i]) ? (int) $_POST['it_type5'][$i] : 0;
|
||||
|
||||
$it_id = isset($_POST['it_id'][$i]) ? safe_replace_regex($_POST['it_id'][$i], 'it_id') : '';
|
||||
|
||||
$sql = "update {$g5['g5_shop_item_table']}
|
||||
set it_type1 = '".$it_type1."',
|
||||
it_type2 = '".$it_type2."',
|
||||
it_type3 = '".$it_type3."',
|
||||
it_type4 = '".$it_type4."',
|
||||
it_type5 = '".$it_type5."'
|
||||
where it_id = '".$it_id."' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
goto_url("itemtypelist.php?sca=$sca&sst=$sst&sod=$sod&sfl=$sfl&stx=$stx&page=$page");
|
||||
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
$sub_menu = '400650';
|
||||
include_once('./_common.php');
|
||||
include_once(G5_EDITOR_LIB);
|
||||
|
||||
$is_id = isset($_GET['is_id']) ? preg_replace('/[^0-9]/', '', $_GET['is_id']) : 0;
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
$sql = " select *
|
||||
from {$g5['g5_shop_item_use_table']} a
|
||||
left join {$g5['member_table']} b on (a.mb_id = b.mb_id)
|
||||
left join {$g5['g5_shop_item_table']} c on (a.it_id = c.it_id)
|
||||
where is_id = '$is_id' ";
|
||||
$is = sql_fetch($sql);
|
||||
|
||||
if (!$is['is_id'])
|
||||
alert('등록된 자료가 없습니다.');
|
||||
|
||||
// 사용후기 의 답변 필드 추가
|
||||
if (!isset($is['is_reply_subject'])) {
|
||||
sql_query(" ALTER TABLE `{$g5['g5_shop_item_use_table']}`
|
||||
ADD COLUMN `is_reply_subject` VARCHAR(255) NOT NULL DEFAULT '' AFTER `is_confirm`,
|
||||
ADD COLUMN `is_reply_content` TEXT NOT NULL AFTER `is_reply_subject`,
|
||||
ADD COLUMN `is_reply_name` VARCHAR(25) NOT NULL DEFAULT '' AFTER `is_reply_content`
|
||||
", true);
|
||||
}
|
||||
|
||||
//$name = get_sideview($is['mb_id'], get_text($is['is_name']), $is['mb_email'], $is['mb_homepage'])
|
||||
$name = get_text($is['is_name']);
|
||||
|
||||
// 확인
|
||||
$is_confirm_yes = $is['is_confirm'] ? 'checked="checked"' : '';
|
||||
$is_confirm_no = !$is['is_confirm'] ? 'checked="checked"' : '';
|
||||
|
||||
$g5['title'] = '사용후기';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
$qstr .= ($qstr ? '&' : '').'sca='.$sca;
|
||||
?>
|
||||
|
||||
<form name="fitemuseform" method="post" action="./itemuseformupdate.php" onsubmit="return fitemuseform_submit(this);">
|
||||
<input type="hidden" name="w" value="<?php echo $w; ?>">
|
||||
<input type="hidden" name="is_id" value="<?php echo $is_id; ?>">
|
||||
<input type="hidden" name="it_id" value="<?php echo $is['it_id']; ?>">
|
||||
<input type="hidden" name="sca" value="<?php echo $sca; ?>">
|
||||
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
|
||||
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
|
||||
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
|
||||
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
|
||||
<!-- 20250612 리빌더 { -->
|
||||
<input type="hidden" name="mb_id" value="<?php echo $is['mb_id']; ?>">
|
||||
<input type="hidden" name="it_name" value="<?php echo $is['it_name']; ?>">
|
||||
<!-- } -->
|
||||
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?> 수정</caption>
|
||||
<colgroup>
|
||||
<col class="grid_4">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">상품명</th>
|
||||
<td><a href="<?php echo shop_item_url($is['it_id']); ?>"><?php echo $is['it_name']; ?></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">이름</th>
|
||||
<td><?php echo $name; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">평점</th>
|
||||
<td><img src="<?php echo G5_URL; ?>/shop/img/s_star<?php echo $is['is_score']; ?>.png" width="100"> (<?php echo $is['is_score']; ?>점)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="is_subject">제목</label></th>
|
||||
<td><input type="text" name="is_subject" required class="required frm_input" id="is_subject" size="100"
|
||||
value="<?php echo get_text($is['is_subject']); ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">내용</th>
|
||||
<td><?php echo editor_html('is_content', get_text(html_purifier($is['is_content']), 0)); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="is_reply_subject">답변 제목</label></th>
|
||||
<td><input type="text" name="is_reply_subject" class="frm_input" id="is_reply_subject" size="100"
|
||||
value="<?php echo isset($is['is_reply_subject']) ? get_text($is['is_reply_subject']) : ''; ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">답변 내용</th>
|
||||
<td><?php echo editor_html('is_reply_content', get_text(html_purifier(isset($is['is_reply_content']) ? $is['is_reply_content'] : ''), 0)); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">확인</th>
|
||||
<td>
|
||||
<input type="radio" name="is_confirm" value="1" id="is_confirm_yes" <?php echo $is_confirm_yes; ?>>
|
||||
<label for="is_confirm_yes">예</label>
|
||||
<input type="radio" name="is_confirm" value="0" id="is_confirm_no" <?php echo $is_confirm_no; ?>>
|
||||
<label for="is_confirm_no">아니오</label>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<a href="./itemuselist.php?<?php echo $qstr; ?>" class="btn_02 btn">목록</a>
|
||||
<input type="submit" value="확인" class="btn_submit btn" accesskey="s">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
function fitemuseform_submit(f)
|
||||
{
|
||||
<?php echo get_editor_js('is_content'); ?>
|
||||
<?php echo get_editor_js('is_reply_content'); ?>
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
$sub_menu = '400650';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
|
||||
if ($w == 'd')
|
||||
auth_check_menu($auth, $sub_menu, "d");
|
||||
else
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$posts = array();
|
||||
$check_keys = array('is_subject', 'is_content', 'is_confirm', 'is_reply_subject', 'is_reply_content', 'is_id');
|
||||
|
||||
foreach($check_keys as $key){
|
||||
|
||||
if( in_array($key, array('is_content', 'is_reply_content')) ){
|
||||
$posts[$key] = isset($_POST[$key]) ? $_POST[$key] : '';
|
||||
} else {
|
||||
$posts[$key] = isset($_POST[$key]) ? clean_xss_tags($_POST[$key], 1, 1) : '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($w == "u")
|
||||
{
|
||||
$sql = "update {$g5['g5_shop_item_use_table']}
|
||||
set is_subject = '".$posts['is_subject']."',
|
||||
is_content = '".$posts['is_content']."',
|
||||
is_confirm = '".$posts['is_confirm']."',
|
||||
is_reply_subject = '".$posts['is_reply_subject']."',
|
||||
is_reply_content = '".$posts['is_reply_content']."',
|
||||
is_reply_name = '".$member['mb_nick']."'
|
||||
where is_id = '".$posts['is_id']."'";
|
||||
sql_query($sql);
|
||||
run_event('shop_admin_item_use_updated', $posts['is_id']);
|
||||
|
||||
if( isset($_POST['it_id']) ) {
|
||||
update_use_cnt($_POST['it_id']);
|
||||
update_use_avg($_POST['it_id']);
|
||||
}
|
||||
|
||||
/* 20250612 리빌더 { */
|
||||
if ($posts['is_confirm'] == 1) {
|
||||
|
||||
if($_POST['mb_id']) {
|
||||
|
||||
$od_al = "[".$_POST['it_name']."] 상품 구매후기에 답변이 등록 되었습니다.";
|
||||
memo_auto_send($od_al, shop_item_url($_POST['it_id']), $_POST['mb_id'], "system-msg");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/* } */
|
||||
|
||||
goto_url("./itemuseform.php?w=$w&is_id=$is_id&sca=$sca&$qstr");
|
||||
}
|
||||
else
|
||||
{
|
||||
alert();
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
<?php
|
||||
$sub_menu = '400650';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
if (isset($sfl) && $sfl && !in_array($sfl, array('it_name','a.it_id','is_name'))) {
|
||||
$sfl = '';
|
||||
}
|
||||
|
||||
$g5['title'] = '사용후기';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
$where = " where ";
|
||||
$sql_search = "";
|
||||
$save_stx = isset($_REQUEST['save_stx']) ? clean_xss_tags($_REQUEST['save_stx'], 1, 1) : '';
|
||||
|
||||
if ($stx != "") {
|
||||
if ($sfl != "") {
|
||||
$sql_search .= " $where $sfl like '%$stx%' ";
|
||||
$where = " and ";
|
||||
}
|
||||
if ($save_stx != $stx)
|
||||
$page = 1;
|
||||
}
|
||||
|
||||
if ($sca != "") {
|
||||
$sql_search .= " and ca_id like '$sca%' ";
|
||||
}
|
||||
|
||||
if ($sfl == "") $sfl = "a.it_name";
|
||||
if (!$sst) {
|
||||
$sst = "is_id";
|
||||
$sod = "desc";
|
||||
}
|
||||
|
||||
$sql_common = " from {$g5['g5_shop_item_use_table']} a
|
||||
left join {$g5['g5_shop_item_table']} b on (a.it_id = b.it_id)
|
||||
left join {$g5['member_table']} c on (a.mb_id = c.mb_id) ";
|
||||
$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; // 시작 열을 구함
|
||||
|
||||
$sql = " select *
|
||||
$sql_common
|
||||
order by $sst $sod, is_id desc
|
||||
limit $from_record, $rows ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
//$qstr = 'page='.$page.'&sst='.$sst.'&sod='.$sod.'&stx='.$stx;
|
||||
$qstr .= ($qstr ? '&' : '').'sca='.$sca.'&save_stx='.$stx;
|
||||
|
||||
$listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';
|
||||
?>
|
||||
|
||||
<div class="local_ov01 local_ov">
|
||||
<?php echo $listall; ?>
|
||||
<span class="btn_ov01"><span class="ov_txt"> 전체 후기내역</span><span class="ov_num"> <?php echo $total_count; ?>건</span></span>
|
||||
</div>
|
||||
|
||||
<form name="flist" class="local_sch01 local_sch">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
<input type="hidden" name="save_stx" value="<?php echo $stx; ?>">
|
||||
|
||||
<label for="sca" class="sound_only">분류선택</label>
|
||||
<select name="sca" id="sca">
|
||||
<option value=''>전체분류</option>
|
||||
<?php
|
||||
$sql1 = " select ca_id, ca_name from {$g5['g5_shop_category_table']} order by ca_order, ca_id ";
|
||||
$result1 = sql_query($sql1);
|
||||
for ($i=0; $row1=sql_fetch_array($result1); $i++) {
|
||||
$len = strlen($row1['ca_id']) / 2 - 1;
|
||||
$nbsp = "";
|
||||
for ($i=0; $i<$len; $i++) $nbsp .= " ";
|
||||
$selected = ($row1['ca_id'] == $sca) ? ' selected="selected"' : '';
|
||||
echo '<option value="'.$row1['ca_id'].'"'.$selected.'>'.$nbsp.$row1['ca_name'].'</option>'.PHP_EOL;
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
<label for="sfl" class="sound_only">검색대상</label>
|
||||
<select name="sfl" id="sfl">
|
||||
<option value="it_name" <?php echo get_selected($sfl, 'it_name'); ?>>상품명</option>
|
||||
<option value="a.it_id" <?php echo get_selected($sfl, 'a.it_id'); ?>>상품코드</option>
|
||||
<option value="is_name" <?php echo get_selected($sfl, 'is_name'); ?>>이름</option>
|
||||
</select>
|
||||
|
||||
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
|
||||
<input type="text" name="stx" id="stx" value="<?php echo $stx; ?>" required class="frm_input required">
|
||||
<input type="submit" value="검색" class="btn_submit">
|
||||
|
||||
</form>
|
||||
|
||||
<form name="fitemuselist" method="post" action="./itemuselistupdate.php" onsubmit="return fitemuselist_submit(this);" autocomplete="off">
|
||||
<input type="hidden" name="sca" value="<?php echo $sca; ?>">
|
||||
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
|
||||
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
|
||||
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
|
||||
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
|
||||
<div class="tbl_head01 tbl_wrap" id="itemuselist">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?> 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
<label for="chkall" class="sound_only">사용후기 전체</label>
|
||||
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
|
||||
</th>
|
||||
<th scope="col"><?php echo subject_sort_link("it_name"); ?>상품명</a></th>
|
||||
<th scope="col"><?php echo subject_sort_link("mb_name"); ?>이름</a></th>
|
||||
<th scope="col"><?php echo subject_sort_link("is_subject"); ?>제목</a></th>
|
||||
<th scope="col"><?php echo subject_sort_link("is_score"); ?>평점</a></th>
|
||||
<th scope="col"><?php echo subject_sort_link("is_confirm"); ?>확인</a></th>
|
||||
<th scope="col">관리</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
$href = shop_item_url($row['it_id']);
|
||||
$name = get_sideview($row['mb_id'], get_text($row['is_name']), $row['mb_email'], $row['mb_homepage']);
|
||||
$is_content = get_view_thumbnail(conv_content($row['is_content'], 1), 300);
|
||||
|
||||
$bg = 'bg'.($i%2);
|
||||
?>
|
||||
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td class="td_chk">
|
||||
<label for="chk_<?php echo $i; ?>" class="sound_only"><?php echo get_text($row['is_subject']) ?> 사용후기</label>
|
||||
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i; ?>">
|
||||
<input type="hidden" name="is_id[<?php echo $i; ?>]" value="<?php echo $row['is_id']; ?>">
|
||||
<input type="hidden" name="it_id[<?php echo $i; ?>]" value="<?php echo $row['it_id']; ?>">
|
||||
</td>
|
||||
<td class="td_left"><a href="<?php echo $href; ?>"><?php echo get_it_image($row['it_id'], 50, 50); ?><?php echo cut_str($row['it_name'],30); ?></a></td>
|
||||
<td class="td_name"><?php echo $name; ?></td>
|
||||
<td class="sit_use_subject td_left">
|
||||
<a href="#" class="use_href" onclick="return false;" target="<?php echo $i; ?>"><?php echo get_text($row['is_subject']); ?><span class="tit_op">열기</span></a>
|
||||
<div id="use_div<?php echo $i; ?>" class="use_div" style="display:none;">
|
||||
<?php echo $is_content; ?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="td_select">
|
||||
<label for="score_<?php echo $i; ?>" class="sound_only">평점</label>
|
||||
<select name="is_score[<?php echo $i; ?>]" id="score_<?php echo $i; ?>">
|
||||
<option value="5" <?php echo get_selected($row['is_score'], "5"); ?>>매우만족</option>
|
||||
<option value="4" <?php echo get_selected($row['is_score'], "4"); ?>>만족</option>
|
||||
<option value="3" <?php echo get_selected($row['is_score'], "3"); ?>>보통</option>
|
||||
<option value="2" <?php echo get_selected($row['is_score'], "2"); ?>>불만</option>
|
||||
<option value="1" <?php echo get_selected($row['is_score'], "1"); ?>>매우불만</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="td_chk2">
|
||||
<label for="confirm_<?php echo $i; ?>" class="sound_only">확인</label>
|
||||
<input type="checkbox" name="is_confirm[<?php echo $i; ?>]" <?php echo ($row['is_confirm'] ? 'checked' : ''); ?> value="1" id="confirm_<?php echo $i; ?>">
|
||||
</td>
|
||||
<td class="td_mng td_mng_s">
|
||||
<a href="./itemuseform.php?w=u&is_id=<?php echo $row['is_id']; ?>&<?php echo $qstr; ?>" class="btn btn_03"><span class="sound_only"><?php echo get_text($row['is_subject']); ?> </span>수정</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($i == 0) {
|
||||
echo '<tr><td colspan="7" class="empty_table">자료가 없습니다.</td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<input type="submit" name="act_button" value="선택수정" onclick="document.pressed=this.value" class="btn btn_02">
|
||||
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value" class="btn btn_02">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page="); ?>
|
||||
|
||||
<script>
|
||||
function fitemuselist_submit(f)
|
||||
{
|
||||
if (!is_checked("chk[]")) {
|
||||
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(document.pressed == "선택삭제") {
|
||||
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$(".use_href").click(function(){
|
||||
var $content = $("#use_div"+$(this).attr("target"));
|
||||
$(".use_div").each(function(index, value){
|
||||
if ($(this).get(0) == $content.get(0)) { // 객체의 비교시 .get(0) 를 사용한다.
|
||||
$(this).is(":hidden") ? $(this).show() : $(this).hide();
|
||||
} else {
|
||||
$(this).hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
$sub_menu = '400650';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$count_post_chk = (isset($_POST['chk']) && is_array($_POST['chk'])) ? count($_POST['chk']) : 0;
|
||||
|
||||
if (! $count_post_chk) {
|
||||
alert($_POST['act_button']." 하실 항목을 하나 이상 체크하세요.");
|
||||
}
|
||||
|
||||
if ($_POST['act_button'] === "선택수정") {
|
||||
auth_check_menu($auth, $sub_menu, 'w');
|
||||
} else if ($_POST['act_button'] === "선택삭제") {
|
||||
auth_check_menu($auth, $sub_menu, 'd');
|
||||
} else {
|
||||
alert("선택수정이나 선택삭제 작업이 아닙니다.");
|
||||
}
|
||||
|
||||
for ($i=0; $i<$count_post_chk; $i++)
|
||||
{
|
||||
$k = isset($_POST['chk'][$i]) ? (int) $_POST['chk'][$i] : 0; // 실제 번호를 넘김
|
||||
$iit_id = isset($_POST['it_id'][$k]) ? preg_replace('/[^a-z0-9_\-]/i', '', $_POST['it_id'][$k]) : '';
|
||||
$iis_id = isset($_POST['is_id'][$k]) ? (int) $_POST['is_id'][$k] : 0;
|
||||
$iis_score = isset($_POST['is_score'][$k]) ? (int) $_POST['is_score'][$k] : 0;
|
||||
$iis_confirm = isset($_POST['is_confirm'][$k]) ? (int) $_POST['is_confirm'][$k] : 0;
|
||||
|
||||
if ($_POST['act_button'] == "선택수정")
|
||||
{
|
||||
$sql = "update {$g5['g5_shop_item_use_table']}
|
||||
set is_score = '{$iis_score}',
|
||||
is_confirm = '{$iis_confirm}'
|
||||
where is_id = '{$iis_id}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
else if ($_POST['act_button'] == "선택삭제")
|
||||
{
|
||||
$sql = "delete from {$g5['g5_shop_item_use_table']} where is_id = '{$iis_id}' ";
|
||||
sql_query($sql);
|
||||
run_event('shop_admin_item_use_deleted', $iis_id);
|
||||
}
|
||||
|
||||
if($iit_id){
|
||||
update_use_cnt($iit_id);
|
||||
update_use_avg($iit_id);
|
||||
}
|
||||
}
|
||||
|
||||
goto_url("./itemuselist.php?sca=$sca&sst=$sst&sod=$sod&sfl=$sfl&stx=$stx&page=$page");
|
||||
@@ -0,0 +1,231 @@
|
||||
<?php
|
||||
$sub_menu = '400500';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$doc = isset($_GET['doc']) ? clean_xss_tags($_GET['doc'], 1, 1) : '';
|
||||
$sort1 = (isset($_GET['sort1']) && in_array($_GET['sort1'], array('b.it_name', 'a.io_stock_qty', 'a.io_use'))) ? $_GET['sort1'] : '';
|
||||
$sort2 = (isset($_GET['sort2']) && in_array($_GET['sort2'], array('desc', 'asc'))) ? $_GET['sort2'] : 'asc';
|
||||
$sel_ca_id = isset($_GET['sel_ca_id']) ? get_search_string($_GET['sel_ca_id']) : '';
|
||||
$sel_field = (isset($_GET['sel_field']) && in_array($_GET['sel_field'], array('b.it_name', 'a.it_id')) ) ? $_GET['sel_field'] : '';
|
||||
$search = isset($_GET['search']) ? get_search_string($_GET['search']) : '';
|
||||
|
||||
$g5['title'] = '상품옵션재고관리';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
$sql_search = " where b.it_id is not NULL ";
|
||||
if ($search != "") {
|
||||
if ($sel_field != "") {
|
||||
$sql_search .= " and $sel_field like '%$search%' ";
|
||||
}
|
||||
}
|
||||
|
||||
if ($sel_ca_id != "") {
|
||||
$sql_search .= " and b.ca_id like '$sel_ca_id%' ";
|
||||
}
|
||||
|
||||
if ($sel_field == "") $sel_field = "b.it_name";
|
||||
if ($sort1 == "") $sort1 = "a.io_stock_qty";
|
||||
if (!in_array($sort1, array('b.it_name', 'a.io_stock_qty', 'a.io_use'))) $sort1 = "a.io_stock_qty";
|
||||
if ($sort2 == "") $sort2 = "asc";
|
||||
|
||||
$sql_common = " from {$g5['g5_shop_item_option_table']} a left join {$g5['g5_shop_item_table']} b on ( a.it_id = b.it_id ) ";
|
||||
$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; // 시작 열을 구함
|
||||
|
||||
$sql = " select a.it_id,
|
||||
a.io_id,
|
||||
a.io_type,
|
||||
a.io_stock_qty,
|
||||
a.io_noti_qty,
|
||||
a.io_use,
|
||||
b.it_name,
|
||||
b.it_option_subject,
|
||||
b.ca_id
|
||||
$sql_common
|
||||
order by $sort1 $sort2
|
||||
limit $from_record, $rows ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
$qstr1 = 'sel_ca_id='.$sel_ca_id.'&sel_field='.$sel_field.'&search='.$search;
|
||||
$qstr = $qstr1.'&sort1='.$sort1.'&sort2='.$sort2.'&page='.$page;
|
||||
|
||||
$listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';
|
||||
?>
|
||||
|
||||
<div class="local_ov01 local_ov">
|
||||
<?php echo $listall; ?>
|
||||
<span class="btn_ov01"><span class="ov_txt">전체 옵션</span><span class="ov_num"> <?php echo $total_count; ?>개</span></span>
|
||||
</div>
|
||||
|
||||
<form name="flist" class="local_sch01 local_sch">
|
||||
<input type="hidden" name="doc" value="<?php echo get_sanitize_input($doc); ?>">
|
||||
<input type="hidden" name="sort1" value="<?php echo get_sanitize_input($sort1); ?>">
|
||||
<input type="hidden" name="sort2" value="<?php echo get_sanitize_input($sort2); ?>">
|
||||
<input type="hidden" name="page" value="<?php echo get_sanitize_input($page); ?>">
|
||||
|
||||
<label for="sel_ca_id" class="sound_only">분류선택</label>
|
||||
<select name="sel_ca_id" id="sel_ca_id">
|
||||
<option value=''>전체분류</option>
|
||||
<?php
|
||||
$sql1 = " select ca_id, ca_name from {$g5['g5_shop_category_table']} order by ca_order, ca_id ";
|
||||
$result1 = sql_query($sql1);
|
||||
for ($i=0; $row1=sql_fetch_array($result1); $i++) {
|
||||
$len = strlen($row1['ca_id']) / 2 - 1;
|
||||
$nbsp = "";
|
||||
for ($i=0; $i<$len; $i++) $nbsp .= " ";
|
||||
echo '<option value="'.$row1['ca_id'].'" '.get_selected($sel_ca_id, $row1['ca_id']).'>'.$nbsp.$row1['ca_name'].'</option>'.PHP_EOL;
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
<label for="sel_field" class="sound_only">검색대상</label>
|
||||
<select name="sel_field" id="sel_field">
|
||||
<option value="b.it_name" <?php echo get_selected($sel_field, 'b.it_name'); ?>>상품명</option>
|
||||
<option value="a.it_id" <?php echo get_selected($sel_field, 'a.it_id'); ?>>상품코드</option>
|
||||
</select>
|
||||
|
||||
<label for="search" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
|
||||
<input type="text" name="search" id="search" value="<?php echo $search; ?>" required class="frm_input required">
|
||||
<input type="submit" value="검색" class="btn_submit">
|
||||
|
||||
</form>
|
||||
|
||||
<form name="fitemstocklist" action="./optionstocklistupdate.php" method="post">
|
||||
<input type="hidden" name="sort1" value="<?php echo $sort1; ?>">
|
||||
<input type="hidden" name="sort2" value="<?php echo $sort2; ?>">
|
||||
<input type="hidden" name="sel_ca_id" value="<?php echo $sel_ca_id; ?>">
|
||||
<input type="hidden" name="sel_field" value="<?php echo $sel_field; ?>">
|
||||
<input type="hidden" name="search" value="<?php echo $search; ?>">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?> 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><a href="<?php echo title_sort("b.it_name") . "&$qstr1"; ?>">상품명</a></th>
|
||||
<th scope="col">옵션항목</th>
|
||||
<th scope="col">옵션타입</th>
|
||||
<th scope="col"><a href="<?php echo title_sort("a.io_stock_qty") . "&$qstr1"; ?>">창고재고</a></th>
|
||||
<th scope="col">주문대기</th>
|
||||
<th scope="col">가재고</th>
|
||||
<th scope="col">재고수정</th>
|
||||
<th scope="col">통보수량</th>
|
||||
<th scope="col"><a href="<?php echo title_sort("a.io_use") . "&$qstr1"; ?>">판매</a></th>
|
||||
<th scope="col">관리</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
$href = shop_item_url($row['it_id']);
|
||||
|
||||
$sql1 = " select SUM(ct_qty) as sum_qty
|
||||
from {$g5['g5_shop_cart_table']}
|
||||
where it_id = '{$row['it_id']}'
|
||||
and io_id = '{$row['io_id']}'
|
||||
and ct_stock_use = '0'
|
||||
and ct_status in ('쇼핑', '주문', '입금', '준비') ";
|
||||
$row1 = sql_fetch($sql1);
|
||||
$wait_qty = $row1['sum_qty'];
|
||||
|
||||
// 가재고 (미래재고)
|
||||
$temporary_qty = $row['io_stock_qty'] - $wait_qty;
|
||||
|
||||
$option = '';
|
||||
$option_br = '';
|
||||
if($row['io_type']) {
|
||||
$opt = explode(chr(30), $row['io_id']);
|
||||
if($opt[0] && $opt[1])
|
||||
$option .= $opt[0].' : '.$opt[1];
|
||||
} else {
|
||||
$subj = explode(',', $row['it_option_subject']);
|
||||
$opt = explode(chr(30), $row['io_id']);
|
||||
for($k=0; $k<count($subj); $k++) {
|
||||
if($subj[$k] && $opt[$k]) {
|
||||
$option .= $option_br.$subj[$k].' : '.$opt[$k];
|
||||
$option_br = '<br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$type = '선택옵션';
|
||||
if($row['io_type'])
|
||||
$type = '추가옵션';
|
||||
|
||||
// 통보수량보다 재고수량이 작을 때
|
||||
$io_stock_qty = number_format($row['io_stock_qty']);
|
||||
$io_stock_qty_st = ''; // 스타일 정의
|
||||
if($row['io_stock_qty'] <= $row['io_noti_qty']) {
|
||||
$io_stock_qty_st = ' sit_stock_qty_alert';
|
||||
$io_stock_qty = ''.$io_stock_qty.' !<span class="sound_only"> 재고부족 </span>';
|
||||
}
|
||||
|
||||
$bg = 'bg'.($i%2);
|
||||
?>
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td class="td_left">
|
||||
<input type="hidden" name="it_id[<?php echo $i; ?>]" value="<?php echo $row['it_id']; ?>">
|
||||
<input type="hidden" name="io_id[<?php echo $i; ?>]" value="<?php echo $row['io_id']; ?>">
|
||||
<input type="hidden" name="io_type[<?php echo $i; ?>]" value="<?php echo $row['io_type']; ?>">
|
||||
<a href="<?php echo $href; ?>"><?php echo get_it_image($row['it_id'], 50, 50); ?> <?php echo cut_str(stripslashes($row['it_name']), 60, "…"); ?></a>
|
||||
</td>
|
||||
<td class="td_left"><?php echo $option; ?></td>
|
||||
<td class="td_mng"><?php echo $type; ?></td>
|
||||
<td class="td_num<?php echo $io_stock_qty_st; ?>"><?php echo $io_stock_qty; ?></td>
|
||||
<td class="td_num"><?php echo number_format($wait_qty); ?></td>
|
||||
<td class="td_num"><?php echo number_format($temporary_qty); ?></td>
|
||||
<td class="td_num">
|
||||
<label for="stock_qty_<?php echo $i; ?>" class="sound_only">재고수정</label>
|
||||
<input type="text" name="io_stock_qty[<?php echo $i; ?>]" value="<?php echo $row['io_stock_qty']; ?>" id="stock_qty_<?php echo $i; ?>" class="frm_input" size="8" autocomplete="off">
|
||||
</td>
|
||||
<td class="td_num">
|
||||
<label for="noti_qty_<?php echo $i; ?>" class="sound_only">통보수량</label>
|
||||
<input type="text" name="io_noti_qty[<?php echo $i; ?>]" value="<?php echo $row['io_noti_qty']; ?>" id="noti_qty_<?php echo $i; ?>" class="frm_input" size="8" autocomplete="off">
|
||||
</td>
|
||||
<td class="td_chk2">
|
||||
<label for="use_<?php echo $i; ?>" class="sound_only">판매</label>
|
||||
<input type="checkbox" name="io_use[<?php echo $i; ?>]" value="1" id="use_<?php echo $i; ?>" <?php echo ($row['io_use'] ? "checked" : ""); ?>>
|
||||
</td>
|
||||
<td class="td_mng td_mng_s"><a href="./itemform.php?w=u&it_id=<?php echo $row['it_id']; ?>&ca_id=<?php echo $row['ca_id']; ?>&<?php echo $qstr; ?>" class="btn btn_03">수정</a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
if (!$i)
|
||||
echo '<tr><td colspan="10" class="empty_table"><span>자료가 없습니다.</span></td></tr>';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<a href="./itemstocklist.php" class="btn btn_02">상품재고관리</a>
|
||||
<a href="./itemsellrank.php" class="btn btn_02">상품판매순위</a>
|
||||
<input type="submit" value="일괄수정" class="btn_submit btn">
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<div class="local_desc01 local_desc">
|
||||
<p>
|
||||
재고수정의 수치를 수정하시면 창고재고의 수치가 변경됩니다.<br>
|
||||
창고재고가 부족한 경우 재고수량 뒤에 <span class="sit_stock_qty_alert">!</span><span class="sound_only"> 혹은 재고부족</span>으로 표시됩니다.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page="); ?>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
$sub_menu = '400500';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$count_post_it_id = (isset($_POST['it_id']) && is_array($_POST['it_id'])) ? count($_POST['it_id']) : 0;
|
||||
|
||||
$search = isset($_REQUEST['search']) ? get_search_string($_REQUEST['search']) : '';
|
||||
$sort1 = isset($_REQUEST['sort1']) ? clean_xss_tags($_REQUEST['sort1'], 1, 1) : '';
|
||||
$sort2 = isset($_REQUEST['sort2']) ? clean_xss_tags($_REQUEST['sort2'], 1, 1) : '';
|
||||
$sel_field = isset($_REQUEST['sel_field']) ? clean_xss_tags($_REQUEST['sel_field'], 1, 1) : '';
|
||||
$sel_ca_id = isset($_REQUEST['sel_ca_id']) ? clean_xss_tags($_REQUEST['sel_ca_id'], 1, 1) : '';
|
||||
|
||||
// 재고 일괄수정
|
||||
for ($i=0; $i<$count_post_it_id; $i++)
|
||||
{
|
||||
$io_stock_qty = isset($_POST['io_stock_qty'][$i]) ? (int) $_POST['io_stock_qty'][$i] : 0;
|
||||
$io_noti_qty = isset($_POST['io_noti_qty'][$i]) ? (int) $_POST['io_noti_qty'][$i] : 0;
|
||||
$io_use = isset($_POST['io_use'][$i]) ? (int) $_POST['io_use'][$i] : 0;
|
||||
$it_id = isset($_POST['it_id'][$i]) ? safe_replace_regex($_POST['it_id'][$i], 'it_id') : '';
|
||||
$io_id = isset($_POST['io_id'][$i]) ? preg_replace(G5_OPTION_ID_FILTER, '', $_POST['io_id'][$i]) : '';
|
||||
$io_type = isset($_POST['io_type'][$i]) ? (int) $_POST['io_type'][$i] : 0;
|
||||
|
||||
$sql = "update {$g5['g5_shop_item_option_table']}
|
||||
set io_stock_qty = '".$io_stock_qty."',
|
||||
io_noti_qty = '".$io_noti_qty."',
|
||||
io_use = '".$io_use."'
|
||||
where it_id = '".$it_id."'
|
||||
and io_id = '".sql_real_escape_string($io_id)."'
|
||||
and io_type = '".$io_type."' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
goto_url("./optionstocklist.php?sort1=$sort1&sort2=$sort2&sel_ca_id=$sel_ca_id&sel_field=$sel_field&search=$search&page=$page");
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
$sub_menu = '400400';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
$g5['title'] = '엑셀 배송일괄처리';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
?>
|
||||
|
||||
<div class="new_win">
|
||||
<h1><?php echo $g5['title']; ?></h1>
|
||||
|
||||
<div class="local_desc01 local_desc">
|
||||
<p>
|
||||
엑셀파일을 이용하여 배송정보를 일괄등록할 수 있습니다.<br>
|
||||
형식은 <strong>배송처리용 엑셀파일</strong>을 다운로드하여 배송 정보를 입력하시면 됩니다.<br>
|
||||
수정 완료 후 엑셀파일을 업로드하시면 배송정보가 일괄등록됩니다.<br>
|
||||
엑셀파일을 저장하실 때는 <strong>Excel 97 - 2003 통합문서 (*.xls)</strong> 로 저장하셔야 합니다.<br>
|
||||
주문상태가 준비이고 미수금이 0인 주문에 한해 엑셀파일이 생성됩니다.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="<?php echo G5_ADMIN_URL; ?>/shop_admin/orderdeliveryexcel.php">배송정보 일괄등록용 엑셀파일 다운로드</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<form name="forderdelivery" method="post" action="./orderdeliveryupdate.php" enctype="MULTIPART/FORM-DATA" autocomplete="off">
|
||||
|
||||
<div id="excelfile_upload">
|
||||
<label for="excelfile">파일선택</label>
|
||||
<input type="file" name="excelfile" id="excelfile">
|
||||
</div>
|
||||
|
||||
<div id="excelfile_input">
|
||||
<input type="checkbox" name="od_send_mail" value="1" id="od_send_mail" checked="checked">
|
||||
<label for="od_send_mail">배송안내 메일</label>
|
||||
<input type="checkbox" name="send_sms" value="1" id="od_send_sms" checked="checked">
|
||||
<label for="od_send_sms">배송안내 SMS</label>
|
||||
<input type="checkbox" name="send_escrow" value="1" id="od_send_escrow">
|
||||
<label for="od_send_escrow">에스크로배송등록</label>
|
||||
</div>
|
||||
|
||||
<div class="btn_confirm01 btn_confirm">
|
||||
<input type="submit" value="배송정보 등록" class="btn_submit">
|
||||
<button type="button" onclick="window.close();">닫기</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
$sub_menu = '400400';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
// 주문정보
|
||||
$sql = " select *
|
||||
from {$g5['g5_shop_order_table']}
|
||||
where od_misu = '0'
|
||||
and od_status = '준비'
|
||||
order by od_id desc ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
if(!@sql_num_rows($result))
|
||||
alert_close('배송처리할 주문 내역이 없습니다.');
|
||||
|
||||
if(! function_exists('column_char')) {
|
||||
function column_char($i) {
|
||||
return chr( 65 + $i );
|
||||
}
|
||||
}
|
||||
|
||||
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');
|
||||
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
$sub_menu = '400400';
|
||||
include_once('./_common.php');
|
||||
include_once('./admin.shop.lib.php');
|
||||
include_once(G5_LIB_PATH.'/mailer.lib.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
define("_ORDERMAIL_", true);
|
||||
|
||||
$sms_count = 0;
|
||||
$sms_messages = array();
|
||||
|
||||
if(isset($_FILES['excelfile']['tmp_name']) && $_FILES['excelfile']['tmp_name']) {
|
||||
$file = $_FILES['excelfile']['tmp_name'];
|
||||
|
||||
include_once(G5_LIB_PATH.'/PHPExcel/IOFactory.php');
|
||||
|
||||
$objPHPExcel = PHPExcel_IOFactory::load($file);
|
||||
$sheet = $objPHPExcel->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');
|
||||
?>
|
||||
|
||||
<div class="new_win">
|
||||
<h1><?php echo $g5['title']; ?></h1>
|
||||
|
||||
<div class="local_desc01 local_desc">
|
||||
<p>배송일괄처리를 완료했습니다.</p>
|
||||
</div>
|
||||
|
||||
<dl id="excelfile_result">
|
||||
<dt>총배송건수</dt>
|
||||
<dd><?php echo number_format($total_count); ?></dd>
|
||||
<dt class="result_done">완료건수</dt>
|
||||
<dd class="result_done"><?php echo number_format($succ_count); ?></dd>
|
||||
<dt class="result_fail">실패건수</dt>
|
||||
<dd class="result_fail"><?php echo number_format($fail_count); ?></dd>
|
||||
<?php if($fail_count > 0) { ?>
|
||||
<dt>실패주문코드</dt>
|
||||
<dd><?php echo implode(', ', $fail_od_id); ?></dd>
|
||||
<?php } ?>
|
||||
</dl>
|
||||
|
||||
<div class="btn_confirm01 btn_confirm">
|
||||
<button type="button" onclick="window.close();">창닫기</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,448 @@
|
||||
<?php
|
||||
$sub_menu = '400400';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$ct_chk_count = isset($_POST['ct_chk']) ? count($_POST['ct_chk']) : 0;
|
||||
if(!$ct_chk_count)
|
||||
alert('처리할 자료를 하나 이상 선택해 주십시오.');
|
||||
|
||||
$status_normal = array('주문','입금','준비','배송','완료');
|
||||
$status_cancel = array('취소','반품','품절');
|
||||
|
||||
if (in_array($_POST['ct_status'], $status_normal) || in_array($_POST['ct_status'], $status_cancel)) {
|
||||
; // 통과
|
||||
} else {
|
||||
alert('변경할 상태가 올바르지 않습니다.');
|
||||
}
|
||||
|
||||
$search = isset($_REQUEST['search']) ? get_search_string($_REQUEST['search']) : '';
|
||||
$sort1 = isset($_REQUEST['sort1']) ? clean_xss_tags($_REQUEST['sort1'], 1, 1) : '';
|
||||
$sort2 = isset($_REQUEST['sort2']) ? clean_xss_tags($_REQUEST['sort2'], 1, 1) : '';
|
||||
$sel_field = isset($_REQUEST['sel_field']) ? clean_xss_tags($_REQUEST['sel_field'], 1, 1) : '';
|
||||
|
||||
$mod_history = '';
|
||||
$cnt = (isset($_POST['ct_id']) && is_array($_POST['ct_id'])) ? count($_POST['ct_id']) : 0;
|
||||
$arr_it_id = array();
|
||||
|
||||
|
||||
$notified_members = [];
|
||||
$notified_partners = [];
|
||||
|
||||
for ($i=0; $i<$cnt; $i++)
|
||||
{
|
||||
$k = isset($_POST['ct_chk'][$i]) ? (int) $_POST['ct_chk'][$i] : '';
|
||||
|
||||
if($k === '') continue;
|
||||
|
||||
$ct_id = isset($_POST['ct_id'][$k]) ? (int) $_POST['ct_id'][$k] : 0;
|
||||
|
||||
/* 20241018 리빌더 수정 { */
|
||||
if(isset($pa['pa_is']) && $pa['pa_is'] == 1) {
|
||||
$ct_delivery_company = isset($_POST['ct_delivery_company'][$k]) ? $_POST['ct_delivery_company'][$k] : '';
|
||||
$ct_invoice = isset($_POST['ct_invoice'][$k]) ? $_POST['ct_invoice'][$k] : '';
|
||||
$ct_invoice_time = isset($_POST['ct_invoice_time'][$k]) ? $_POST['ct_invoice_time'][$k] : '';
|
||||
}
|
||||
/* } */
|
||||
|
||||
|
||||
if(!$ct_id)
|
||||
continue;
|
||||
|
||||
$sql = " select * from {$g5['g5_shop_cart_table']} where od_id = '$od_id' and ct_id = '$ct_id' ";
|
||||
$ct = sql_fetch($sql);
|
||||
if(! (isset($ct['ct_id']) && $ct['ct_id']))
|
||||
continue;
|
||||
|
||||
// 수량이 변경됐다면
|
||||
$ct_qty = isset($_POST['ct_qty'][$k]) ? (int) $_POST['ct_qty'][$k] : 0;
|
||||
if($ct['ct_qty'] != $ct_qty) {
|
||||
$diff_qty = $ct['ct_qty'] - $ct_qty;
|
||||
|
||||
// 재고에 차이 반영.
|
||||
if($ct['ct_stock_use']) {
|
||||
if($ct['io_id']) {
|
||||
$sql = " update {$g5['g5_shop_item_option_table']}
|
||||
set io_stock_qty = io_stock_qty + '$diff_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 + '$diff_qty'
|
||||
where it_id = '{$ct['it_id']}' ";
|
||||
}
|
||||
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
// 수량변경
|
||||
$sql = " update {$g5['g5_shop_cart_table']}
|
||||
set ct_qty = '$ct_qty'
|
||||
where ct_id = '$ct_id'
|
||||
and od_id = '$od_id' ";
|
||||
sql_query($sql);
|
||||
$mod_history .= G5_TIME_YMDHIS.' '.$ct['ct_option'].' 수량변경 '.$ct['ct_qty'].' -> '.$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";
|
||||
|
||||
/* 20241018 리빌더 수정 { */
|
||||
if(isset($pa['pa_is']) && $pa['pa_is'] == 1) {
|
||||
|
||||
$sql = " update {$g5['g5_shop_cart_table']}
|
||||
set ct_point_use = '$point_use',
|
||||
ct_stock_use = '$stock_use',
|
||||
ct_status = '$ct_status',
|
||||
ct_delivery_company = '$ct_delivery_company',
|
||||
ct_invoice = '$ct_invoice',
|
||||
ct_invoice_time = '$ct_invoice_time',
|
||||
ct_history = CONCAT(ct_history,'$ct_history')
|
||||
where od_id = '$od_id'
|
||||
and ct_id = '$ct_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
} else {
|
||||
$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);
|
||||
}
|
||||
|
||||
|
||||
if ($ct_status == '취소') {
|
||||
// 주문자에게 쪽지
|
||||
if ($mb_id && !in_array($mb_id, $notified_members)) {
|
||||
memo_auto_send('주문하신 상품이 취소 처리되었습니다.', '', $mb_id, 'system-msg');
|
||||
$notified_members[] = $mb_id;
|
||||
}
|
||||
|
||||
// 파트너에게 쪽지
|
||||
$partner_id = trim($ct['ct_partner']);
|
||||
if ($partner_id && !in_array($partner_id, $notified_partners)) {
|
||||
memo_auto_send('관리자가 취소한 주문건이 있습니다.', '', $partner_id, 'system-msg');
|
||||
$notified_partners[] = $partner_id;
|
||||
}
|
||||
}
|
||||
|
||||
/* } */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 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'] && is_cancel_shop_pg_order($od)) {
|
||||
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 = '쇼핑몰 운영자 승인 취소';
|
||||
|
||||
$args = array(
|
||||
'paymethod' => get_type_inicis_paymethod($od['od_settle_case']),
|
||||
'tid' => $od['od_tno'],
|
||||
'msg' => $cancel_msg
|
||||
);
|
||||
|
||||
$response = inicis_tid_cancel($args);
|
||||
$result = json_decode($response, true);
|
||||
|
||||
if (isset($result['resultCode'])) {
|
||||
if ($result['resultCode'] != '00') {
|
||||
$pg_res_cd = $result['resultCode'];
|
||||
$pg_res_msg = $result['resultMsg'];
|
||||
}
|
||||
} else {
|
||||
$pg_res_cd = '';
|
||||
$pg_res_msg = 'curl 로 데이터를 받지 못했습니다.';
|
||||
}
|
||||
|
||||
break;
|
||||
case 'nicepay':
|
||||
include_once(G5_SHOP_PATH.'/settle_nicepay.inc.php');
|
||||
$cancel_msg = '쇼핑몰 운영자 승인 취소';
|
||||
|
||||
$tno = $od['od_tno'];
|
||||
|
||||
$cancelAmt = $od['od_receipt_price'];
|
||||
|
||||
// 0:전체 취소, 1:부분 취소(별도 계약 필요)
|
||||
$partialCancelCode = 0;
|
||||
|
||||
|
||||
include G5_SHOP_PATH.'/nicepay/cancel_process.php';
|
||||
|
||||
if (isset($result['ResultCode'])) {
|
||||
// 실패했다면
|
||||
if ($result['ResultCode'] !== '2001') {
|
||||
$pg_res_cd = $result['ResultCode'];
|
||||
$pg_res_msg = $result['ResultMsg'];
|
||||
}
|
||||
} else {
|
||||
$pg_res_cd = '';
|
||||
$pg_res_msg = 'curl 로 데이터를 받지 못하거나 통신에 실패했습니다.';
|
||||
}
|
||||
|
||||
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 '.$od['od_settle_case'].' 승인취소 처리';
|
||||
$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);
|
||||
|
||||
|
||||
if ($_POST['ct_status'] == '배송') {
|
||||
// 주문자에게 쪽지
|
||||
$order = sql_fetch("SELECT mb_id FROM {$g5['g5_shop_order_table']} WHERE od_id = '$od_id'");
|
||||
if (!empty($order['mb_id'])) {
|
||||
memo_auto_send('주문하신 상품이 배송 처리 되었습니다. 주문내역에서 배송조회가 가능합니다.', '', $order['mb_id'], 'system-msg');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$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);
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
<?php
|
||||
$sub_menu = '400400';
|
||||
include_once('./_common.php');
|
||||
include_once('./admin.shop.lib.php');
|
||||
include_once(G5_LIB_PATH.'/mailer.lib.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$od_id = isset($_POST['od_id']) ? safe_replace_regex($_POST['od_id'], 'od_id') : '';
|
||||
|
||||
$search = isset($_REQUEST['search']) ? get_search_string($_REQUEST['search']) : '';
|
||||
$sort1 = isset($_REQUEST['sort1']) ? clean_xss_tags($_REQUEST['sort1'], 1, 1) : '';
|
||||
$sort2 = isset($_REQUEST['sort2']) ? clean_xss_tags($_REQUEST['sort2'], 1, 1) : '';
|
||||
$sel_field = isset($_REQUEST['sel_field']) ? clean_xss_tags($_REQUEST['sel_field'], 1, 1) : '';
|
||||
|
||||
$check_keys = array(
|
||||
'od_deposit_name',
|
||||
'od_bank_account',
|
||||
'od_receipt_time',
|
||||
'od_receipt_price',
|
||||
'od_receipt_point',
|
||||
'od_refund_price',
|
||||
'od_delivery_company',
|
||||
'od_invoice',
|
||||
'od_invoice_time',
|
||||
'od_send_cost',
|
||||
'od_send_cost2',
|
||||
'od_tno',
|
||||
'od_escrow',
|
||||
'od_send_mail'
|
||||
);
|
||||
|
||||
$posts = array();
|
||||
|
||||
foreach($check_keys as $key){
|
||||
$posts[$key] = isset($_POST[$key]) ? clean_xss_tags($_POST[$key], 1, 1) : '';
|
||||
}
|
||||
|
||||
$od_send_mail = $posts['od_send_mail'];
|
||||
|
||||
$sql = " select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' ";
|
||||
$od = sql_fetch($sql);
|
||||
if(! (isset($od['od_id']) && $od['od_id']))
|
||||
alert('주문자료가 존재하지 않습니다.');
|
||||
|
||||
if ($posts['od_receipt_time']) {
|
||||
if (check_datetime($posts['od_receipt_time']) == false)
|
||||
alert('결제일시 오류입니다.');
|
||||
}
|
||||
|
||||
// 결제정보 반영
|
||||
$sql = " update {$g5['g5_shop_order_table']}
|
||||
set od_deposit_name = '{$posts['od_deposit_name']}',
|
||||
od_bank_account = '{$posts['od_bank_account']}',
|
||||
od_receipt_time = '{$posts['od_receipt_time']}',
|
||||
od_receipt_price = '{$posts['od_receipt_price']}',
|
||||
od_receipt_point = '{$posts['od_receipt_point']}',
|
||||
od_refund_price = '{$posts['od_refund_price']}',
|
||||
od_delivery_company= '{$posts['od_delivery_company']}',
|
||||
od_invoice = '{$posts['od_invoice']}',
|
||||
od_invoice_time = '{$posts['od_invoice_time']}',
|
||||
od_send_cost = '{$posts['od_send_cost']}',
|
||||
od_send_cost2 = '{$posts['od_send_cost2']}'
|
||||
where od_id = '$od_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
// 주문정보
|
||||
$info = get_order_info($od_id);
|
||||
if(!$info)
|
||||
alert('주문자료가 존재하지 않습니다.');
|
||||
|
||||
$od_status = $od['od_status'];
|
||||
$cart_status = false;
|
||||
|
||||
// 미수가 0이고 상태가 주문이었다면 입금으로 변경
|
||||
if($info['od_misu'] == 0 && $od['od_status'] == '주문')
|
||||
{
|
||||
$od_status = '입금';
|
||||
$cart_status = true;
|
||||
}
|
||||
|
||||
// 배송정보가 있으면 주문상태 배송으로 변경
|
||||
$order_status = array('입금', '준비');
|
||||
if($posts['od_delivery_company'] && $posts['od_invoice'] && in_array($od['od_status'], $order_status))
|
||||
{
|
||||
$od_status = '배송';
|
||||
$cart_status = true;
|
||||
}
|
||||
|
||||
// 미수금액
|
||||
$od_misu = ( $od['od_cart_price'] - $od['od_cancel_price'] + (int) $posts['od_send_cost'] + (int) $posts['od_send_cost2'] )
|
||||
- ( $od['od_cart_coupon'] + $od['od_coupon'] + $od['od_send_coupon'] )
|
||||
- ( (int) $posts['od_receipt_price'] + (int) $posts['od_receipt_point'] - (int) $posts['od_refund_price'] );
|
||||
|
||||
// 미수금 정보 등 반영
|
||||
$sql = " update {$g5['g5_shop_order_table']}
|
||||
set od_misu = '$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);
|
||||
|
||||
// 장바구니 상태 변경
|
||||
if($cart_status) {
|
||||
$sql = " update {$g5['g5_shop_cart_table']}
|
||||
set ct_status = '$od_status'
|
||||
where od_id = '$od_id' ";
|
||||
|
||||
switch($od_status) {
|
||||
case '입금':
|
||||
$sql .= " and ct_status = '주문' ";
|
||||
break;
|
||||
case '배송':
|
||||
$sql .= " and ct_status IN ('".implode("', '", $order_status)."') ";
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
sql_query($sql);
|
||||
|
||||
/* 20250614 리빌더 { */
|
||||
if ($od_status == '입금') {
|
||||
|
||||
$sql_partner = "SELECT DISTINCT ct_partner FROM {$g5['g5_shop_cart_table']} WHERE od_id = '$od_id'";
|
||||
$res_partner = sql_query($sql_partner);
|
||||
|
||||
while ($row = sql_fetch_array($res_partner)) {
|
||||
$partner_id = trim($row['ct_partner']);
|
||||
if ($partner_id) {
|
||||
memo_auto_send('주문 상품의 입금이 확인되었습니다. 상품을 배송해주세요.', '', $partner_id, 'system-msg');
|
||||
}
|
||||
}
|
||||
|
||||
$order = sql_fetch("SELECT mb_id FROM {$g5['g5_shop_order_table']} WHERE od_id = '$od_id'");
|
||||
$mb_id = trim($order['mb_id']);
|
||||
|
||||
if ($mb_id) {
|
||||
memo_auto_send('주문하신 상품의 입금이 확인되었습니다.', '', $mb_id, 'system-msg');
|
||||
}
|
||||
|
||||
} else if ($od_status == '배송') {
|
||||
|
||||
$order = sql_fetch("SELECT mb_id FROM {$g5['g5_shop_order_table']} WHERE od_id = '$od_id'");
|
||||
$mb_id = trim($order['mb_id']);
|
||||
|
||||
if ($mb_id) {
|
||||
memo_auto_send('주문하신 상품이 배송 처리 되었습니다. 주문내역에서 배송조회가 가능합니다.', '', $mb_id, 'system-msg');
|
||||
}
|
||||
}
|
||||
/* } */
|
||||
}
|
||||
|
||||
|
||||
// 배송때 재고반영
|
||||
if($info['od_misu'] == 0 && $od_status == '배송') {
|
||||
$sql = " select * from {$g5['g5_shop_cart_table']} where od_id = '$od_id' ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
// 재고를 사용하지 않았다면
|
||||
$stock_use = $row['ct_stock_use'];
|
||||
|
||||
if(!$row['ct_stock_use'])
|
||||
{
|
||||
// 재고에서 뺀다.
|
||||
subtract_io_stock($row['it_id'], $row['ct_qty'], $row['io_id'], $row['io_type']);
|
||||
$stock_use = 1;
|
||||
|
||||
$sql = " update {$g5['g5_shop_cart_table']} set ct_stock_use = '$stock_use' where ct_id = '{$row['ct_id']}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
unset($sql);
|
||||
unset($result);
|
||||
unset($row);
|
||||
}
|
||||
|
||||
|
||||
// 메일발송
|
||||
define("_ORDERMAIL_", true);
|
||||
include "./ordermail.inc.php";
|
||||
|
||||
|
||||
// SMS 문자전송
|
||||
define("_ORDERSMS_", true);
|
||||
include "./ordersms.inc.php";
|
||||
|
||||
|
||||
// 에스크로 배송처리
|
||||
if($posts['od_tno'] && $posts['od_escrow'] == 1)
|
||||
{
|
||||
$escrow_tno = $posts['od_tno'];
|
||||
$escrow_corp = $posts['od_delivery_company'];
|
||||
$escrow_numb = $posts['od_invoice'];
|
||||
|
||||
include(G5_SHOP_PATH.'/'.$od['od_pg'].'/escrow.register.php');
|
||||
}
|
||||
|
||||
|
||||
$qstr = "sort1=$sort1&sort2=$sort2&sel_field=$sel_field&search=$search&page=$page";
|
||||
|
||||
goto_url("./orderform.php?od_id=$od_id&$qstr");
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
$sub_menu = '400400';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$od_shop_memo = isset($_POST['od_shop_memo']) ? strip_tags($_POST['od_shop_memo']) : '';
|
||||
$od_id = isset($_POST['od_id']) ? safe_replace_regex($_POST['od_id'], 'od_id') : '';
|
||||
|
||||
$search = isset($_REQUEST['search']) ? get_search_string($_REQUEST['search']) : '';
|
||||
$sort1 = isset($_REQUEST['sort1']) ? clean_xss_tags($_REQUEST['sort1'], 1, 1) : '';
|
||||
$sort2 = isset($_REQUEST['sort2']) ? clean_xss_tags($_REQUEST['sort2'], 1, 1) : '';
|
||||
$sel_field = isset($_REQUEST['sel_field']) ? clean_xss_tags($_REQUEST['sel_field'], 1, 1) : '';
|
||||
|
||||
if(isset($_POST['mod_type']) && $_POST['mod_type'] === 'info') {
|
||||
$od_zip1 = isset($_POST['od_zip']) ? preg_replace('/[^0-9]/', '', substr($_POST['od_zip'], 0, 3)) : '';
|
||||
$od_zip2 = isset($_POST['od_zip']) ? preg_replace('/[^0-9]/', '', substr($_POST['od_zip'], 3)) : '';
|
||||
$od_b_zip1 = isset($_POST['od_b_zip']) ? preg_replace('/[^0-9]/', '', substr($_POST['od_b_zip'], 0, 3)) : '';
|
||||
$od_b_zip2 = isset($_POST['od_b_zip']) ? preg_replace('/[^0-9]/', '', substr($_POST['od_b_zip'], 3)) : '';
|
||||
$od_email = isset($_POST['od_email']) ? strip_tags(clean_xss_attributes($_POST['od_email'])) : '';
|
||||
$od_name = isset($_POST['od_name']) ? clean_xss_tags($_POST['od_name'], 1, 1) : '';
|
||||
$od_tel = isset($_POST['od_tel']) ? clean_xss_tags($_POST['od_tel'], 1, 1) : '';
|
||||
$od_hp = isset($_POST['od_hp']) ? clean_xss_tags($_POST['od_hp'], 1, 1) : '';
|
||||
$od_addr1 = isset($_POST['od_addr1']) ? clean_xss_tags($_POST['od_addr1'], 1, 1) : '';
|
||||
$od_addr2 = isset($_POST['od_addr2']) ? clean_xss_tags($_POST['od_addr2'], 1, 1) : '';
|
||||
$od_addr3 = isset($_POST['od_addr3']) ? clean_xss_tags($_POST['od_addr3'], 1, 1) : '';
|
||||
$od_addr_jibeon = isset($_POST['od_addr_jibeon']) ? clean_xss_tags($_POST['od_addr_jibeon'], 1, 1) : '';
|
||||
$od_b_name = isset($_POST['od_b_name']) ? clean_xss_tags($_POST['od_b_name'], 1, 1) : '';
|
||||
$od_b_tel = isset($_POST['od_b_tel']) ? clean_xss_tags($_POST['od_b_tel'], 1, 1) : '';
|
||||
$od_b_hp = isset($_POST['od_b_hp']) ? clean_xss_tags($_POST['od_b_hp'], 1, 1) : '';
|
||||
$od_b_addr1 = isset($_POST['od_b_addr1']) ? clean_xss_tags($_POST['od_b_addr1'], 1, 1) : '';
|
||||
$od_b_addr2 = isset($_POST['od_b_addr2']) ? clean_xss_tags($_POST['od_b_addr2'], 1, 1) : '';
|
||||
$od_b_addr3 = isset($_POST['od_b_addr3']) ? clean_xss_tags($_POST['od_b_addr3'], 1, 1) : '';
|
||||
$od_b_addr_jibeon = isset($_POST['od_b_addr_jibeon']) ? clean_xss_tags($_POST['od_b_addr_jibeon'], 1, 1) : '';
|
||||
$od_hope_date = isset($_POST['od_hope_date']) ? clean_xss_tags($_POST['od_hope_date'], 1, 1) : '';
|
||||
|
||||
$sql = " update {$g5['g5_shop_order_table']}
|
||||
set od_name = '$od_name',
|
||||
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_email = '$od_email',
|
||||
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' ";
|
||||
|
||||
if ($default['de_hope_date_use'])
|
||||
$sql .= " , od_hope_date = '$od_hope_date' ";
|
||||
} else {
|
||||
$sql = "update {$g5['g5_shop_order_table']}
|
||||
set od_shop_memo = '$od_shop_memo' ";
|
||||
}
|
||||
$sql .= " where od_id = '$od_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
$qstr = "sort1=$sort1&sort2=$sort2&sel_field=$sel_field&search=$search&page=$page";
|
||||
|
||||
goto_url("./orderform.php?od_id=$od_id&$qstr");
|
||||
@@ -0,0 +1,684 @@
|
||||
<?php
|
||||
$sub_menu = '400400';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$g5['title'] = '주문내역';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');
|
||||
|
||||
$where = array();
|
||||
|
||||
$doc = isset($_GET['doc']) ? clean_xss_tags($_GET['doc'], 1, 1) : '';
|
||||
$sort1 = (isset($_GET['sort1']) && in_array($_GET['sort1'], array('od_id', 'od_cart_price', 'od_receipt_price', 'od_cancel_price', 'od_misu', 'od_cash'))) ? $_GET['sort1'] : '';
|
||||
$sort2 = (isset($_GET['sort2']) && in_array($_GET['sort2'], array('desc', 'asc'))) ? $_GET['sort2'] : 'desc';
|
||||
$sel_field = (isset($_GET['sel_field']) && in_array($_GET['sel_field'], array('od_id', 'mb_id', 'od_name', 'od_tel', 'od_hp', 'od_b_name', 'od_b_tel', 'od_b_hp', 'od_deposit_name', 'od_invoice')) ) ? $_GET['sel_field'] : '';
|
||||
$od_status = isset($_GET['od_status']) ? get_search_string($_GET['od_status']) : '';
|
||||
$search = isset($_GET['search']) ? get_search_string($_GET['search']) : '';
|
||||
$save_search = isset($_GET['save_search']) ? get_search_string($_GET['save_search']) : '';
|
||||
|
||||
$fr_date = (isset($_GET['fr_date']) && preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $_GET['fr_date'])) ? $_GET['fr_date'] : '';
|
||||
$to_date = (isset($_GET['to_date']) && preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $_GET['to_date'])) ? $_GET['to_date'] : '';
|
||||
|
||||
$od_misu = isset($_GET['od_misu']) ? preg_replace('/[^0-9a-z]/i', '', $_GET['od_misu']) : '';
|
||||
$od_cancel_price = isset($_GET['od_cancel_price']) ? preg_replace('/[^0-9a-z]/i', '', $_GET['od_cancel_price']) : '';
|
||||
$od_refund_price = isset($_GET['od_refund_price']) ? preg_replace('/[^0-9a-z]/i', '', $_GET['od_refund_price']) : '';
|
||||
$od_receipt_point = isset($_GET['od_receipt_point']) ? preg_replace('/[^0-9a-z]/i', '', $_GET['od_receipt_point']) : '';
|
||||
$od_coupon = isset($_GET['od_coupon']) ? preg_replace('/[^0-9a-z]/i', '', $_GET['od_coupon']) : '';
|
||||
$od_settle_case = isset($_GET['od_settle_case']) ? clean_xss_tags($_GET['od_settle_case'], 1, 1) : '';
|
||||
$od_escrow = isset($_GET['od_escrow']) ? clean_xss_tags($_GET['od_escrow'], 1, 1) : '';
|
||||
|
||||
$tot_itemcount = $tot_orderprice = $tot_receiptprice = $tot_ordercancel = $tot_misu = $tot_couponprice = 0;
|
||||
$sql_search = "";
|
||||
if ($search != "") {
|
||||
if ($sel_field != "") {
|
||||
$where[] = " $sel_field like '%$search%' ";
|
||||
}
|
||||
|
||||
if ($save_search != $search) {
|
||||
$page = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($od_status) {
|
||||
switch($od_status) {
|
||||
case '전체취소':
|
||||
$where[] = " od_status = '취소' ";
|
||||
break;
|
||||
case '부분취소':
|
||||
$where[] = " od_status IN('주문', '입금', '준비', '배송', '완료') and od_cancel_price > 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 = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';
|
||||
|
||||
// 주문삭제 히스토리 테이블 필드 추가
|
||||
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);
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="local_ov01 local_ov">
|
||||
<?php echo $listall; ?>
|
||||
<span class="btn_ov01"><span class="ov_txt">전체 주문내역</span><span class="ov_num"> <?php echo number_format($total_count); ?>건</span></span>
|
||||
<?php if($od_status == '준비' && $total_count > 0) { ?>
|
||||
<a href="./orderdelivery.php" id="order_delivery" class="ov_a">엑셀배송처리</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<form name="frmorderlist" class="local_sch01 local_sch">
|
||||
<input type="hidden" name="doc" value="<?php echo get_sanitize_input($doc); ?>">
|
||||
<input type="hidden" name="sort1" value="<?php echo get_sanitize_input($sort1); ?>">
|
||||
<input type="hidden" name="sort2" value="<?php echo get_sanitize_input($sort2); ?>">
|
||||
<input type="hidden" name="page" value="<?php echo get_sanitize_input($page); ?>">
|
||||
<input type="hidden" name="save_search" value="<?php echo get_sanitize_input($search); ?>">
|
||||
|
||||
<label for="sel_field" class="sound_only">검색대상</label>
|
||||
<select name="sel_field" id="sel_field">
|
||||
<option value="od_id" <?php echo get_selected($sel_field, 'od_id'); ?>>주문번호</option>
|
||||
<option value="mb_id" <?php echo get_selected($sel_field, 'mb_id'); ?>>회원 ID</option>
|
||||
<option value="od_name" <?php echo get_selected($sel_field, 'od_name'); ?>>주문자</option>
|
||||
<option value="od_tel" <?php echo get_selected($sel_field, 'od_tel'); ?>>주문자전화</option>
|
||||
<option value="od_hp" <?php echo get_selected($sel_field, 'od_hp'); ?>>주문자핸드폰</option>
|
||||
<option value="od_b_name" <?php echo get_selected($sel_field, 'od_b_name'); ?>>받는분</option>
|
||||
<option value="od_b_tel" <?php echo get_selected($sel_field, 'od_b_tel'); ?>>받는분전화</option>
|
||||
<option value="od_b_hp" <?php echo get_selected($sel_field, 'od_b_hp'); ?>>받는분핸드폰</option>
|
||||
<option value="od_deposit_name" <?php echo get_selected($sel_field, 'od_deposit_name'); ?>>입금자</option>
|
||||
<option value="od_invoice" <?php echo get_selected($sel_field, 'od_invoice'); ?>>운송장번호</option>
|
||||
</select>
|
||||
|
||||
<label for="search" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
|
||||
<input type="text" name="search" value="<?php echo $search; ?>" id="search" required class="required frm_input" autocomplete="off">
|
||||
<input type="submit" value="검색" class="btn_submit">
|
||||
|
||||
</form>
|
||||
|
||||
<form class="local_sch03 local_sch">
|
||||
<div>
|
||||
<strong>주문상태</strong>
|
||||
<input type="radio" name="od_status" value="" id="od_status_all" <?php echo get_checked($od_status, ''); ?>>
|
||||
<label for="od_status_all">전체</label>
|
||||
<input type="radio" name="od_status" value="주문" id="od_status_odr" <?php echo get_checked($od_status, '주문'); ?>>
|
||||
<label for="od_status_odr">주문</label>
|
||||
<input type="radio" name="od_status" value="입금" id="od_status_income" <?php echo get_checked($od_status, '입금'); ?>>
|
||||
<label for="od_status_income">입금</label>
|
||||
<input type="radio" name="od_status" value="준비" id="od_status_rdy" <?php echo get_checked($od_status, '준비'); ?>>
|
||||
<label for="od_status_rdy">준비</label>
|
||||
<input type="radio" name="od_status" value="배송" id="od_status_dvr" <?php echo get_checked($od_status, '배송'); ?>>
|
||||
<label for="od_status_dvr">배송</label>
|
||||
<input type="radio" name="od_status" value="완료" id="od_status_done" <?php echo get_checked($od_status, '완료'); ?>>
|
||||
<label for="od_status_done">완료</label>
|
||||
<input type="radio" name="od_status" value="전체취소" id="od_status_cancel" <?php echo get_checked($od_status, '전체취소'); ?>>
|
||||
<label for="od_status_cancel">전체취소</label>
|
||||
<input type="radio" name="od_status" value="부분취소" id="od_status_pcancel" <?php echo get_checked($od_status, '부분취소'); ?>>
|
||||
<label for="od_status_pcancel">부분취소</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<strong>결제수단</strong>
|
||||
<input type="radio" name="od_settle_case" value="" id="od_settle_case01" <?php echo get_checked($od_settle_case, ''); ?>>
|
||||
<label for="od_settle_case01">전체</label>
|
||||
<input type="radio" name="od_settle_case" value="무통장" id="od_settle_case02" <?php echo get_checked($od_settle_case, '무통장'); ?>>
|
||||
<label for="od_settle_case02">무통장</label>
|
||||
<input type="radio" name="od_settle_case" value="가상계좌" id="od_settle_case03" <?php echo get_checked($od_settle_case, '가상계좌'); ?>>
|
||||
<label for="od_settle_case03">가상계좌</label>
|
||||
<input type="radio" name="od_settle_case" value="계좌이체" id="od_settle_case04" <?php echo get_checked($od_settle_case, '계좌이체'); ?>>
|
||||
<label for="od_settle_case04">계좌이체</label>
|
||||
<input type="radio" name="od_settle_case" value="휴대폰" id="od_settle_case05" <?php echo get_checked($od_settle_case, '휴대폰'); ?>>
|
||||
<label for="od_settle_case05">휴대폰</label>
|
||||
<input type="radio" name="od_settle_case" value="신용카드" id="od_settle_case06" <?php echo get_checked($od_settle_case, '신용카드'); ?>>
|
||||
<label for="od_settle_case06">신용카드</label>
|
||||
<input type="radio" name="od_settle_case" value="간편결제" id="od_settle_case07" <?php echo get_checked($od_settle_case, '간편결제'); ?>>
|
||||
<label for="od_settle_case07" data-tooltip-text="NHN_KCP 간편결제 : PAYCO, 네이버페이, 카카오페이(NHN_KCP), 애플페이(NHN_KCP) 
LG유플러스 간편결제 : PAYNOW 
KG 이니시스 간편결제 : KPAY, 삼성페이, LPAY, 카카오페이(KG이니시스)">PG간편결제</label>
|
||||
<input type="radio" name="od_settle_case" value="KAKAOPAY" id="od_settle_case08" <?php echo get_checked($od_settle_case, 'KAKAOPAY'); ?>>
|
||||
<label for="od_settle_case08">KAKAOPAY</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<strong>기타선택</strong>
|
||||
<input type="checkbox" name="od_misu" value="Y" id="od_misu01" <?php echo get_checked($od_misu, 'Y'); ?>>
|
||||
<label for="od_misu01">미수금</label>
|
||||
<input type="checkbox" name="od_cancel_price" value="Y" id="od_misu02" <?php echo get_checked($od_cancel_price, 'Y'); ?>>
|
||||
<label for="od_misu02">반품,품절</label>
|
||||
<input type="checkbox" name="od_refund_price" value="Y" id="od_misu03" <?php echo get_checked($od_refund_price, 'Y'); ?>>
|
||||
<label for="od_misu03">환불</label>
|
||||
<input type="checkbox" name="od_receipt_point" value="Y" id="od_misu04" <?php echo get_checked($od_receipt_point, 'Y'); ?>>
|
||||
<label for="od_misu04">포인트주문</label>
|
||||
<input type="checkbox" name="od_coupon" value="Y" id="od_misu05" <?php echo get_checked($od_coupon, 'Y'); ?>>
|
||||
<label for="od_misu05">쿠폰</label>
|
||||
<?php if($default['de_escrow_use']) { ?>
|
||||
<input type="checkbox" name="od_escrow" value="Y" id="od_misu06" <?php echo get_checked($od_escrow, 'Y'); ?>>
|
||||
<label for="od_misu06">에스크로</label>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="sch_last">
|
||||
<strong>주문일자</strong>
|
||||
<input type="text" id="fr_date" name="fr_date" value="<?php echo $fr_date; ?>" class="frm_input" size="10" maxlength="10"> ~
|
||||
<input type="text" id="to_date" name="to_date" value="<?php echo $to_date; ?>" class="frm_input" size="10" maxlength="10">
|
||||
<button type="button" onclick="javascript:set_date('오늘');">오늘</button>
|
||||
<button type="button" onclick="javascript:set_date('어제');">어제</button>
|
||||
<button type="button" onclick="javascript:set_date('이번주');">이번주</button>
|
||||
<button type="button" onclick="javascript:set_date('이번달');">이번달</button>
|
||||
<button type="button" onclick="javascript:set_date('지난주');">지난주</button>
|
||||
<button type="button" onclick="javascript:set_date('지난달');">지난달</button>
|
||||
<button type="button" onclick="javascript:set_date('전체');">전체</button>
|
||||
<input type="submit" value="검색" class="btn_submit">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form name="forderlist" id="forderlist" onsubmit="return forderlist_submit(this);" method="post" autocomplete="off">
|
||||
<input type="hidden" name="search_od_status" value="<?php echo $od_status; ?>">
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table id="sodr_list">
|
||||
<caption>주문 내역 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" rowspan="3">
|
||||
<label for="chkall" class="sound_only">주문 전체</label>
|
||||
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
|
||||
</th>
|
||||
<th scope="col" id="th_ordnum" rowspan="2" colspan="2"><a href="<?php echo title_sort("od_id", 1)."&$qstr1"; ?>">주문번호</a></th>
|
||||
<th scope="col" id="th_odrer">주문자</th>
|
||||
<th scope="col" id="th_odrertel">주문자전화</th>
|
||||
<th scope="col" id="th_recvr">받는분</th>
|
||||
<th scope="col" rowspan="3">주문합계<br>선불배송비포함</th>
|
||||
<th scope="col" rowspan="3">입금합계</th>
|
||||
<th scope="col" rowspan="3">주문취소</th>
|
||||
<th scope="col" rowspan="3">쿠폰</th>
|
||||
<th scope="col" rowspan="3">미수금</th>
|
||||
<th scope="col" rowspan="3">보기</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col" id="th_odrid">회원ID</th>
|
||||
<th scope="col" id="th_odrcnt">주문상품수</th>
|
||||
<th scope="col" id="th_odrall">누적주문수</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col" id="odrstat">주문상태</th>
|
||||
<th scope="col" id="odrpay">결제수단</th>
|
||||
<th scope="col" id="delino">운송장번호</th>
|
||||
<th scope="col" id="delicom">배송회사</th>
|
||||
<th scope="col" id="delidate">배송일시</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
// 결제 수단
|
||||
$s_receipt_way = $s_br = "";
|
||||
if ($row['od_settle_case'])
|
||||
{
|
||||
$s_receipt_way = check_pay_name_replace($row['od_settle_case'], $row);
|
||||
$s_br = '<br />';
|
||||
}
|
||||
else
|
||||
{
|
||||
$s_receipt_way = '결제수단없음';
|
||||
$s_br = '<br />';
|
||||
}
|
||||
|
||||
if ($row['od_receipt_point'] > 0)
|
||||
$s_receipt_way .= $s_br."포인트";
|
||||
|
||||
$mb_nick = get_sideview($row['mb_id'], get_text($row['od_name']), $row['od_email'], '');
|
||||
|
||||
$od_cnt = 0;
|
||||
if ($row['mb_id'])
|
||||
{
|
||||
$sql2 = " select count(*) as cnt from {$g5['g5_shop_order_table']} where mb_id = '{$row['mb_id']}' ";
|
||||
$row2 = sql_fetch($sql2);
|
||||
$od_cnt = $row2['cnt'];
|
||||
}
|
||||
|
||||
// 주문 번호에 device 표시
|
||||
$od_mobile = '';
|
||||
if($row['od_mobile'])
|
||||
$od_mobile = '(M)';
|
||||
|
||||
// 주문번호에 - 추가
|
||||
switch(strlen($row['od_id'])) {
|
||||
case 16:
|
||||
$disp_od_id = substr($row['od_id'],0,8).'-'.substr($row['od_id'],8);
|
||||
break;
|
||||
default:
|
||||
$disp_od_id = substr($row['od_id'],0,6).'-'.substr($row['od_id'],6);
|
||||
break;
|
||||
}
|
||||
|
||||
// 주문 번호에 에스크로 표시
|
||||
$od_paytype = '';
|
||||
if($row['od_test'])
|
||||
$od_paytype .= '<span class="list_test">테스트</span>';
|
||||
|
||||
if($default['de_escrow_use'] && $row['od_escrow'])
|
||||
$od_paytype .= '<span class="list_escrow">에스크로</span>';
|
||||
|
||||
$uid = md5($row['od_id'].$row['od_time'].$row['od_ip']);
|
||||
|
||||
$invoice_time = is_null_time($row['od_invoice_time']) ? G5_TIME_YMDHIS : $row['od_invoice_time'];
|
||||
$delivery_company = $row['od_delivery_company'] ? $row['od_delivery_company'] : $default['de_delivery_company'];
|
||||
|
||||
$bg = 'bg'.($i%2);
|
||||
$td_color = 0;
|
||||
if($row['od_cancel_price'] > 0) {
|
||||
$bg .= 'cancel';
|
||||
$td_color = 1;
|
||||
}
|
||||
?>
|
||||
<tr class="orderlist<?php echo ' '.$bg; ?>">
|
||||
<td rowspan="3" class="td_chk">
|
||||
<input type="hidden" name="od_id[<?php echo $i ?>]" value="<?php echo $row['od_id'] ?>" id="od_id_<?php echo $i ?>">
|
||||
<label for="chk_<?php echo $i; ?>" class="sound_only">주문번호 <?php echo $row['od_id']; ?></label>
|
||||
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i ?>">
|
||||
</td>
|
||||
<td headers="th_ordnum" class="td_odrnum2" rowspan="2" colspan="2">
|
||||
<a href="<?php echo G5_SHOP_URL; ?>/orderinquiryview.php?od_id=<?php echo $row['od_id']; ?>&uid=<?php echo $uid; ?>" class="orderitem"><?php echo $disp_od_id; ?></a>
|
||||
<?php echo $od_mobile; ?>
|
||||
<?php echo $od_paytype; ?>
|
||||
</td>
|
||||
<td headers="th_odrer" class="td_name"><?php echo $mb_nick; ?></td>
|
||||
<td headers="th_odrertel" class="td_tel"><?php echo get_text($row['od_tel']); ?></td>
|
||||
<td headers="th_recvr" class="td_name"><a href="<?php echo $_SERVER['SCRIPT_NAME']; ?>?sort1=<?php echo $sort1; ?>&sort2=<?php echo $sort2; ?>&sel_field=od_b_name&search=<?php echo get_text($row['od_b_name']); ?>"><?php echo get_text($row['od_b_name']); ?></a></td>
|
||||
<td rowspan="3" class="td_num td_numsum"><?php echo number_format($row['od_cart_price'] + $row['od_send_cost'] + $row['od_send_cost2']); ?></td>
|
||||
<td rowspan="3" class="td_num_right"><?php echo number_format($row['od_receipt_price']); ?></td>
|
||||
<td rowspan="3" class="td_numcancel<?php echo $td_color; ?> td_num"><?php echo number_format($row['od_cancel_price']); ?></td>
|
||||
<td rowspan="3" class="td_num_right"><?php echo number_format($row['couponprice']); ?></td>
|
||||
<td rowspan="3" class="td_num_right"><?php echo number_format($row['od_misu']); ?></td>
|
||||
<td rowspan="3" class="td_mng td_mng_s">
|
||||
<a href="./orderform.php?od_id=<?php echo $row['od_id']; ?>&<?php echo $qstr; ?>" class="mng_mod btn btn_02"><span class="sound_only"><?php echo $row['od_id']; ?> </span>보기</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td headers="th_odrid">
|
||||
<?php if ($row['mb_id']) { ?>
|
||||
<a href="<?php echo $_SERVER['SCRIPT_NAME']; ?>?sort1=<?php echo $sort1; ?>&sort2=<?php echo $sort2; ?>&sel_field=mb_id&search=<?php echo $row['mb_id']; ?>"><?php echo $row['mb_id']; ?></a>
|
||||
<?php } else { ?>
|
||||
비회원
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td headers="th_odrcnt"><?php echo $row['od_cart_count']; ?>건</td>
|
||||
<td headers="th_odrall"><?php echo $od_cnt; ?>건</td>
|
||||
</tr>
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td headers="odrstat" class="odrstat">
|
||||
<input type="hidden" name="current_status[<?php echo $i ?>]" value="<?php echo $row['od_status'] ?>">
|
||||
<?php echo $row['od_status']; ?>
|
||||
</td>
|
||||
<td headers="odrpay" class="odrpay">
|
||||
<input type="hidden" name="current_settle_case[<?php echo $i ?>]" value="<?php echo $row['od_settle_case'] ?>">
|
||||
<?php echo $s_receipt_way; ?>
|
||||
</td>
|
||||
<td headers="delino" class="delino">
|
||||
<?php if ($od_status == '준비') { ?>
|
||||
<input type="text" name="od_invoice[<?php echo $i; ?>]" value="<?php echo $row['od_invoice']; ?>" class="frm_input" size="10">
|
||||
<?php } else {
|
||||
echo ($row['od_invoice'] ? $row['od_invoice'] : '-');
|
||||
} ?>
|
||||
</td>
|
||||
<td headers="delicom">
|
||||
<?php if ($od_status == '준비') { ?>
|
||||
<select name="od_delivery_company[<?php echo $i; ?>]">
|
||||
<?php echo get_delivery_company($delivery_company); ?>
|
||||
</select>
|
||||
<?php } else {
|
||||
echo ($row['od_delivery_company'] ? $row['od_delivery_company'] : '-');
|
||||
} ?>
|
||||
</td>
|
||||
<td headers="delidate">
|
||||
<?php if ($od_status == '준비') { ?>
|
||||
<input type="text" name="od_invoice_time[<?php echo $i; ?>]" value="<?php echo $invoice_time; ?>" class="frm_input" size="10" maxlength="19">
|
||||
<?php } else {
|
||||
echo (is_null_time($row['od_invoice_time']) ? '-' : substr($row['od_invoice_time'],2,14));
|
||||
} ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$tot_itemcount += $row['od_cart_count'];
|
||||
$tot_orderprice += ($row['od_cart_price'] + $row['od_send_cost'] + $row['od_send_cost2']);
|
||||
$tot_ordercancel += $row['od_cancel_price'];
|
||||
$tot_receiptprice += $row['od_receipt_price'];
|
||||
$tot_couponprice += $row['couponprice'];
|
||||
$tot_misu += $row['od_misu'];
|
||||
}
|
||||
sql_free_result($result);
|
||||
if ($i == 0)
|
||||
echo '<tr><td colspan="12" class="empty_table">자료가 없습니다.</td></tr>';
|
||||
?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="orderlist">
|
||||
<th scope="row" colspan="3"> </th>
|
||||
<td> </td>
|
||||
<td><?php echo number_format($tot_itemcount); ?>건</td>
|
||||
<th scope="row">합 계</th>
|
||||
<td><?php echo number_format($tot_orderprice); ?></td>
|
||||
<td><?php echo number_format($tot_receiptprice); ?></td>
|
||||
<td><?php echo number_format($tot_ordercancel); ?></td>
|
||||
<td><?php echo number_format($tot_couponprice); ?></td>
|
||||
<td><?php echo number_format($tot_misu); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="local_cmd01 local_cmd">
|
||||
<?php if (($od_status == '' || $od_status == '완료' || $od_status == '전체취소' || $od_status == '부분취소') == false) {
|
||||
// 검색된 주문상태가 '전체', '완료', '전체취소', '부분취소' 가 아니라면
|
||||
?>
|
||||
<label for="od_status" class="cmd_tit">주문상태 변경</label>
|
||||
<?php
|
||||
$change_status = "";
|
||||
if ($od_status == '주문') $change_status = "입금";
|
||||
if ($od_status == '입금') $change_status = "준비";
|
||||
if ($od_status == '준비') $change_status = "배송";
|
||||
if ($od_status == '배송') $change_status = "완료";
|
||||
?>
|
||||
<label><input type="checkbox" name="od_status" value="<?php echo $change_status; ?>"> '<?php echo $od_status ?>'상태에서 '<strong><?php echo $change_status ?></strong>'상태로 변경합니다.</label>
|
||||
<?php if($od_status == '주문' || $od_status == '준비') { ?>
|
||||
<input type="checkbox" name="od_send_mail" value="1" id="od_send_mail" checked="checked">
|
||||
<label for="od_send_mail"><?php echo $change_status; ?>안내 메일</label>
|
||||
<input type="checkbox" name="send_sms" value="1" id="od_send_sms" checked="checked">
|
||||
<label for="od_send_sms"><?php echo $change_status; ?>안내 SMS</label>
|
||||
<?php } ?>
|
||||
<?php if($od_status == '준비') { ?>
|
||||
<input type="checkbox" name="send_escrow" value="1" id="od_send_escrow">
|
||||
<label for="od_send_escrow">에스크로배송등록</label>
|
||||
<?php } ?>
|
||||
<input type="submit" value="선택수정" class="btn_submit" onclick="document.pressed=this.value">
|
||||
<?php } ?>
|
||||
<?php if ($od_status == '주문') { ?> <span>주문상태에서만 삭제가 가능합니다.</span> <input type="submit" value="선택삭제" class="btn_submit" onclick="document.pressed=this.value"><?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="local_desc02 local_desc">
|
||||
<p>
|
||||
<무통장>인 경우에만 <주문>에서 <입금>으로 변경됩니다. 가상계좌는 입금시 자동으로 <입금>처리됩니다.<br>
|
||||
<준비>에서 <배송>으로 변경시 <에스크로배송등록>을 체크하시면 에스크로 주문에 한해 PG사에 배송정보가 자동 등록됩니다.<br>
|
||||
<strong>주의!</strong> 주문번호를 클릭하여 나오는 주문상세내역의 주소를 외부에서 조회가 가능한곳에 올리지 마십시오.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page="); ?>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
$("#fr_date, #to_date").datepicker({ changeMonth: true, changeYear: true, dateFormat: "yy-mm-dd", showButtonPanel: true, yearRange: "c-99:c+99", maxDate: "+0d" });
|
||||
|
||||
// 주문상품보기
|
||||
$(".orderitem").on("click", function() {
|
||||
var $this = $(this);
|
||||
var od_id = $this.text().replace(/[^0-9]/g, "");
|
||||
|
||||
if($this.next("#orderitemlist").length)
|
||||
return false;
|
||||
|
||||
$("#orderitemlist").remove();
|
||||
|
||||
$.post(
|
||||
"./ajax.orderitem.php",
|
||||
{ od_id: od_id },
|
||||
function(data) {
|
||||
$this.after("<div id=\"orderitemlist\"><div class=\"itemlist\"></div></div>");
|
||||
$("#orderitemlist .itemlist")
|
||||
.html(data)
|
||||
.append("<div id=\"orderitemlist_close\"><button type=\"button\" id=\"orderitemlist-x\" class=\"btn_frmline\">닫기</button></div>");
|
||||
}
|
||||
);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// 상품리스트 닫기
|
||||
$("#sodr_list").on("click", "#orderitemlist-x", function(e) {
|
||||
$("#orderitemlist").remove();
|
||||
});
|
||||
|
||||
$("body").on("click", function(e) {
|
||||
if ($(e.target).closest("#orderitemlist").length === 0){
|
||||
$("#orderitemlist").remove();
|
||||
}
|
||||
});
|
||||
|
||||
// 엑셀배송처리창
|
||||
$("#order_delivery").on("click", function() {
|
||||
var opt = "width=600,height=450,left=10,top=10";
|
||||
window.open(this.href, "win_excel", opt);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
function set_date(today)
|
||||
{
|
||||
<?php
|
||||
$date_term = date('w', G5_SERVER_TIME);
|
||||
$week_term = $date_term + 7;
|
||||
$last_term = strtotime(date('Y-m-01', G5_SERVER_TIME));
|
||||
?>
|
||||
if (today == "오늘") {
|
||||
document.getElementById("fr_date").value = "<?php echo G5_TIME_YMD; ?>";
|
||||
document.getElementById("to_date").value = "<?php echo G5_TIME_YMD; ?>";
|
||||
} else if (today == "어제") {
|
||||
document.getElementById("fr_date").value = "<?php echo date('Y-m-d', G5_SERVER_TIME - 86400); ?>";
|
||||
document.getElementById("to_date").value = "<?php echo date('Y-m-d', G5_SERVER_TIME - 86400); ?>";
|
||||
} else if (today == "이번주") {
|
||||
document.getElementById("fr_date").value = "<?php echo date('Y-m-d', strtotime('-'.$date_term.' days', G5_SERVER_TIME)); ?>";
|
||||
document.getElementById("to_date").value = "<?php echo date('Y-m-d', G5_SERVER_TIME); ?>";
|
||||
} else if (today == "이번달") {
|
||||
document.getElementById("fr_date").value = "<?php echo date('Y-m-01', G5_SERVER_TIME); ?>";
|
||||
document.getElementById("to_date").value = "<?php echo date('Y-m-d', G5_SERVER_TIME); ?>";
|
||||
} else if (today == "지난주") {
|
||||
document.getElementById("fr_date").value = "<?php echo date('Y-m-d', strtotime('-'.$week_term.' days', G5_SERVER_TIME)); ?>";
|
||||
document.getElementById("to_date").value = "<?php echo date('Y-m-d', strtotime('-'.($week_term - 6).' days', G5_SERVER_TIME)); ?>";
|
||||
} else if (today == "지난달") {
|
||||
document.getElementById("fr_date").value = "<?php echo date('Y-m-01', strtotime('-1 Month', $last_term)); ?>";
|
||||
document.getElementById("to_date").value = "<?php echo date('Y-m-t', strtotime('-1 Month', $last_term)); ?>";
|
||||
} else if (today == "전체") {
|
||||
document.getElementById("fr_date").value = "";
|
||||
document.getElementById("to_date").value = "";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function forderlist_submit(f)
|
||||
{
|
||||
if (!is_checked("chk[]")) {
|
||||
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
switch (f.od_status.value) {
|
||||
case "" :
|
||||
alert("변경하실 주문상태를 선택하세요.");
|
||||
return false;
|
||||
case '주문' :
|
||||
|
||||
default :
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
if(document.pressed == "선택삭제") {
|
||||
if(confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
|
||||
f.action = "./orderlistdelete.php";
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
var change_status = f.od_status.value;
|
||||
|
||||
if (f.od_status.checked == false) {
|
||||
alert("주문상태 변경에 체크하세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
var chk = document.getElementsByName("chk[]");
|
||||
|
||||
for (var i=0; i<chk.length; i++)
|
||||
{
|
||||
if (chk[i].checked)
|
||||
{
|
||||
var k = chk[i].value;
|
||||
var current_settle_case = f.elements['current_settle_case['+k+']'].value;
|
||||
var current_status = f.elements['current_status['+k+']'].value;
|
||||
|
||||
switch (change_status)
|
||||
{
|
||||
case "입금" :
|
||||
if (!(current_status == "주문" && current_settle_case == "무통장")) {
|
||||
alert("'주문' 상태의 '무통장'(결제수단)인 경우에만 '입금' 처리 가능합니다.");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case "준비" :
|
||||
if (current_status != "입금") {
|
||||
alert("'입금' 상태의 주문만 '준비'로 변경이 가능합니다.");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case "배송" :
|
||||
if (current_status != "준비") {
|
||||
alert("'준비' 상태의 주문만 '배송'으로 변경이 가능합니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
var invoice = f.elements['od_invoice['+k+']'];
|
||||
var invoice_time = f.elements['od_invoice_time['+k+']'];
|
||||
var delivery_company = f.elements['od_delivery_company['+k+']'];
|
||||
|
||||
if ($.trim(invoice_time.value) == '') {
|
||||
alert("배송일시를 입력하시기 바랍니다.");
|
||||
invoice_time.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($.trim(delivery_company.value) == '') {
|
||||
alert("배송업체를 입력하시기 바랍니다.");
|
||||
delivery_company.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($.trim(invoice.value) == '') {
|
||||
alert("운송장번호를 입력하시기 바랍니다.");
|
||||
invoice.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!confirm("선택하신 주문서의 주문상태를 '"+change_status+"'상태로 변경하시겠습니까?"))
|
||||
return false;
|
||||
|
||||
f.action = "./orderlistupdate.php";
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
$sub_menu = '400400';
|
||||
include_once('./_common.php');
|
||||
|
||||
//print_r2($_POST); exit;
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$count_post_chk = (isset($_POST['chk']) && is_array($_POST['chk'])) ? count($_POST['chk']) : 0;
|
||||
|
||||
$sort1 = isset($_POST['sort1']) ? clean_xss_tags($_POST['sort1'], 1, 1) : '';
|
||||
$sort2 = isset($_POST['sort2']) ? clean_xss_tags($_POST['sort2'], 1, 1) : '';
|
||||
$sel_field = isset($_POST['sel_field']) ? clean_xss_tags($_POST['sel_field'], 1, 1) : '';
|
||||
$od_status = isset($_POST['od_status']) ? clean_xss_tags($_POST['od_status'], 1, 1) : '';
|
||||
$od_settle_case = isset($_POST['od_settle_case']) ? clean_xss_tags($_POST['od_settle_case'], 1, 1) : '';
|
||||
$od_misu = isset($_POST['od_misu']) ? clean_xss_tags($_POST['od_misu'], 1, 1) : '';
|
||||
$od_cancel_price = isset($_POST['od_cancel_price']) ? clean_xss_tags($_POST['od_cancel_price'], 1, 1) : '';
|
||||
$od_receipt_price = isset($_POST['od_receipt_price']) ? clean_xss_tags($_POST['od_receipt_price'], 1, 1) : '';
|
||||
$od_receipt_point = isset($_POST['od_receipt_point']) ? clean_xss_tags($_POST['od_receipt_point'], 1, 1) : '';
|
||||
$od_receipt_coupon = isset($_POST['od_receipt_coupon']) ? clean_xss_tags($_POST['od_receipt_coupon'], 1, 1) : '';
|
||||
$search = isset($_POST['search']) ? get_search_string($_POST['search']) : '';
|
||||
|
||||
for ($i=0; $i<$count_post_chk; $i++)
|
||||
{
|
||||
// 실제 번호를 넘김
|
||||
$k = isset($_POST['chk'][$i]) ? $_POST['chk'][$i] : 0;
|
||||
$od_id = isset($_POST['od_id'][$k]) ? safe_replace_regex($_POST['od_id'][$k], 'od_id') : '';
|
||||
|
||||
$od = sql_fetch(" select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' ");
|
||||
if (!$od) continue;
|
||||
|
||||
// 주문상태가 주문이 아니면 건너뜀
|
||||
if($od['od_status'] != '주문') continue;
|
||||
|
||||
$data = serialize($od);
|
||||
|
||||
$sql = " insert {$g5['g5_shop_order_delete_table']} set de_key = '$od_id', de_data = '".addslashes($data)."', mb_id = '{$member['mb_id']}', de_ip = '{$_SERVER['REMOTE_ADDR']}', de_datetime = '".G5_TIME_YMDHIS."' ";
|
||||
sql_query($sql, true);
|
||||
|
||||
// cart 테이블의 상품 상태를 삭제로 변경
|
||||
$sql = " update {$g5['g5_shop_cart_table']} set ct_status = '삭제' where od_id = '$od_id' and ct_status = '주문' ";
|
||||
sql_query($sql);
|
||||
|
||||
$sql = " delete from {$g5['g5_shop_order_table']} where od_id = '$od_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
$qstr = "sort1=$sort1&sort2=$sort2&sel_field=$sel_field&search=$search";
|
||||
$qstr .= "&od_status=$search_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";
|
||||
|
||||
goto_url("./orderlist.php?$qstr");
|
||||
@@ -0,0 +1,223 @@
|
||||
<?php
|
||||
$sub_menu = '400400';
|
||||
include_once('./_common.php');
|
||||
include_once('./admin.shop.lib.php');
|
||||
include_once(G5_LIB_PATH.'/mailer.lib.php');
|
||||
|
||||
check_admin_token();
|
||||
|
||||
define("_ORDERMAIL_", true);
|
||||
|
||||
//print_r2($_POST); exit;
|
||||
|
||||
$sms_count = 0;
|
||||
$sms_messages = array();
|
||||
|
||||
$count_post_chk = (isset($_POST['chk']) && is_array($_POST['chk'])) ? count($_POST['chk']) : 0;
|
||||
$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) : '';
|
||||
|
||||
$sort1 = isset($_POST['sort1']) ? clean_xss_tags($_POST['sort1'], 1, 1) : '';
|
||||
$sort2 = isset($_POST['sort2']) ? clean_xss_tags($_POST['sort2'], 1, 1) : '';
|
||||
$sel_field = isset($_POST['sel_field']) ? clean_xss_tags($_POST['sel_field'], 1, 1) : '';
|
||||
$od_status = isset($_POST['od_status']) ? clean_xss_tags($_POST['od_status'], 1, 1) : '';
|
||||
$od_settle_case = isset($_POST['od_settle_case']) ? clean_xss_tags($_POST['od_settle_case'], 1, 1) : '';
|
||||
$od_misu = isset($_POST['od_misu']) ? clean_xss_tags($_POST['od_misu'], 1, 1) : '';
|
||||
$od_cancel_price = isset($_POST['od_cancel_price']) ? clean_xss_tags($_POST['od_cancel_price'], 1, 1) : '';
|
||||
$od_receipt_price = isset($_POST['od_receipt_price']) ? clean_xss_tags($_POST['od_receipt_price'], 1, 1) : '';
|
||||
$od_receipt_point = isset($_POST['od_receipt_point']) ? clean_xss_tags($_POST['od_receipt_point'], 1, 1) : '';
|
||||
$od_receipt_coupon = isset($_POST['od_receipt_coupon']) ? clean_xss_tags($_POST['od_receipt_coupon'], 1, 1) : '';
|
||||
$search = isset($_POST['search']) ? get_search_string($_POST['search']) : '';
|
||||
|
||||
for ($i=0; $i<$count_post_chk; $i++)
|
||||
{
|
||||
// 실제 번호를 넘김
|
||||
$k = isset($_POST['chk'][$i]) ? $_POST['chk'][$i] : 0;
|
||||
$od_id = isset($_POST['od_id'][$k]) ? safe_replace_regex($_POST['od_id'][$k], 'od_id') : '';
|
||||
|
||||
$invoice = isset($_POST['od_invoice'][$k]) ? clean_xss_tags($_POST['od_invoice'][$k], 1, 1) : '';
|
||||
$invoice_time = isset($_POST['od_invoice_time'][$k]) ? safe_replace_regex($_POST['od_invoice_time'][$k], 'time') : '';
|
||||
$delivery_company = isset($_POST['od_delivery_company'][$k]) ? clean_xss_tags($_POST['od_delivery_company'][$k], 1, 1) : '';
|
||||
|
||||
$od = sql_fetch(" select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' ");
|
||||
if (!$od) continue;
|
||||
|
||||
//change_order_status($od['od_status'], $_POST['od_status'], $od);
|
||||
//echo $od_id . "<br>";
|
||||
|
||||
$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");
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
|
||||
// 제대로된 include 시에만 실행
|
||||
if (!defined("_ORDERMAIL_")) exit;
|
||||
|
||||
// 주문자님께 메일발송 체크를 했다면
|
||||
if ($od_send_mail)
|
||||
{
|
||||
$od = sql_fetch(" select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' ");
|
||||
|
||||
$addmemo = isset($addmemo) ? nl2br(stripslashes($addmemo)) : '';
|
||||
|
||||
$cart_list = array();
|
||||
$card_list = array();
|
||||
$bank_list = array();
|
||||
$point_list = array();
|
||||
$delivery_list = array();
|
||||
|
||||
$sql = " select *
|
||||
from {$g5['g5_shop_cart_table']}
|
||||
where od_id = '{$od['od_id']}'
|
||||
order by ct_id ";
|
||||
$result = sql_query($sql);
|
||||
for ($j=0; $ct=sql_fetch_array($result); $j++) {
|
||||
$cart_list[$j]['it_id'] = $ct['it_id'];
|
||||
$cart_list[$j]['it_name'] = $ct['it_name'];
|
||||
$cart_list[$j]['it_opt'] = $ct['ct_option'];
|
||||
|
||||
$ct_status = $ct['ct_status'];
|
||||
if ($ct_status == "준비") {
|
||||
$ct_status = "상품준비중";
|
||||
} else if ($ct_status == "배송") {
|
||||
$ct_status = "배송중";
|
||||
}
|
||||
|
||||
$cart_list[$j]['ct_status'] = $ct_status;
|
||||
$cart_list[$j]['ct_qty'] = $ct['ct_qty'];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** 입금정보
|
||||
*/
|
||||
$is_receipt = false;
|
||||
|
||||
// 신용카드 입금
|
||||
if ($od['od_receipt_price'] > 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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
$sub_menu = '400400';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
$od_id = isset($_REQUEST['od_id']) ? safe_replace_regex($_REQUEST['od_id'], 'od_id') : '';
|
||||
|
||||
$sql = " select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' ";
|
||||
$od = sql_fetch($sql);
|
||||
|
||||
if(! (isset($od['od_id']) && $od['od_id']))
|
||||
alert_close('주문정보가 존재하지 않습니다.');
|
||||
|
||||
if($od['od_pg'] == 'inicis' && $od['od_settle_case'] == '계좌이체')
|
||||
alert_close('KG이니시스는 신용카드만 부분취소가 가능합니다.');
|
||||
|
||||
if($od['od_settle_case'] == '계좌이체' && substr($od['od_receipt_time'], 0, 10) >= 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']);
|
||||
?>
|
||||
|
||||
<form name="forderpartcancel" method="post" action="./orderpartcancelupdate.php" onsubmit="return form_check(this);">
|
||||
<input type="hidden" name="od_id" value="<?php echo $od_id; ?>">
|
||||
|
||||
<div class="new_win">
|
||||
<h1><?php echo $od['od_settle_case']; ?> 부분취소</h1>
|
||||
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?> 입력</caption>
|
||||
<colgroup>
|
||||
<col class="grid_4">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">취소가능 금액</th>
|
||||
<td><?php echo display_price($od_misu); ?></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="mod_tax_mny">과세 취소금액</label></th>
|
||||
<td><input type="text" name="mod_tax_mny" value="" id="mod_tax_mny" class="frm_input"> 원</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="mod_free_mny">비과세 취소금액</label></th>
|
||||
<td><input type="text" name="mod_free_mny" value="" id="mod_free_mny" class="frm_input"> 원</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="mod_memo">요청사유</label></th>
|
||||
<td><input type="text" name="mod_memo" id="mod_memo" required class="required frm_input" size="50"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_confirm01 btn_confirm">
|
||||
<input type="submit" value="확인" class="btn_submit" accesskey="s">
|
||||
<button type="button" onclick="self.close();">닫기</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
function form_check(f)
|
||||
{
|
||||
var max_mny = parseInt(<?php echo $od_misu; ?>);
|
||||
var tax_mny = parseInt(f.mod_tax_mny.value.replace("/[^0-9]/g", ""));
|
||||
var free_mny = 0;
|
||||
if(typeof f.mod_free.mny.value != "undefined")
|
||||
free_mny = parseInt(f.mod_free_mny.value.replace("/[^0-9]/g", ""));
|
||||
|
||||
if(!tax_mny && !free_mny) {
|
||||
alert("과세 취소금액 또는 비과세 취소금액을 입력해 주십시오.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if((tax_mny && free_mny) && (tax_mny + free_mny) > max_mny) {
|
||||
alert("과세, 비과세 취소금액의 합을 "+number_format(String(max_mny))+"원 이하로 입력해 주십시오.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(tax_mny && tax_mny > max_mny) {
|
||||
alert("과세 취소금액을 "+number_format(String(max_mny))+"원 이하로 입력해 주십시오.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(free_mny && free_mny > max_mny) {
|
||||
alert("비과세 취소금액을 "+number_format(String(max_mny))+"원 이하로 입력해 주십시오.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
$sub_menu = '400400';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
$tax_mny = isset($_POST['mod_tax_mny']) ? preg_replace('/[^0-9]/', '', $_POST['mod_tax_mny']) : 0;
|
||||
$free_mny = isset($_POST['mod_free_mny']) ? preg_replace('/[^0-9]/', '', $_POST['mod_free_mny']) : 0;
|
||||
|
||||
if(!$tax_mny && !$free_mny)
|
||||
alert('과세 취소금액 또는 비과세 취소금액을 입력해 주십시오.');
|
||||
|
||||
if(!trim($mod_memo))
|
||||
alert('요청사유를 입력해 주십시오.');
|
||||
|
||||
// 주문정보
|
||||
$sql = " select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' ";
|
||||
$od = sql_fetch($sql);
|
||||
|
||||
if(! (isset($od['od_id']) && $od['od_id']))
|
||||
alert_close('주문정보가 존재하지 않습니다.');
|
||||
|
||||
if($od['od_settle_case'] == '계좌이체' && substr($od['od_receipt_time'], 0, 10) >= 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');
|
||||
?>
|
||||
|
||||
<script>
|
||||
alert("<?php echo $od['od_settle_case']; ?> 부분취소 처리됐습니다.");
|
||||
opener.document.location.reload();
|
||||
self.close();
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
$sub_menu = '500120';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$g5['title'] = '주문내역출력';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');
|
||||
?>
|
||||
|
||||
<div class="local_sch03 local_sch">
|
||||
|
||||
<div>
|
||||
<form name="forderprint" action="./orderprintresult.php" onsubmit="return forderprintcheck(this);" autocomplete="off">
|
||||
<input type="hidden" name="case" value="1">
|
||||
|
||||
<strong class="sch_long">기간별 출력</strong>
|
||||
<input type="radio" name="csv" value="xls" id="xls1">
|
||||
<label for="xls1">MS엑셀 XLS 데이터</label>
|
||||
<input type="radio" name="csv" value="csv" id="csv1">
|
||||
<label for="csv1">MS엑셀 CSV 데이터</label>
|
||||
<label for="ct_status_p" class="sound_only">출력대상</label>
|
||||
<select name="ct_status" id="ct_status_p">
|
||||
<option value="주문">주문</option>
|
||||
<option value="입금">입금</option>
|
||||
<option value="준비">준비</option>
|
||||
<option value="배송">배송</option>
|
||||
<option value="완료">완료</option>
|
||||
<option value="취소">취소</option>
|
||||
<option value="반품">반품</option>
|
||||
<option value="품절">품절</option>
|
||||
<option value="">전체</option>
|
||||
</select>
|
||||
<label for="fr_date" class="sound_only">기간 시작일</label>
|
||||
<input type="text" name="fr_date" value="<?php echo date("Ymd"); ?>" id="fr_date" required class="required frm_input" size="10" maxlength="8">
|
||||
~
|
||||
<label for="to_date" class="sound_only">기간 종료일</label>
|
||||
<input type="text" name="to_date" value="<?php echo date("Ymd"); ?>" id="to_date" required class="required frm_input" size="10" maxlength="8">
|
||||
<input type="submit" value="출력 (새창)" class="btn_submit">
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="sch_last">
|
||||
|
||||
<form name="forderprint" action="./orderprintresult.php" onsubmit="return forderprintcheck(this);" autocomplete="off" >
|
||||
<input type="hidden" name="case" value="2">
|
||||
<strong class="sch_long">주문번호구간별 출력</strong>
|
||||
|
||||
<input type="radio" name="csv" value="xls" id="xls2">
|
||||
<label for="xls2">MS엑셀 XLS 데이터</label>
|
||||
<input type="radio" name="csv" value="csv" id="csv2">
|
||||
<label for="csv2">MS엑셀 CSV 데이터</label>
|
||||
<label for="ct_status_n" class="sound_only">출력대상</label>
|
||||
<select name="ct_status" id="ct_status_n">
|
||||
<option value="주문">주문</option>
|
||||
<option value="입금">입금</option>
|
||||
<option value="준비">준비</option>
|
||||
<option value="배송">배송</option>
|
||||
<option value="완료">완료</option>
|
||||
<option value="취소">취소</option>
|
||||
<option value="반품">반품</option>
|
||||
<option value="품절">품절</option>
|
||||
<option value="">전체</option>
|
||||
</select>
|
||||
<label for="fr_od_id" class="sound_only">주문번호 구간 시작</label>
|
||||
<input type="text" name="fr_od_id" id="fr_od_id" required class="required frm_input" size="10" maxlength="20">
|
||||
~
|
||||
<label for="fr_od_id" class="sound_only">주문번호 구간 종료</label>
|
||||
<input type="text" name="to_od_id" id="to_od_id" required class="required frm_input" size="10" maxlength="20">
|
||||
<input type="submit" value="출력 (새창)" class="btn_submit">
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<a href="./orderlist.php" class="btn_01 btn ">주문내역</a>
|
||||
</div>
|
||||
|
||||
<div class="local_desc01 local_desc">
|
||||
<p>기간별 혹은 주문번호구간별 주문내역을 새창으로 출력할 수 있습니다.</p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
$("#fr_date, #to_date").datepicker({ changeMonth: true, changeYear: true, dateFormat: "yymmdd", showButtonPanel: true, yearRange: "c-99:c+99", maxDate: "+0d" });
|
||||
});
|
||||
|
||||
function forderprintcheck(f)
|
||||
{
|
||||
if (f.csv[0].checked || f.csv[1].checked)
|
||||
{
|
||||
f.target = "_top";
|
||||
}
|
||||
else
|
||||
{
|
||||
var win = window.open("", "winprint", "left=10,top=10,width=670,height=800,menubar=yes,toolbar=yes,scrollbars=yes");
|
||||
f.target = "winprint";
|
||||
}
|
||||
|
||||
f.submit();
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,504 @@
|
||||
<?php
|
||||
$sub_menu = '500120';
|
||||
include_once('./_common.php');
|
||||
|
||||
$fr_date = isset($_REQUEST['fr_date']) ? preg_replace('/[^0-9 :_\-]/i', '', $_REQUEST['fr_date']) : '';
|
||||
$to_date = isset($_REQUEST['to_date']) ? preg_replace('/[^0-9 :_\-]/i', '', $_REQUEST['to_date']) : '';
|
||||
$fr_od_id = isset($_REQUEST['fr_od_id']) ? preg_replace('/[^0-9]/i', '', $_REQUEST['fr_od_id']) : '';
|
||||
$to_od_id = isset($_REQUEST['to_od_id']) ? preg_replace('/[^0-9]/i', '', $_REQUEST['to_od_id']) : '';
|
||||
|
||||
$csv = isset($_REQUEST['csv']) ? clean_xss_tags($_REQUEST['csv'], 1, 1) : '';
|
||||
|
||||
$tot_tot_qty = 0;
|
||||
$tot_tot_price = 0;
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
//print_r2($_GET); exit;
|
||||
|
||||
/*
|
||||
function multibyte_digit($source)
|
||||
{
|
||||
$search = array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
|
||||
$replace = array("0","1","2","3","4","5","6","7","8","9");
|
||||
return str_replace($search, $replace, (string)$source);
|
||||
}
|
||||
*/
|
||||
|
||||
function conv_telno($t)
|
||||
{
|
||||
// 숫자만 있고 0으로 시작하는 전화번호
|
||||
if (!preg_match("/[^0-9]/", $t) && preg_match("/^0/", $t)) {
|
||||
if (preg_match("/^01/", $t)) {
|
||||
$t = preg_replace("/([0-9]{3})(.*)([0-9]{4})/", "\\1-\\2-\\3", $t);
|
||||
} else if (preg_match("/^02/", $t)) {
|
||||
$t = preg_replace("/([0-9]{2})(.*)([0-9]{4})/", "\\1-\\2-\\3", $t);
|
||||
} else {
|
||||
$t = preg_replace("/([0-9]{3})(.*)([0-9]{4})/", "\\1-\\2-\\3", $t);
|
||||
}
|
||||
}
|
||||
|
||||
return $t;
|
||||
}
|
||||
|
||||
// 1.04.01
|
||||
// MS엑셀 CSV 데이터로 다운로드 받음
|
||||
if ($csv == 'csv')
|
||||
{
|
||||
$fr_date = date_conv($fr_date);
|
||||
$to_date = date_conv($to_date);
|
||||
|
||||
|
||||
$sql = " SELECT a.od_id, od_b_zip1, od_b_zip2, od_b_addr1, od_b_addr2, od_b_addr3, od_b_addr_jibeon, od_b_name, od_b_tel, od_b_hp, b.it_name, ct_qty, b.it_id, od_memo, od_invoice, b.ct_option, b.ct_send_cost, b.it_sc_type
|
||||
FROM {$g5['g5_shop_order_table']} a, {$g5['g5_shop_cart_table']} b
|
||||
where a.od_id = b.od_id ";
|
||||
if ($case == 1) // 출력기간
|
||||
$sql .= " and a.od_time between '$fr_date 00:00:00' and '$to_date 23:59:59' ";
|
||||
else // 주문번호구간
|
||||
$sql .= " 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 od_time asc, b.it_id, b.io_type, b.ct_id ";
|
||||
$result = sql_query($sql);
|
||||
$cnt = @sql_num_rows($result);
|
||||
if (!$cnt)
|
||||
alert("출력할 내역이 없습니다.");
|
||||
|
||||
//header('Content-Type: text/x-csv');
|
||||
header("Content-Type: text/csv; charset=utf-8");
|
||||
header('Content-Type: doesn/matter');
|
||||
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Content-Disposition: attachment; filename="orderlist-' . date("ymd", time()) . '.csv"');
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
header('Pragma: public');
|
||||
|
||||
//echo "우편번호,주소,이름,전화1,전화2,상품명,수량,비고,전하실말씀\n";
|
||||
echo iconv('utf-8', 'euc-kr', "우편번호,주소,이름,전화1,전화2,상품명,수량,선택사항,배송비,상품코드,주문번호,운송장번호,전하실말씀\n");
|
||||
|
||||
$save_it_id = '';
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
$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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
echo '"\''.$row['od_b_zip1'].$row['od_b_zip2'].'"\''.',';
|
||||
echo '"'.$pull_address.'"'.',';
|
||||
echo '"'.$row['od_b_name'].'"'.',';
|
||||
//echo '"'.multibyte_digit((string)$row[od_b_tel]).'"'.',';
|
||||
//echo '"'.multibyte_digit((string)$row[od_b_hp]).'"'.',';
|
||||
echo '"'.conv_telno($row['od_b_tel']) . '"'.',';
|
||||
echo '"'.conv_telno($row['od_b_hp']) . '"'.',';
|
||||
echo '"'.preg_replace("/\"/", """, $row['it_name']) . '"'.',';
|
||||
echo '"'.$row['ct_qty'].'"'.',';
|
||||
echo '"'.$row['ct_option'].'"'.',';
|
||||
echo '"'.$ct_send_cost.'"'.',';
|
||||
echo '"\''.$row['it_id'].'\'"'.',';
|
||||
echo '"\''.$row['od_id'].'\'"'.',';
|
||||
echo '"'.$row['od_invoice'].'"'.',';
|
||||
//echo '"'.preg_replace("/\"/", """, preg_replace("/\n/", "", $row[od_memo])).'"';
|
||||
echo '"'.preg_replace("/\"/", """, $row['od_memo']).'"';
|
||||
echo "\n";
|
||||
}
|
||||
if ($i == 0)
|
||||
echo '자료가 없습니다.'.PHP_EOL;
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
if(! function_exists('column_char')) {
|
||||
function column_char($i) {
|
||||
return chr( 65 + $i );
|
||||
}
|
||||
}
|
||||
|
||||
// MS엑셀 XLS 데이터로 다운로드 받음
|
||||
if ($csv == 'xls')
|
||||
{
|
||||
$fr_date = date_conv($fr_date);
|
||||
$to_date = date_conv($to_date);
|
||||
|
||||
$sql = " SELECT a.od_id, od_b_zip1, od_b_zip2, od_b_addr1, od_b_addr2, od_b_addr3, od_b_addr_jibeon, od_b_name, od_b_tel, od_b_hp, b.it_name, ct_qty, b.it_id, od_memo, od_invoice, b.ct_option, b.ct_send_cost, b.it_sc_type
|
||||
FROM {$g5['g5_shop_order_table']} a, {$g5['g5_shop_cart_table']} b
|
||||
where a.od_id = b.od_id ";
|
||||
if ($case == 1) // 출력기간
|
||||
$sql .= " and a.od_time between '$fr_date 00:00:00' and '$to_date 23:59:59' ";
|
||||
else // 주문번호구간
|
||||
$sql .= " 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 od_time asc, b.it_id, b.io_type, b.ct_id ";
|
||||
$result = sql_query($sql);
|
||||
$cnt = @sql_num_rows($result);
|
||||
if (!$cnt)
|
||||
alert("출력할 내역이 없습니다.");
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
|
||||
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 "<script>alert('출력할 내역이 없습니다.'); window.close();</script>";
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="sodr_print_pop" class="new_win">
|
||||
<h1>
|
||||
<?php
|
||||
if ($case == 1)
|
||||
echo $fr_date.' 부터 '.$to_date.' 까지 '.$ct_status.' 내역';
|
||||
else
|
||||
echo $fr_od_id.' 부터 '.$to_od_id.' 까지 '.$ct_status.' 내역';
|
||||
?>
|
||||
</h1>
|
||||
|
||||
<?php
|
||||
$mod = 10;
|
||||
$tot_total_price = 0;
|
||||
$save_it_id = '';
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
$sql1 = " select * from {$g5['g5_shop_order_table']} where od_id = '{$row['od_id']}' ";
|
||||
$row1 = sql_fetch($sql1);
|
||||
|
||||
// 1.03.02
|
||||
$row1['od_addr'] = '('.$row1['od_zip1'].$row1['od_zip2'].') '.print_address($row1['od_addr1'], $row1['od_addr2'], $row1['od_addr3'], $row1['od_addr_jibeon']);
|
||||
$row1['od_b_addr'] = '('.$row1['od_b_zip1'].$row1['od_b_zip2'].') '.print_address($row1['od_b_addr1'], $row1['od_b_addr2'], $row1['od_b_addr3'], $row1['od_b_addr_jibeon']);
|
||||
|
||||
$row1['od_addr'] = ($row1['od_addr']) ? $row1['od_addr'] : '입력안함';
|
||||
$row1['od_tel'] = ($row1['od_tel']) ? $row1['od_tel'] : '입력안함';
|
||||
$row1['od_hp'] = ($row1['od_hp']) ? $row1['od_hp'] : '입력안함';
|
||||
$row1['od_b_tel'] = ($row1['od_b_tel']) ? $row1['od_b_tel'] : '입력안함';
|
||||
$row1['od_b_hp'] = ($row1['od_b_hp']) ? $row1['od_b_hp'] : '입력안함';
|
||||
|
||||
// 보내는 사람과 받는 사람이 완전 일치하면 간단하게 출력
|
||||
// 보내는 사람과 받는 사람이 부분 일치하더라도 원래 내용을 모두 출력
|
||||
// 지운아빠 2013-04-18
|
||||
if ($row1['od_name'] == $row1['od_b_name'] && $row1['od_addr'] == $row1['od_b_addr'] && $row1['od_tel'] == $row1['od_b_tel'] && $row1['od_hp'] == $row1['od_b_hp'] && $row1['od_hp'] != " ") $samesamesame = 1;
|
||||
else $samesamesame = '';
|
||||
|
||||
$od_memo = ($row1['od_memo']) ? get_text(stripslashes($row1['od_memo'])) : '';
|
||||
$od_shop_memo = ($row1['od_shop_memo']) ? get_text(stripslashes($row1['od_shop_memo'])) : '';
|
||||
?>
|
||||
<!-- 반복시작 - 지운아빠 2013-04-18 -->
|
||||
<div class="sodr_print_pop_list">
|
||||
<h2>주문번호 <?php echo $row1['od_id']; ?></h2>
|
||||
<h3>보내는 사람 : <?php echo get_text($row1['od_name']); ?></h3>
|
||||
|
||||
<dl>
|
||||
<dt>주소</dt>
|
||||
<dd><?php echo get_text($row1['od_addr']); ?></dd>
|
||||
<dt>휴대폰</dt>
|
||||
<dd><?php echo get_text($row1['od_hp']); ?></dd>
|
||||
<dt>전화번호</dt>
|
||||
<dd><?php echo get_text($row1['od_tel']); ?></dd>
|
||||
</dl>
|
||||
<?php if ($samesamesame) { ?>
|
||||
<p class="sodr_print_pop_same">보내는 사람과 받는 사람이 동일합니다.</p>
|
||||
<?php } else { ?>
|
||||
<h3>받는 사람 : <?php echo get_text($row1['od_b_name']); ?></h3>
|
||||
<dl>
|
||||
<dt>주소</dt>
|
||||
<dd><?php echo get_text($row1['od_b_addr']); ?></dd>
|
||||
<dt>휴대폰</dt>
|
||||
<dd><?php echo get_text($row1['od_b_hp']); ?></dd>
|
||||
<dt>전화번호</dt>
|
||||
<dd><?php echo get_text($row1['od_b_tel']); ?></dd>
|
||||
</dl>
|
||||
<?php } ?>
|
||||
|
||||
<h3>주문 목록</h3>
|
||||
<div class="tbl_head01">
|
||||
<table>
|
||||
<caption>주문 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">상품명(선택사항)</th>
|
||||
<th scope="col">판매가</th>
|
||||
<th scope="col">수량</th>
|
||||
<th scope="col">소계</th>
|
||||
<th scope="col">배송비</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$sql2 = " select *
|
||||
from {$g5['g5_shop_cart_table']}
|
||||
where od_id = '{$row['od_id']}' ";
|
||||
if ($ct_status)
|
||||
$sql2 .= " and ct_status = '$ct_status' ";
|
||||
$sql2 .= " order by it_id, io_type, ct_id ";
|
||||
|
||||
$res2 = sql_query($sql2);
|
||||
$cnt = $sub_tot_qty = $sub_tot_price = 0;
|
||||
$save_it_id = '';
|
||||
|
||||
while ($row2 = sql_fetch_array($res2))
|
||||
{
|
||||
if($row2['io_type']) {
|
||||
$it_price = $row2['io_price'];
|
||||
$row2_tot_price = $row2['io_price'] * $row2['ct_qty'];
|
||||
} else {
|
||||
$it_price = $row2['ct_price'] + $row2['io_price'];
|
||||
$row2_tot_price = ($row2['ct_price'] + $row2['io_price']) * $row2['ct_qty'];
|
||||
}
|
||||
$sub_tot_qty += $row2['ct_qty'];
|
||||
$sub_tot_price += $row2_tot_price;
|
||||
|
||||
$it_name = stripslashes($row2['it_name']);
|
||||
$price_plus = '';
|
||||
if($row2['io_price'] >= 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 = "<strong>";
|
||||
$fontqty2 = "</strong>";
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $it_name; ?></td>
|
||||
<td class="td_num"><?php echo number_format($it_price); ?></td>
|
||||
<td class="td_cntsmall"><?php echo $fontqty1; ?><?php echo number_format($row2['ct_qty']); ?><?php echo $fontqty2; ?></td>
|
||||
<td class="td_num td_numsum"><?php echo number_format($row2_tot_price); ?></td>
|
||||
<td class="td_sendcost_by"><?php echo $ct_send_cost; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$cnt++;
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td>배송비</td>
|
||||
<td class="td_num"><?php echo number_format($row1['od_send_cost']); ?></td>
|
||||
<td class="td_cntsmall"><?php echo $fontqty1; ?>1<?php echo $fontqty2; ?></td>
|
||||
<td class="td_num td_numsum"><?php echo number_format($row1['od_send_cost']); ?></td>
|
||||
<td class="td_sendcost_by"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>추가 배송비</td>
|
||||
<td class="td_num"><?php echo number_format($row1['od_send_cost2']); ?></td>
|
||||
<td class="td_cntsmall"><?php echo $fontqty1; ?>1<?php echo $fontqty2; ?></td>
|
||||
<td class="td_num td_numsum"><?php echo number_format($row1['od_send_cost2']); ?></td>
|
||||
<td class="td_sendcost_by"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th scope="row" colspan="2">합계</th>
|
||||
<td><?php echo number_format($sub_tot_qty + 2); ?></td>
|
||||
<td><?php echo number_format($sub_tot_price + $row1['od_send_cost'] + $row1['od_send_cost2']); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
$tot_tot_qty += ($sub_tot_qty + 2);
|
||||
$tot_tot_price += ($sub_tot_price + $row1['od_send_cost'] + $row1['od_send_cost2']);
|
||||
|
||||
if ($od_memo) $od_memo = "<p><strong>비고</strong> $od_memo</p>";
|
||||
if ($od_shop_memo) $od_shop_memo = "<p><strong>상점메모</strong> $od_shop_memo</p>";
|
||||
|
||||
echo "
|
||||
$od_memo
|
||||
$od_shop_memo
|
||||
";
|
||||
?>
|
||||
</div>
|
||||
<!-- 반복 끝 -->
|
||||
<?php } ?>
|
||||
|
||||
<div id="sodr_print_pop_total">
|
||||
<span>
|
||||
전체
|
||||
<strong><?php echo number_format($tot_tot_qty); ?></strong>개
|
||||
<strong><?php echo number_format($tot_tot_price); ?></strong>원
|
||||
</span>
|
||||
<출력 끝>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
if (!defined("_ORDERSMS_")) exit;
|
||||
|
||||
$receive_number = preg_replace("/[^0-9]/", "", $od_hp); // 수신자번호 (받는사람 핸드폰번호 ... 여기서는 주문자님의 핸드폰번호임)
|
||||
$send_number = preg_replace("/[^0-9]/", "", $default['de_admin_company_tel']); // 발신자번호
|
||||
|
||||
if ($config['cf_sms_use']) {
|
||||
$sms_messages = array();
|
||||
|
||||
if ($od_sms_ipgum_check && $default['de_sms_use4'])
|
||||
{
|
||||
if ($od_bank_account && $od_receipt_price && $od_deposit_name)
|
||||
{
|
||||
$sms_contents = $default['de_sms_cont4'];
|
||||
$sms_contents = str_replace("{이름}", $od_name, $sms_contents);
|
||||
$sms_contents = str_replace("{입금액}", number_format($od_receipt_price), $sms_contents);
|
||||
$sms_contents = str_replace("{주문번호}", $od_id, $sms_contents);
|
||||
$sms_contents = str_replace("{회사명}", $default['de_admin_company_name'], $sms_contents);
|
||||
|
||||
if($receive_number)
|
||||
$sms_messages[] = array('recv' => $receive_number, 'send' => $send_number, 'cont' => $sms_contents);
|
||||
}
|
||||
}
|
||||
|
||||
if ($od_sms_baesong_check && $default['de_sms_use5'])
|
||||
{
|
||||
if ($od_delivery_company && $od_invoice)
|
||||
{
|
||||
$sms_contents = $default['de_sms_cont5'];
|
||||
$sms_contents = str_replace("{이름}", $od_name, $sms_contents);
|
||||
$sms_contents = str_replace("{택배회사}", $od_delivery_company, $sms_contents);
|
||||
$sms_contents = str_replace("{운송장번호}", $od_invoice, $sms_contents);
|
||||
$sms_contents = str_replace("{주문번호}", $od_id, $sms_contents);
|
||||
$sms_contents = str_replace("{회사명}", $default['de_admin_company_name'], $sms_contents);
|
||||
|
||||
if($receive_number)
|
||||
$sms_messages[] = array('recv' => $receive_number, 'send' => $send_number, 'cont' => $sms_contents);
|
||||
}
|
||||
}
|
||||
|
||||
$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(); // 보관하고 있던 결과값을 지웁니다.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 리빌더 20241016 추가 { */
|
||||
if($od['mb_id']) {
|
||||
if ($od_sms_ipgum_check) {
|
||||
|
||||
$od_al = "입금확인 안내
|
||||
|
||||
입금금액 : ".number_format($od_receipt_price)."원
|
||||
주문번호 : ".$od_id;
|
||||
|
||||
//입금발송
|
||||
memo_auto_send($od_al, '', $od['mb_id'], "system-msg");
|
||||
}
|
||||
|
||||
if ($od_sms_baesong_check) {
|
||||
|
||||
$od_al = "주문 상품 배송처리 안내
|
||||
|
||||
배송사 : ".$od_delivery_company."
|
||||
운송장번호 : ".$od_invoice."
|
||||
주문번호 : ".$od_id;
|
||||
|
||||
//배송발송
|
||||
memo_auto_send($od_al, '', $od['mb_id'], "system-msg");
|
||||
}
|
||||
}
|
||||
/* } */
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
$sub_menu = '400440';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, 'w');
|
||||
|
||||
$g5['title'] = '개인결제 복사';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
$sql = " select * from {$g5['g5_shop_personalpay_table']} where pp_id = '$pp_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if(!$row['pp_id'])
|
||||
alert_close('복사하시려는 개인결제 정보가 존재하지 않습니다.');
|
||||
?>
|
||||
|
||||
<div class="new_win">
|
||||
<h1>개인결제 복사</h1>
|
||||
|
||||
<form name="fpersonalpaycopy" method="post" action="./personalpaycopyupdate.php" onsubmit="return form_check(this);">
|
||||
<input type="hidden" name="pp_id" value="<?php echo $pp_id; ?>">
|
||||
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?></caption>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><label for="pp_name">이름</label></th>
|
||||
<td><input type="text" name="pp_name" value="<?php echo $row['pp_name']; ?>" id="pp_name" required class="required frm_input"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="od_id">주문번호</label></th>
|
||||
<td><input type="text" name="od_id" value="<?php echo $row['od_id']; ?>" id="od_id" class="frm_input"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="pp_price">주문금액</label></th>
|
||||
<td><input type="text" name="pp_price" value="" id="pp_price" required class="required frm_input" size="20"> 원</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_confirm01 btn_confirm">
|
||||
<input type="submit" value="복사하기" class="btn_submit">
|
||||
<button type="button" onclick="self.close();">창닫기</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// <![CDATA[
|
||||
function form_check(f)
|
||||
{
|
||||
if(f.pp_price.value.replace(/[0-9]/g, "").length > 0) {
|
||||
alert("주문금액은 숫자만 입력해 주십시오");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
$sub_menu = '400440';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, 'w');
|
||||
|
||||
$_POST = array_map('trim', $_POST);
|
||||
|
||||
if(!$_POST['pp_name'])
|
||||
alert('이름을 입력해 주십시오.');
|
||||
if(!$_POST['pp_price'])
|
||||
alert('주문금액을 입력해 주십시오.');
|
||||
if(preg_match('/[^0-9]/', $_POST['pp_price']))
|
||||
alert('주문금액은 숫자만 입력해 주십시오.');
|
||||
|
||||
if($_POST['od_id']) {
|
||||
$sql = " select od_id from {$g5['g5_shop_order_table']} where od_id = '{$_POST['od_id']}' ";
|
||||
$od = sql_fetch($sql);
|
||||
if(!$od['od_id'])
|
||||
alert('입력하신 주문번호는 존재하지 않습니다.');
|
||||
}
|
||||
|
||||
$sql = " select * from {$g5['g5_shop_personalpay_table']} where pp_id = '$pp_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if(!$row['pp_id'])
|
||||
alert_close('복사하시려는 개인결제 정보가 존재하지 않습니다.');
|
||||
|
||||
$new_pp_id = get_uniqid();
|
||||
|
||||
$sql = " insert into {$g5['g5_shop_personalpay_table']}
|
||||
set pp_id = '$new_pp_id',
|
||||
od_id = '{$_POST['od_id']}',
|
||||
pp_name = '{$_POST['pp_name']}',
|
||||
pp_content = '{$row['pp_content']}',
|
||||
pp_use = '{$row['pp_use']}',
|
||||
pp_price = '{$_POST['pp_price']}',
|
||||
pp_ip = '{$_SERVER['REMOTE_ADDR']}',
|
||||
pp_time = '".G5_TIME_YMDHIS."' ";
|
||||
sql_query($sql);
|
||||
|
||||
$g5['title'] = '개인결제 복사';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
?>
|
||||
|
||||
<script>
|
||||
alert("개인결제 정보가 복사되었습니다.");
|
||||
window.opener.location.reload();
|
||||
self.close();
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
@@ -0,0 +1,289 @@
|
||||
<?php
|
||||
$sub_menu = '400440';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "w");
|
||||
|
||||
$g5['title'] = '개인결제 관리';
|
||||
|
||||
$pp_id = isset($_REQUEST['pp_id']) ? safe_replace_regex($_REQUEST['pp_id'], 'pp_id') : '';
|
||||
$popup = isset($_REQUEST['popup']) ? clean_xss_tags($_REQUEST['popup'], 1, 1) : '';
|
||||
$od_id = isset($_REQUEST['od_id']) ? safe_replace_regex($_REQUEST['od_id'], 'od_id') : '';
|
||||
|
||||
$pp = array('pp_name'=>'', 'pp_price'=>0, 'od_id'=>'', 'pp_content'=>'', 'pp_settle_case'=>'', 'pp_receipt_time'=>'', 'pp_receipt_price'=>0, 'pp_shop_memo'=>'');
|
||||
|
||||
if ($w == 'u') {
|
||||
$html_title = '개인결제 수정';
|
||||
|
||||
$sql = " select * from {$g5['g5_shop_personalpay_table']} where pp_id = '$pp_id' ";
|
||||
$pp = sql_fetch($sql);
|
||||
if (!$pp['pp_id']) alert('등록된 자료가 없습니다.');
|
||||
}
|
||||
else
|
||||
{
|
||||
$html_title = '개인결제 입력';
|
||||
$pp['pp_use'] = 1;
|
||||
}
|
||||
|
||||
$wrp_tag_st = '';
|
||||
$wrp_tag_end = '';
|
||||
if($popup == 'yes') { // 팝업창일 때
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
$pp['od_id'] = $od_id;
|
||||
$sql = " select od_id, od_name, od_misu
|
||||
from {$g5['g5_shop_order_table']}
|
||||
where od_id = '$od_id' ";
|
||||
$od = sql_fetch($sql);
|
||||
|
||||
if(!$od['od_id'])
|
||||
alert_close('주문정보가 존재하지 않습니다.');
|
||||
|
||||
$pp['pp_name'] = $od['od_name'];
|
||||
|
||||
if($od['od_misu'] > 0)
|
||||
$pp['pp_price'] = $od['od_misu'];
|
||||
$wrp_tag_st = '<div class="new_win">'.PHP_EOL.'<h1 id="new_win_title">'.$html_title.'</h1>';
|
||||
$wrp_tag_end = '</div>';
|
||||
|
||||
echo '<script>
|
||||
if (typeof g5_admin_csrf_token_key === "undefined") {
|
||||
var g5_admin_csrf_token_key = "' . (function_exists('admin_csrf_token_key') ? admin_csrf_token_key() : '') . '";
|
||||
}
|
||||
</script>';
|
||||
}
|
||||
else { // 현재페이지일 때
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
}
|
||||
$pg_anchor = '<ul class="anchor">
|
||||
<li><a href="#anc_spp_info">주문 정보</a></li>
|
||||
<li><a href="#anc_spp_pay">결제 정보</a></li>
|
||||
</ul>';
|
||||
|
||||
// pg 설정 필드 추가
|
||||
if(!sql_query(" select pp_pg from {$g5['g5_shop_personalpay_table']} limit 1 ", false)) {
|
||||
sql_query(" ALTER TABLE `{$g5['g5_shop_personalpay_table']}`
|
||||
ADD `pp_pg` varchar(255) NOT NULL DEFAULT '' AFTER `pp_price` ", true);
|
||||
|
||||
// 개인결제 PG kcp로 설정
|
||||
sql_query(" update {$g5['g5_shop_personalpay_table']} set pp_pg = 'kcp' ");
|
||||
}
|
||||
|
||||
// 현금영수증 필드 추가
|
||||
if(!sql_query(" select pp_cash from {$g5['g5_shop_personalpay_table']} limit 1 ", false)) {
|
||||
sql_query(" ALTER TABLE `{$g5['g5_shop_personalpay_table']}`
|
||||
ADD `pp_cash` tinyint(4) NOT NULL DEFAULT '0' AFTER `pp_shop_memo`,
|
||||
ADD `pp_cash_no` varchar(255) NOT NULL DEFAULT '' AFTER `pp_cash`,
|
||||
ADD `pp_cash_info` text NOT NULL AFTER `pp_cash_no`,
|
||||
ADD `pp_email` varchar(255) NOT NULL DEFAULT '' AFTER `pp_name`,
|
||||
ADD `pp_hp` varchar(255) NOT NULL DEFAULT '' AFTER `pp_email`,
|
||||
ADD `pp_casseqno` varchar(255) NOT NULL DEFAULT '' AFTER `pp_app_no` ", true);
|
||||
}
|
||||
?>
|
||||
|
||||
<form name="fpersonalpayform" action="./personalpayformupdate.php" method="post" onsubmit="return form_check(this);">
|
||||
<input type="hidden" name="w" value="<?php echo $w; ?>">
|
||||
<input type="hidden" name="pp_id" value="<?php echo $pp_id; ?>">
|
||||
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
|
||||
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
|
||||
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
|
||||
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
<input type="hidden" name="popup" value="<?php echo $popup; ?>">
|
||||
<?php if($popup == 'yes') { ?>
|
||||
<input type="hidden" name="pp_use" value="1">
|
||||
<?php } ?>
|
||||
|
||||
<?php echo $wrp_tag_st; ?>
|
||||
|
||||
<section id="anc_spp_info">
|
||||
<h2 class="h2_frm">주문 정보</h2>
|
||||
<?php if($popup != 'yes') echo $pg_anchor; ?>
|
||||
<div class="local_desc">
|
||||
<p>주문 관련 기본 정보입니다.</p>
|
||||
</div>
|
||||
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<caption>주문 정보 목록</caption>
|
||||
<colgroup>
|
||||
<col class="grid_4">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><label for="pp_name">이름</label></th>
|
||||
<td><input type="text" name="pp_name" value="<?php echo get_text($pp['pp_name']); ?>" id="pp_name" required class="required frm_input"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="pp_price">주문금액</label></th>
|
||||
<td><input type="text" name="pp_price" value="<?php echo $pp['pp_price']; ?>" id="pp_price" required class="required frm_input" size="15"> 원</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="od_id">주문번호</label></th>
|
||||
<td><input type="text" name="od_id" value="<?php echo $pp['od_id'] ? $pp['od_id'] : ''; ?>" id="od_id" class="frm_input" size="20"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="pp_content">내용</label></th>
|
||||
<td><textarea name="pp_content" id="pp_content" rows="8"><?php echo html_purifier($pp['pp_content']); ?></textarea></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<?php if($popup != 'yes') { ?>
|
||||
<section id="anc_spp_pay" class="cbox">
|
||||
<h2 class="h2_frm">결제 정보</h2>
|
||||
<?php echo $pg_anchor; ?>
|
||||
<div class="local_desc02 local_desc">
|
||||
<p>결제 관련 정보입니다.</p>
|
||||
</div>
|
||||
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<caption>결제 정보 목록</caption>
|
||||
<colgroup>
|
||||
<col class="grid_4">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<?php if($popup != 'yes') { ?>
|
||||
<tr>
|
||||
<th scope="row"><label for="pp_receipt_price">결제금액</label></th>
|
||||
<td><input type="text" name="pp_receipt_price" value="<?php echo $pp['pp_receipt_price'] ? $pp['pp_receipt_price'] : ''; ?>" id="pp_receipt_price" class="frm_input" size="15"> 원</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="pp_settle_case">결제방법</label></th>
|
||||
<td>
|
||||
<select name="pp_settle_case" id="pp_settle_case">
|
||||
<option value="" <?php echo get_selected($pp['pp_settle_case'], ''); ?>>선택</option>
|
||||
<option value="무통장" <?php echo get_selected($pp['pp_settle_case'], '무통장'); ?>>무통장</option>
|
||||
<option value="계좌이체" <?php echo get_selected($pp['pp_settle_case'], '계좌이체'); ?>>계좌이체</option>
|
||||
<option value="가상계좌" <?php echo get_selected($pp['pp_settle_case'], '가상계좌'); ?>>가상계좌</option>
|
||||
<option value="신용카드" <?php echo get_selected($pp['pp_settle_case'], '신용카드'); ?>>신용카드</option>
|
||||
<option value="휴대폰" <?php echo get_selected($pp['pp_settle_case'], '휴대폰'); ?>>휴대폰</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="pp_receipt_time">결제일시</label></th>
|
||||
<td>
|
||||
<input type="checkbox" name="pp_receipt_chk" id="pp_receipt_chk" value="<?php echo date("Y-m-d H:i:s", G5_SERVER_TIME); ?>" onclick="if (this.checked == true) this.form.pp_receipt_time.value=this.form.pp_receipt_chk.value; else this.form.pp_receipt_time.value = this.form.pp_receipt_time.defaultValue;">
|
||||
<label for="pp_receipt_chk">현재 시간으로 설정</label><br>
|
||||
<input type="text" name="pp_receipt_time" value="<?php echo is_null_time($pp['pp_receipt_time']) ? "" : $pp['pp_receipt_time']; ?>" id="pp_receipt_time" class="frm_input" maxlength="19">
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$is_cash_receipt = true;
|
||||
|
||||
// 주문내역이 있으면 현금영수증 발급하지 않음
|
||||
if($pp['od_id']) {
|
||||
$sql = " select count(od_id) as cnt from {$g5['g5_shop_order_table']} where od_id = '{$pp['od_id']}' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if($row['cnt'] > 0)
|
||||
$is_cash_receipt = false;
|
||||
}
|
||||
|
||||
if ($is_cash_receipt && ($pp['pp_price'] - $pp['pp_receipt_price']) == 0) {
|
||||
if ($pp['pp_receipt_price'] && ($pp['pp_settle_case'] == '무통장' || $pp['pp_settle_case'] == '가상계좌' || $pp['pp_settle_case'] == '계좌이체')) {
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row">현금영수증</th>
|
||||
<td>
|
||||
<?php
|
||||
if ($pp['pp_cash']) {
|
||||
if($pp['pp_pg'] == 'lg') {
|
||||
require G5_SHOP_PATH.'/settle_lg.inc.php';
|
||||
|
||||
switch($pp['pp_settle_case']) {
|
||||
case '계좌이체':
|
||||
$trade_type = 'BANK';
|
||||
break;
|
||||
case '가상계좌':
|
||||
$trade_type = 'CAS';
|
||||
break;
|
||||
default:
|
||||
$trade_type = 'CR';
|
||||
break;
|
||||
}
|
||||
$cash_receipt_script = 'javascript:showCashReceipts(\''.$LGD_MID.'\',\''.$pp['pp_id'].'\',\''.$pp['pp_casseqno'].'\',\''.$trade_type.'\',\''.$CST_PLATFORM.'\');';
|
||||
} else if($pp['pp_pg'] == 'inicis') {
|
||||
$cash = unserialize($pp['pp_cash_info']);
|
||||
$cash_receipt_script = 'window.open(\'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/Cash_mCmReceipt.jsp?noTid='.$cash['TID'].'&clpaymethod=22\',\'showreceipt\',\'width=380,height=540,scrollbars=no,resizable=no\');';
|
||||
} else {
|
||||
require G5_SHOP_PATH.'/settle_kcp.inc.php';
|
||||
|
||||
$cash = unserialize($pp['pp_cash_info']);
|
||||
$cash_receipt_script = 'window.open(\''.G5_CASH_RECEIPT_URL.$default['de_kcp_mid'].'&orderid='.$pp_id.'&bill_yn=Y&authno='.$cash['receipt_no'].'\', \'taxsave_receipt\', \'width=360,height=647,scrollbars=0,menus=0\');';
|
||||
}
|
||||
?>
|
||||
<a href="javascript:;" onclick="<?php echo $cash_receipt_script; ?>">현금영수증 확인</a>
|
||||
<?php } else { ?>
|
||||
<a href="javascript:;" onclick="window.open('<?php echo G5_SHOP_URL; ?>/taxsave.php?tx=personalpay&od_id=<?php echo $pp_id; ?>', 'taxsave', 'width=550,height=400,scrollbars=1,menus=0');">현금영수증 발급</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<th scope="row"><label for="pp_shop_memo">상점메모</label></th>
|
||||
<td><textarea name="pp_shop_memo" id="pp_shop_memo" rows="8"><?php echo html_purifier($pp['pp_shop_memo']); ?></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="pp_use">사용</label></th>
|
||||
<td>
|
||||
<select name="pp_use" id="pp_use">
|
||||
<option value="1" <?php echo get_selected($pp['pp_use'], 1); ?>>사용함</option>
|
||||
<option value="0" <?php echo get_selected($pp['pp_use'], 0); ?>>사용안함</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
$btn_class = (isset($popup) && $popup === 'yes') ? 'btn_win' : 'btn_fixed_top';
|
||||
?>
|
||||
<div class="<?php echo $btn_class; ?>">
|
||||
<input type="submit" value="확인" class="btn_submit btn" accesskey="s">
|
||||
<?php if($popup == 'yes') { ?>
|
||||
<button type="button" onclick="self.close();" class="btn btn_02">닫기</button>
|
||||
<?php } else { ?>
|
||||
<a href="./personalpaylist.php?<?php echo $qstr; ?>" class="btn btn_02">목록</a>
|
||||
<?php } ?>
|
||||
<?php if($w == 'u') { ?>
|
||||
<a href="./personalpayformupdate.php?w=d&pp_id=<?php echo $pp['pp_id']; ?>" onclick="return delete_confirm(this);" class="btn btn_02">삭제</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<?php echo $wrp_tag_end; ?>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
function form_check(f)
|
||||
{
|
||||
if(f.pp_price.value.replace(/[0-9]/g, "").length > 0) {
|
||||
alert("주문금액은 숫자만 입력해 주십시오");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
if($popup == 'yes') {
|
||||
echo '<script src="'.G5_ADMIN_URL.'/admin.js"></script>'.PHP_EOL;
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
} else {
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
$sub_menu = '400440';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$pp_name = isset($_POST['pp_name']) ? strip_tags(clean_xss_attributes($_POST['pp_name'])) : '';
|
||||
$pp_id = isset($_REQUEST['pp_id']) ? preg_replace('/[^0-9]/', '', $_REQUEST['pp_id']) : 0;
|
||||
$pp_price = isset($_POST['pp_price']) ? preg_replace('/[^0-9]/', '', $_REQUEST['pp_price']) : 0;
|
||||
|
||||
if($w == 'd') {
|
||||
auth_check_menu($auth, $sub_menu, 'd');
|
||||
|
||||
$sql = " select pp_id from {$g5['g5_shop_personalpay_table']} where pp_id = '{$pp_id}' ";
|
||||
$row = sql_fetch($sql);
|
||||
if(!$row['pp_id'])
|
||||
alert('삭제하시려는 자료가 존재하지 않습니다.');
|
||||
|
||||
sql_query(" delete from {$g5['g5_shop_personalpay_table']} where pp_id = '{$pp_id}' ");
|
||||
|
||||
goto_url('./personalpaylist.php?'.$qstr);
|
||||
} else {
|
||||
auth_check_menu($auth, $sub_menu, 'w');
|
||||
|
||||
if(! $pp_name)
|
||||
alert('이름을 입력해 주십시오.');
|
||||
if(! $pp_price)
|
||||
alert('주문금액을 입력해 주십시오.');
|
||||
if(preg_match('/[^0-9]/', $pp_price))
|
||||
alert('주문금액은 숫자만 입력해 주십시오.');
|
||||
|
||||
$od_id = isset($_POST['od_id']) ? safe_replace_regex($_POST['od_id'], 'od_id') : '';
|
||||
|
||||
if($od_id) {
|
||||
$sql = " select od_id from {$g5['g5_shop_order_table']} where od_id = '$od_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
if(! (isset($row['od_id']) && $row['od_id']))
|
||||
alert('입력하신 주문번호는 존재하지 않는 주문 자료입니다.');
|
||||
}
|
||||
|
||||
$post_pp_content = isset($_POST['pp_content']) ? $_POST['pp_content'] : '';
|
||||
$post_pp_receipt_price = isset($_POST['pp_receipt_price']) ? (int) $_POST['pp_receipt_price'] : 0;
|
||||
$post_pp_settle_case = isset($_POST['pp_settle_case']) ? clean_xss_tags($_POST['pp_settle_case'], 1, 1) : '';
|
||||
$post_pp_receipt_time = isset($_POST['pp_receipt_time']) ? clean_xss_tags($_POST['pp_receipt_time'], 1, 1) : '';
|
||||
$post_pp_shop_memo = isset($_POST['pp_shop_memo']) ? $_POST['pp_shop_memo'] : '';
|
||||
$post_pp_use = isset($_POST['pp_use']) ? (int) $_POST['pp_use'] : 0;
|
||||
|
||||
$sql_common = " pp_name = '{$pp_name}',
|
||||
pp_price = '{$pp_price}',
|
||||
od_id = '$od_id',
|
||||
pp_content = '{$post_pp_content}',
|
||||
pp_receipt_price = '{$post_pp_receipt_price}',
|
||||
pp_settle_case = '{$post_pp_settle_case}',
|
||||
pp_receipt_time = '{$post_pp_receipt_time}',
|
||||
pp_shop_memo = '{$post_pp_shop_memo}',
|
||||
pp_use = '{$post_pp_use}' ";
|
||||
}
|
||||
|
||||
if($w == '') {
|
||||
$pp_id = get_uniqid();
|
||||
$sql = " insert into {$g5['g5_shop_personalpay_table']}
|
||||
set pp_id = '$pp_id',
|
||||
$sql_common ,
|
||||
pp_ip = '{$_SERVER['REMOTE_ADDR']}',
|
||||
pp_time = '".G5_TIME_YMDHIS."' ";
|
||||
sql_query($sql);
|
||||
} else if($w == 'u') {
|
||||
$sql = " select pp_id from {$g5['g5_shop_personalpay_table']} where pp_id = '{$pp_id}' ";
|
||||
$row = sql_fetch($sql);
|
||||
if(!$row['pp_id'])
|
||||
alert('수정하시려는 자료가 존재하지 않습니다.');
|
||||
|
||||
$sql = " update {$g5['g5_shop_personalpay_table']}
|
||||
set $sql_common
|
||||
where pp_id = '{$pp_id}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
if($popup == 'yes')
|
||||
alert_close('개인결제가 추가됐습니다.');
|
||||
else
|
||||
goto_url('./personalpayform.php?w=u&pp_id='.$pp_id.'&'.$qstr);
|
||||
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
$sub_menu = '400440';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$sql_common = " from {$g5['g5_shop_personalpay_table']} ";
|
||||
|
||||
$sql_search = " where (1) ";
|
||||
if ($stx) {
|
||||
$sql_search .= " and ( ";
|
||||
switch ($sfl) {
|
||||
case 'pp_id' :
|
||||
$sql_search .= " ({$sfl} = '{$stx}') ";
|
||||
break;
|
||||
case 'od_id' :
|
||||
$sql_search .= " ({$sfl} = '{$stx}') ";
|
||||
break;
|
||||
default :
|
||||
$sql_search .= " ({$sfl} like '%{$stx}%') ";
|
||||
break;
|
||||
}
|
||||
$sql_search .= " ) ";
|
||||
}
|
||||
|
||||
if (!$sst) {
|
||||
$sst = "pp_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;
|
||||
?>
|
||||
|
||||
<div class="local_ov01 local_ov">
|
||||
<span class="btn_ov01"><span class="ov_txt">전체 </span><span class="ov_num"> <?php echo number_format($total_count) ?>건 </span></span>
|
||||
</div>
|
||||
|
||||
<form name="fsearch" id="fsearch" class="local_sch01 local_sch" method="get">
|
||||
<select name="sfl" title="검색대상">
|
||||
<option value="pp_id"<?php echo get_selected($sfl, "pp_id"); ?>>개인결제번호</option>
|
||||
<option value="pp_name"<?php echo get_selected($sfl, "pp_name"); ?>>이름</option>
|
||||
<option value="od_id"<?php echo get_selected($sfl, "od_id"); ?>>주문번호</option>
|
||||
</select>
|
||||
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
|
||||
<input type="text" name="stx" value="<?php echo $stx ?>" id="stx" required class="required frm_input">
|
||||
<input type="submit" class="btn_submit" value="검색">
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
<form name="fpersonalpaylist" id="fpersonalpaylist" method="post" action="./personalpaylistdelete.php" onsubmit="return fpersonalpaylist_submit(this);">
|
||||
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
|
||||
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
|
||||
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
|
||||
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
<input type="hidden" name="token" value="">
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?> 목록</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
<label for="chkall" class="sound_only">개인결제 전체</label>
|
||||
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
|
||||
</th>
|
||||
<th scope="col">제목</th>
|
||||
<th scope="col"><?php echo subject_sort_link('od_id') ?>주문번호</a></th>
|
||||
<th scope="col">주문금액</th>
|
||||
<th scope="col">입금금액</th>
|
||||
<th scope="col">미수금액</th>
|
||||
<th scope="col">입금방법</th>
|
||||
<th scope="col"><?php echo subject_sort_link('pp_receipt_time') ?>입금일</a></th>
|
||||
<th scope="col">사용</th>
|
||||
<th scope="col">관리</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
if($row['od_id'])
|
||||
$od_id = '<a href="./orderform.php?od_id='.$row['od_id'].'" target="_blank">'.$row['od_id'].'</a>';
|
||||
else
|
||||
$od_id = ' ';
|
||||
|
||||
$bg = 'bg'.($i%2);
|
||||
?>
|
||||
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td class="td_chk">
|
||||
<input type="hidden" id="pp_id_<?php echo $i; ?>" name="pp_id[<?php echo $i; ?>]" value="<?php echo $row['pp_id']; ?>">
|
||||
<input type="checkbox" id="chk_<?php echo $i; ?>" name="chk[]" value="<?php echo $i; ?>" title="내역선택">
|
||||
</td>
|
||||
<td class="td_left"><?php echo get_text($row['pp_name']); ?></td>
|
||||
<td class="td_odrnum3"><?php echo $od_id; ?></td>
|
||||
<td class="td_numsum"><?php echo number_format($row['pp_price']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($row['pp_receipt_price']); ?></td>
|
||||
<td class="td_numrdy"><?php echo number_format($row['pp_price'] - $row['pp_receipt_price']); ?></td>
|
||||
<td class="td_payby"><?php echo $row['pp_settle_case']; ?></td>
|
||||
<td class="td_date"><?php echo is_null_time($row['pp_receipt_time']) ? '' : substr($row['pp_receipt_time'], 2, 8); ?></td>
|
||||
<td class="td_boolean"><?php echo $row['pp_use'] ? '예' : '아니오'; ?></td>
|
||||
<td class="td_mng td_mng_m">
|
||||
<a href="./personalpayform.php?w=u&pp_id=<?php echo $row['pp_id']; ?>&<?php echo $qstr; ?>" class="btn btn_03"><span class="sound_only"><?php echo $row['pp_id']; ?> </span>수정</a>
|
||||
<a href="./personalpaycopy.php?pp_id=<?php echo $row['pp_id']; ?>" class="personalpaycopy btn btn_02"><span class="sound_only"><?php echo $row['pp_id']; ?> </span>복사</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($i == 0)
|
||||
echo '<tr><td colspan="'.$colspan.'" class="empty_table">자료가 없습니다.</td></tr>';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_fixed_top">
|
||||
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value" class="btn btn_02">
|
||||
<a href="./personalpayform.php" id="personalpay_add" class="btn btn_01">개인결제 추가</a>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page="); ?>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$(".personalpaycopy").on("click", function() {
|
||||
var href = this.href;
|
||||
window.open(href, "copywin", "left=100, top=100, width=600, height=300, scrollbars=0");
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
function fpersonalpaylist_submit(f)
|
||||
{
|
||||
if (!is_checked("chk[]")) {
|
||||
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(document.pressed == "선택삭제") {
|
||||
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
$sub_menu = '400440';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
|
||||
auth_check_menu($auth, $sub_menu, 'd');
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$count = (isset($_POST['chk']) && is_array($_POST['chk'])) ? count($_POST['chk']) : 0;
|
||||
if(!$count)
|
||||
alert('선택삭제 하실 항목을 하나이상 선택해 주세요.');
|
||||
|
||||
for ($i=0; $i<$count; $i++)
|
||||
{
|
||||
// 실제 번호를 넘김
|
||||
$k = isset($_POST['chk'][$i]) ? (int) $_POST['chk'][$i] : 0;
|
||||
$ppp_id = isset($_POST['pp_id'][$i]) ? preg_replace('/[^0-9]/', '', $_POST['pp_id'][$k]) : 0;
|
||||
|
||||
$sql = " delete from {$g5['g5_shop_personalpay_table']} where pp_id = '{$ppp_id}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
goto_url('./personalpaylist.php');
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
$sub_menu = '500210';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$g5['title'] = '가격비교사이트';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
$pg_anchor = '<ul class="anchor">
|
||||
<li><a href="#anc_pricecompare_info">가격비교사이트 연동 안내</a></li>
|
||||
<li><a href="#anc_pricecompare_engine">사이트별 엔진페이지 URL</a></li>
|
||||
</ul>';
|
||||
?>
|
||||
|
||||
<section id="anc_pricecompare_info">
|
||||
<h2>가격비교사이트 연동 안내</h2>
|
||||
<?php echo $pg_anchor; ?>
|
||||
|
||||
<div class="local_desc01 local_desc">
|
||||
<ol>
|
||||
<li>가격비교사이트는 네이버 지식쇼핑, 다음 쇼핑하우 등이 있습니다.</li>
|
||||
<li>앞서 나열한 가격비교사이트 중 희망하시는 사이트에 입점합니다.</li>
|
||||
<li><strong>사이트별 엔진페이지 URL</strong>을 참고하여 해당 엔진페이지 URL 을 입점하신 사이트에 알려주시면 됩니다.</li>
|
||||
</ol>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="anc_pricecompare_engine">
|
||||
<h2>사이트별 엔진페이지 URL</h2>
|
||||
<?php echo $pg_anchor; ?>
|
||||
|
||||
<div class="local_desc01 local_desc">
|
||||
<p>사이트 명을 클릭하시면 해당 사이트로 이동합니다.</p>
|
||||
|
||||
<dl class="price_engine">
|
||||
<dt><a href="http://shopping.naver.com/" target="_blank">네이버쇼핑</a></dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li>입점 안내 : <a href="http://join.shopping.naver.com/join/intro.nhn" target="_blank">http://join.shopping.naver.com/join/intro.nhn</a></li>
|
||||
<li>전체상품 URL : <a href="<?php echo G5_SHOP_URL; ?>/price/naver.php" target="_blank"><?php echo G5_SHOP_URL; ?>/price/naver.php</a></li>
|
||||
<li>요약상품 URL : <a href="<?php echo G5_SHOP_URL; ?>/price/naver_summary.php" target="_blank"><?php echo G5_SHOP_URL; ?>/price/naver_summary.php</a></li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
<dt><a href="" target="_blank">구글 쇼핑</a></dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li>구글 Merchant Center : <a href="https://www.google.com/intl/ko_kr/retail/solutions/merchant-center" target="_blank">https://www.google.com/intl/ko_kr/retail/solutions/merchant-center</a></li>
|
||||
<li>파일 이름 : google_feed.php</a></li>
|
||||
<li>파일 URL : <a href="<?php echo G5_SHOP_URL; ?>/price/google_feed.php" target="_blank"><?php echo G5_SHOP_URL; ?>/price/google_feed.php</a></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt>Feed 설명</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li>판매국가 <b>대한민국</b>, 언어 <b>한국어</b> 설정 기준입니다.</li>
|
||||
<li>기본 피드 이름 : 쇼핑몰피드</li>
|
||||
<li>상품 설명 : <b>it_basic</b> (상품기본설명을 필수 입력해주세요. HTML 태그는 자동 제거됩니다.)</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
<dt><a href="http://shopping.daum.net/" target="_blank">다음 쇼핑하우</a></dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li>입점 안내 : <a href="https://shopping.biz.daum.net/join/main" target="_blank">https://shopping.biz.daum.net/join/main</a></li>
|
||||
<li>전체상품 URL : <a href="<?php echo G5_SHOP_URL; ?>/price/daum.php" target="_blank"><?php echo G5_SHOP_URL; ?>/price/daum.php</a></li>
|
||||
<li>요약상품 URL : <a href="<?php echo G5_SHOP_URL; ?>/price/daum_summary.php" target="_blank"><?php echo G5_SHOP_URL; ?>/price/daum_summary.php</a></li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
$sub_menu = '500110';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$g5['title'] = '매출현황';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');
|
||||
?>
|
||||
|
||||
<div class="local_sch03 local_sch">
|
||||
|
||||
<div>
|
||||
<form name="frm_sale_today" action="./sale1today.php" method="get">
|
||||
<strong>일일 매출</strong>
|
||||
<input type="text" name="date" value="<?php echo date("Ymd", G5_SERVER_TIME); ?>" id="date" required class="required frm_input" size="8" maxlength="8">
|
||||
<label for="date">일 하루</label>
|
||||
<input type="submit" value="확인" class="btn_submit">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<form name="frm_sale_date" action="./sale1date.php" method="get">
|
||||
<strong>일간 매출</strong>
|
||||
<input type="text" name="fr_date" value="<?php echo date("Ym01", G5_SERVER_TIME); ?>" id="fr_date" required class="required frm_input" size="8" maxlength="8">
|
||||
<label for="fr_date">일 ~</label>
|
||||
<input type="text" name="to_date" value="<?php echo date("Ymd", G5_SERVER_TIME); ?>" id="to_date" required class="required frm_input" size="8" maxlength="8">
|
||||
<label for="to_date">일</label>
|
||||
<input type="submit" value="확인" class="btn_submit">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<form name="frm_sale_month" action="./sale1month.php" method="get">
|
||||
<strong>월간 매출</strong>
|
||||
<input type="text" name="fr_month" value="<?php echo date("Y01", G5_SERVER_TIME); ?>" id="fr_month" required class="required frm_input" size="6" maxlength="6">
|
||||
<label for="fr_month">월 ~</label>
|
||||
<input type="text" name="to_month" value="<?php echo date("Ym", G5_SERVER_TIME); ?>" id="to_month" required class="required frm_input" size="6" maxlength="6">
|
||||
<label for="to_month">월</label>
|
||||
<input type="submit" value="확인" class="btn_submit">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="sch_last">
|
||||
<form name="frm_sale_year" action="./sale1year.php" method="get">
|
||||
<strong>연간 매출</strong>
|
||||
<input type="text" name="fr_year" value="<?php echo date("Y", G5_SERVER_TIME)-1; ?>" id="fr_year" required class="required frm_input" size="4" maxlength="4">
|
||||
<label for="fr_year">년 ~</label>
|
||||
<input type="text" name="to_year" value="<?php echo date("Y", G5_SERVER_TIME); ?>" id="to_year" required class="required frm_input" size="4" maxlength="4">
|
||||
<label for="to_year">년</label>
|
||||
<input type="submit" value="확인" class="btn_submit">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$("#date, #fr_date, #to_date").datepicker({
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
dateFormat: "yymmdd",
|
||||
showButtonPanel: true,
|
||||
yearRange: "c-99:c+99",
|
||||
maxDate: "+0d"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
$sub_menu = '500110';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$fr_date = isset($_REQUEST['fr_date']) ? preg_replace('/[^0-9 :_\-]/i', '', $_REQUEST['fr_date']) : '';
|
||||
$to_date = isset($_REQUEST['to_date']) ? preg_replace('/[^0-9 :_\-]/i', '', $_REQUEST['to_date']) : '';
|
||||
|
||||
$fr_date = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\1-\\2-\\3", $fr_date);
|
||||
$to_date = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\1-\\2-\\3", $to_date);
|
||||
|
||||
$g5['title'] = $fr_date.' ~ '.$to_date.' 일간 매출현황';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
function print_line($save)
|
||||
{
|
||||
$date = preg_replace("/-/", "", $save['od_date']);
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td class="td_alignc"><a href="./sale1today.php?date=<?php echo $date; ?>"><?php echo $save['od_date']; ?></a></td>
|
||||
<td class="td_num"><?php echo number_format($save['ordercount']); ?></td>
|
||||
<td class="td_numsum"><?php echo number_format($save['orderprice']); ?></td>
|
||||
<td class="td_numcoupon"><?php echo number_format($save['ordercoupon']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receiptbank']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receiptvbank']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receiptiche']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receiptcard']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receipteasy']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receipthp']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receiptpoint']); ?></td>
|
||||
<td class="td_numcancel1"><?php echo number_format($save['ordercancel']); ?></td>
|
||||
<td class="td_numrdy"><?php echo number_format($save['misu']); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
$sql = " select od_id,
|
||||
SUBSTRING(od_time,1,10) as od_date,
|
||||
od_settle_case,
|
||||
od_receipt_price,
|
||||
od_receipt_point,
|
||||
od_cart_price,
|
||||
od_cancel_price,
|
||||
od_misu,
|
||||
(od_cart_price + od_send_cost + od_send_cost2) as orderprice,
|
||||
(od_cart_coupon + od_coupon + od_send_coupon) as couponprice
|
||||
from {$g5['g5_shop_order_table']}
|
||||
where SUBSTRING(od_time,1,10) between '$fr_date' and '$to_date'
|
||||
order by od_time desc ";
|
||||
$result = sql_query($sql);
|
||||
?>
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">주문일</th>
|
||||
<th scope="col">주문수</th>
|
||||
<th scope="col">주문합계</th>
|
||||
<th scope="col">쿠폰</th>
|
||||
<th scope="col">무통장</th>
|
||||
<th scope="col">가상계좌</th>
|
||||
<th scope="col">계좌이체</th>
|
||||
<th scope="col">카드입금</th>
|
||||
<th scope="col">간편결제</th>
|
||||
<th scope="col">휴대폰</th>
|
||||
<th scope="col">포인트입금</th>
|
||||
<th scope="col">주문취소</th>
|
||||
<th scope="col">미수금</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$save = array('ordercount'=>0, 'orderprice'=>0, 'ordercancel'=>0, 'ordercoupon'=>0, 'receiptbank'=>0, 'receiptvbank'=>0, 'receiptiche'=>0, 'receipthp'=>0, 'receiptcard'=>0, 'receiptpoint'=>0, 'misu'=>0, 'receipteasy'=>0);
|
||||
$tot = array('ordercount'=>0, 'orderprice'=>0, 'ordercancel'=>0, 'ordercoupon'=>0, 'receiptbank'=>0, 'receiptvbank'=>0, 'receiptiche'=>0, 'receipthp'=>0, 'receiptcard'=>0, 'receiptpoint'=>0, 'misu'=>0, 'receipteasy'=>0);
|
||||
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
if ($i == 0)
|
||||
$save['od_date'] = $row['od_date'];
|
||||
|
||||
if ($save['od_date'] != $row['od_date']) {
|
||||
print_line($save);
|
||||
$save = array('ordercount'=>0, 'orderprice'=>0, 'ordercancel'=>0, 'ordercoupon'=>0, 'receiptbank'=>0, 'receiptvbank'=>0, 'receiptiche'=>0, 'receipthp'=>0, 'receiptcard'=>0, 'receiptpoint'=>0, 'misu'=>0, 'receipteasy'=>0);
|
||||
$save['od_date'] = $row['od_date'];
|
||||
}
|
||||
|
||||
$save['ordercount']++;
|
||||
$save['orderprice'] += $row['orderprice'];
|
||||
$save['ordercancel'] += $row['od_cancel_price'];
|
||||
$save['ordercoupon'] += $row['couponprice'];
|
||||
if($row['od_settle_case'] == '무통장')
|
||||
$save['receiptbank'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '가상계좌')
|
||||
$save['receiptvbank'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '계좌이체')
|
||||
$save['receiptiche'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '휴대폰')
|
||||
$save['receipthp'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '신용카드')
|
||||
$save['receiptcard'] += $row['od_receipt_price'];
|
||||
$save['receiptpoint'] += $row['od_receipt_point'];
|
||||
$save['misu'] += $row['od_misu'];
|
||||
|
||||
$tot['ordercount']++;
|
||||
$tot['orderprice'] += $row['orderprice'];
|
||||
$tot['ordercancel'] += $row['od_cancel_price'];
|
||||
$tot['ordercoupon'] += $row['couponprice'];
|
||||
if($row['od_settle_case'] == '무통장')
|
||||
$tot['receiptbank'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '가상계좌')
|
||||
$tot['receiptvbank'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '계좌이체')
|
||||
$tot['receiptiche'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '휴대폰')
|
||||
$tot['receipthp'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '신용카드')
|
||||
$tot['receiptcard'] += $row['od_receipt_price'];
|
||||
$tot['receiptpoint'] += $row['od_receipt_point'];
|
||||
$tot['misu'] += $row['od_misu'];
|
||||
|
||||
if(in_array($row['od_settle_case'], array('간편결제', 'KAKAOPAY', 'lpay', 'inicis_payco', 'inicis_kakaopay', '삼성페이'))) {
|
||||
$save['receipteasy'] += $row['od_receipt_price'];
|
||||
$tot['receipteasy'] += $row['od_receipt_price'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($i == 0) {
|
||||
echo '<tr><td colspan="13" class="empty_table">자료가 없습니다.</td></tr>';
|
||||
} else {
|
||||
print_line($save);
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td>합계</td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['ordercount']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['orderprice']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['ordercoupon']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receiptbank']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receiptvbank']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receiptiche']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receiptcard']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receipteasy']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receipthp']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receiptpoint']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['ordercancel']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['misu']); ?></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,162 @@
|
||||
<?php
|
||||
$sub_menu = '500110';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$fr_month = isset($_REQUEST['fr_month']) ? preg_replace('/[^0-9 :_\-]/i', '', $_REQUEST['fr_month']) : '';
|
||||
$to_month = isset($_REQUEST['to_month']) ? preg_replace('/[^0-9 :_\-]/i', '', $_REQUEST['to_month']) : '';
|
||||
|
||||
$fr_month = preg_replace("/([0-9]{4})([0-9]{2})/", "\\1-\\2", $fr_month);
|
||||
$to_month = preg_replace("/([0-9]{4})([0-9]{2})/", "\\1-\\2", $to_month);
|
||||
|
||||
$g5['title'] = "$fr_month ~ $to_month 월간 매출현황";
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
function print_line($save)
|
||||
{
|
||||
$date = preg_replace("/-/", "", $save['od_date']);
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td class="td_alignc"><a href="./sale1date.php?fr_date=<?php echo $date; ?>01&to_date=<?php echo $date; ?>31"><?php echo $save['od_date']; ?></a></td>
|
||||
<td class="td_num"><?php echo number_format($save['ordercount']); ?></td>
|
||||
<td class="td_numsum"><?php echo number_format($save['orderprice']); ?></td>
|
||||
<td class="td_numcoupon"><?php echo number_format($save['ordercoupon']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receiptbank']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receiptvbank']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receiptiche']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receiptcard']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receipteasy']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receipthp']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receiptpoint']); ?></td>
|
||||
<td class="td_numcancel1"><?php echo number_format($save['ordercancel']); ?></td>
|
||||
<td class="td_numrdy"><?php echo number_format($save['misu']); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
$sql = " select od_id,
|
||||
SUBSTRING(od_time,1,7) as od_date,
|
||||
od_send_cost,
|
||||
od_settle_case,
|
||||
od_receipt_price,
|
||||
od_receipt_point,
|
||||
od_cart_price,
|
||||
od_cancel_price,
|
||||
od_misu,
|
||||
(od_cart_price + od_send_cost + od_send_cost2) as orderprice,
|
||||
(od_cart_coupon + od_coupon + od_send_coupon) as couponprice
|
||||
from {$g5['g5_shop_order_table']}
|
||||
where SUBSTRING(od_time,1,7) between '$fr_month' and '$to_month'
|
||||
order by od_time desc ";
|
||||
$result = sql_query($sql);
|
||||
?>
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">주문월</th>
|
||||
<th scope="col">주문수</th>
|
||||
<th scope="col">주문합계</th>
|
||||
<th scope="col">쿠폰</th>
|
||||
<th scope="col">무통장</th>
|
||||
<th scope="col">가상계좌</th>
|
||||
<th scope="col">계좌이체</th>
|
||||
<th scope="col">카드입금</th>
|
||||
<th scope="col">간편결제</th>
|
||||
<th scope="col">휴대폰</th>
|
||||
<th scope="col">포인트입금</th>
|
||||
<th scope="col">주문취소</th>
|
||||
<th scope="col">미수금</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$save = array('ordercount'=>0, 'orderprice'=>0, 'ordercancel'=>0, 'ordercoupon'=>0, 'receiptbank'=>0, 'receiptvbank'=>0, 'receiptiche'=>0, 'receipthp'=>0, 'receiptcard'=>0, 'receiptpoint'=>0, 'misu'=>0, 'receipteasy'=>0);
|
||||
$tot = array('ordercount'=>0, 'orderprice'=>0, 'ordercancel'=>0, 'ordercoupon'=>0, 'receiptbank'=>0, 'receiptvbank'=>0, 'receiptiche'=>0, 'receipthp'=>0, 'receiptcard'=>0, 'receiptpoint'=>0, 'misu'=>0, 'receipteasy'=>0);
|
||||
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
if ($i == 0)
|
||||
$save['od_date'] = $row['od_date'];
|
||||
|
||||
if ($save['od_date'] != $row['od_date']) {
|
||||
print_line($save);
|
||||
$save = array('ordercount'=>0, 'orderprice'=>0, 'ordercancel'=>0, 'ordercoupon'=>0, 'receiptbank'=>0, 'receiptvbank'=>0, 'receiptiche'=>0, 'receipthp'=>0, 'receiptcard'=>0, 'receiptpoint'=>0, 'misu'=>0, 'receipteasy'=>0);
|
||||
$save['od_date'] = $row['od_date'];
|
||||
}
|
||||
|
||||
$save['ordercount']++;
|
||||
$save['orderprice'] += $row['orderprice'];
|
||||
$save['ordercancel'] += $row['od_cancel_price'];
|
||||
$save['ordercoupon'] += $row['couponprice'];
|
||||
if($row['od_settle_case'] == '무통장')
|
||||
$save['receiptbank'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '가상계좌')
|
||||
$save['receiptvbank'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '계좌이체')
|
||||
$save['receiptiche'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '휴대폰')
|
||||
$save['receipthp'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '신용카드')
|
||||
$save['receiptcard'] += $row['od_receipt_price'];
|
||||
$save['receiptpoint'] += $row['od_receipt_point'];
|
||||
$save['misu'] += $row['od_misu'];
|
||||
|
||||
$tot['ordercount']++;
|
||||
$tot['orderprice'] += $row['orderprice'];
|
||||
$tot['ordercancel'] += $row['od_cancel_price'];
|
||||
$tot['ordercoupon'] += $row['couponprice'];
|
||||
if($row['od_settle_case'] == '무통장')
|
||||
$tot['receiptbank'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '가상계좌')
|
||||
$tot['receiptvbank'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '계좌이체')
|
||||
$tot['receiptiche'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '휴대폰')
|
||||
$tot['receipthp'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '신용카드')
|
||||
$tot['receiptcard'] += $row['od_receipt_price'];
|
||||
$tot['receiptpoint'] += $row['od_receipt_point'];
|
||||
$tot['misu'] += $row['od_misu'];
|
||||
|
||||
if(in_array($row['od_settle_case'], array('간편결제', 'KAKAOPAY', 'lpay', 'inicis_payco', 'inicis_kakaopay', '삼성페이'))) {
|
||||
$save['receipteasy'] += $row['od_receipt_price'];
|
||||
$tot['receipteasy'] += $row['od_receipt_price'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($i == 0) {
|
||||
echo '<tr><td colspan="12" class="empty_table">자료가 없습니다.</td></tr>';
|
||||
} else {
|
||||
print_line($save);
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td>합 계</td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['ordercount']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['orderprice']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['ordercoupon']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receiptbank']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receiptvbank']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receiptiche']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receiptcard']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receipteasy']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receipthp']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receiptpoint']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['ordercancel']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['misu']); ?></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
$sub_menu = '500110';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$date = isset($_GET['date']) ? preg_replace('/[^0-9]/i', '', $_GET['date']) : '';
|
||||
$tot = array(
|
||||
'orderprice'=>0,
|
||||
'coupon'=>0,
|
||||
'receipt_bank'=>0,
|
||||
'receipt_vbank'=>0,
|
||||
'receipt_iche'=>0,
|
||||
'receipt_card'=>0,
|
||||
'receipt_easy'=>0,
|
||||
'receipt_hp'=>0,
|
||||
'receipt_point'=>0,
|
||||
'ordercancel'=>0,
|
||||
'misu'=>0,
|
||||
);
|
||||
$date = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\1-\\2-\\3", $date);
|
||||
|
||||
$g5['title'] = "$date 일 매출현황";
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
$sql = " select od_id,
|
||||
mb_id,
|
||||
od_name,
|
||||
od_settle_case,
|
||||
od_cart_price,
|
||||
od_receipt_price,
|
||||
od_receipt_point,
|
||||
od_cancel_price,
|
||||
od_misu,
|
||||
(od_cart_price + od_send_cost + od_send_cost2) as orderprice,
|
||||
(od_cart_coupon + od_coupon + od_send_coupon) as couponprice
|
||||
from {$g5['g5_shop_order_table']}
|
||||
where SUBSTRING(od_time,1,10) = '$date'
|
||||
order by od_id desc ";
|
||||
$result = sql_query($sql);
|
||||
?>
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">주문번호</th>
|
||||
<th scope="col">주문자</th>
|
||||
<th scope="col">주문합계</th>
|
||||
<th scope="col">쿠폰</th>
|
||||
<th scope="col">무통장</th>
|
||||
<th scope="col">가상계좌</th>
|
||||
<th scope="col">계좌이체</th>
|
||||
<th scope="col">카드입금</th>
|
||||
<th scope="col">간편결제</th>
|
||||
<th scope="col">휴대폰</th>
|
||||
<th scope="col">포인트입금</th>
|
||||
<th scope="col">주문취소</th>
|
||||
<th scope="col">미수금</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
if ($row['mb_id'] == '') { // 비회원일 경우는 주문자로 링크
|
||||
$href = '<a href="./orderlist.php?sel_field=od_name&search='.$row['od_name'].'">';
|
||||
} else { // 회원일 경우는 회원아이디로 링크
|
||||
$href = '<a href="./orderlist.php?sel_field=mb_id&search='.$row['mb_id'].'">';
|
||||
}
|
||||
|
||||
$receipt_bank = $receipt_card = $receipt_vbank = $receipt_iche = $receipt_easy = $receipt_hp = 0;
|
||||
if($row['od_settle_case'] == '무통장')
|
||||
$receipt_bank = $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '가상계좌')
|
||||
$receipt_vbank = $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '계좌이체')
|
||||
$receipt_iche = $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '휴대폰')
|
||||
$receipt_hp = $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '신용카드')
|
||||
$receipt_card = $row['od_receipt_price'];
|
||||
if(in_array($row['od_settle_case'], array('간편결제', 'KAKAOPAY', 'lpay', 'inicis_payco', 'inicis_kakaopay', '삼성페이'))) {
|
||||
$receipt_easy = $row['od_receipt_price'];
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td class="td_alignc"><a href="./orderform.php?od_id=<?php echo $row['od_id']; ?>"><?php echo $row['od_id']; ?></a></td>
|
||||
<td class="td_name"><?php echo $href; ?><?php echo $row['od_name']; ?></a></td>
|
||||
<td class="td_numsum"><?php echo number_format($row['orderprice']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($row['couponprice']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($receipt_bank); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($receipt_vbank); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($receipt_iche); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($receipt_card); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($receipt_easy); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($receipt_hp); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($row['od_receipt_point']); ?></td>
|
||||
<td class="td_numcancel1"><?php echo number_format($row['od_cancel_price']); ?></td>
|
||||
<td class="td_numrdy"><?php echo number_format($row['od_misu']); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$tot['orderprice'] += $row['orderprice'];
|
||||
$tot['ordercancel'] += $row['od_cancel_price'];
|
||||
$tot['coupon'] += $row['couponprice'] ;
|
||||
$tot['receipt_bank'] += $receipt_bank;
|
||||
$tot['receipt_vbank'] += $receipt_vbank;
|
||||
$tot['receipt_iche'] += $receipt_iche;
|
||||
$tot['receipt_card'] += $receipt_card;
|
||||
$tot['receipt_easy'] += $receipt_easy;
|
||||
$tot['receipt_hp'] += $receipt_hp;
|
||||
$tot['receipt_point'] += $row['od_receipt_point'];
|
||||
$tot['misu'] += $row['od_misu'];
|
||||
}
|
||||
|
||||
if ($i == 0) {
|
||||
echo '<tr><td colspan="13" class="empty_table">자료가 없습니다</td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="2">합 계</td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['orderprice']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['coupon']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receipt_bank']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receipt_vbank']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receipt_iche']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receipt_card']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receipt_easy']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receipt_hp']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receipt_point']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['ordercancel']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['misu']); ?></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
$sub_menu = '500110';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$fr_year = isset($_REQUEST['fr_year']) ? preg_replace('/[^0-9 :_\-]/i', '', $_REQUEST['fr_year']) : '';
|
||||
$to_year = isset($_REQUEST['to_year']) ? preg_replace('/[^0-9 :_\-]/i', '', $_REQUEST['to_year']) : '';
|
||||
|
||||
$g5['title'] = $fr_year.' ~ '.$to_year.' 연간 매출현황';
|
||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||
|
||||
function print_line($save)
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<td class="td_alignc"><a href="./sale1month.php?fr_month=<?php echo $save['od_date']; ?>01&to_month=<?php echo $save['od_date']; ?>12"><?php echo $save['od_date']; ?></a></td>
|
||||
<td class="td_num"><?php echo number_format($save['ordercount']); ?></td>
|
||||
<td class="td_numsum"><?php echo number_format($save['orderprice']); ?></td>
|
||||
<td class="td_numcoupon"><?php echo number_format($save['ordercoupon']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receiptbank']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receiptvbank']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receiptiche']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receiptcard']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receipteasy']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receipthp']); ?></td>
|
||||
<td class="td_numincome"><?php echo number_format($save['receiptpoint']); ?></td>
|
||||
<td class="td_numcancel1"><?php echo number_format($save['ordercancel']); ?></td>
|
||||
<td class="td_numrdy"><?php echo number_format($save['misu']); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
$sql = " select od_id,
|
||||
SUBSTRING(od_time,1,4) as od_date,
|
||||
od_send_cost,
|
||||
od_settle_case,
|
||||
od_receipt_price,
|
||||
od_receipt_point,
|
||||
od_cart_price,
|
||||
od_cancel_price,
|
||||
od_misu,
|
||||
(od_cart_price + od_send_cost + od_send_cost2) as orderprice,
|
||||
(od_cart_coupon + od_coupon + od_send_coupon) as couponprice
|
||||
from {$g5['g5_shop_order_table']}
|
||||
where SUBSTRING(od_time,1,4) between '$fr_year' and '$to_year'
|
||||
order by od_time desc ";
|
||||
$result = sql_query($sql);
|
||||
?>
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">주문년도</th>
|
||||
<th scope="col">주문수</th>
|
||||
<th scope="col">주문합계</th>
|
||||
<th scope="col">쿠폰</th>
|
||||
<th scope="col">무통장</th>
|
||||
<th scope="col">가상계좌</th>
|
||||
<th scope="col">계좌이체</th>
|
||||
<th scope="col">카드입금</th>
|
||||
<th scope="col">간편결제</th>
|
||||
<th scope="col">휴대폰</th>
|
||||
<th scope="col">포인트입금</th>
|
||||
<th scope="col">주문취소</th>
|
||||
<th scope="col">미수금</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$save = array('ordercount'=>0, 'orderprice'=>0, 'ordercancel'=>0, 'ordercoupon'=>0, 'receiptbank'=>0, 'receiptvbank'=>0, 'receiptiche'=>0, 'receipthp'=>0, 'receiptcard'=>0, 'receiptpoint'=>0, 'misu'=>0, 'receipteasy'=>0);
|
||||
$tot = array('ordercount'=>0, 'orderprice'=>0, 'ordercancel'=>0, 'ordercoupon'=>0, 'receiptbank'=>0, 'receiptvbank'=>0, 'receiptiche'=>0, 'receipthp'=>0, 'receiptcard'=>0, 'receiptpoint'=>0, 'misu'=>0, 'receipteasy'=>0);
|
||||
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
if ($i == 0)
|
||||
$save['od_date'] = $row['od_date'];
|
||||
|
||||
if ($save['od_date'] != $row['od_date']) {
|
||||
print_line($save);
|
||||
$save = array('ordercount'=>0, 'orderprice'=>0, 'ordercancel'=>0, 'ordercoupon'=>0, 'receiptbank'=>0, 'receiptvbank'=>0, 'receiptiche'=>0, 'receipthp'=>0, 'receiptcard'=>0, 'receiptpoint'=>0, 'misu'=>0, 'receipteasy'=>0);
|
||||
$save['od_date'] = $row['od_date'];
|
||||
}
|
||||
|
||||
$save['ordercount']++;
|
||||
$save['orderprice'] += $row['orderprice'];
|
||||
$save['ordercancel'] += $row['od_cancel_price'];
|
||||
$save['ordercoupon'] += $row['couponprice'];
|
||||
if($row['od_settle_case'] == '무통장')
|
||||
$save['receiptbank'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '가상계좌')
|
||||
$save['receiptvbank'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '계좌이체')
|
||||
$save['receiptiche'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '휴대폰')
|
||||
$save['receipthp'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '신용카드')
|
||||
$save['receiptcard'] += $row['od_receipt_price'];
|
||||
$save['receiptpoint'] += $row['od_receipt_point'];
|
||||
$save['misu'] += $row['od_misu'];
|
||||
|
||||
$tot['ordercount']++;
|
||||
$tot['orderprice'] += $row['orderprice'];
|
||||
$tot['ordercancel'] += $row['od_cancel_price'];
|
||||
$tot['ordercoupon'] += $row['couponprice'];
|
||||
if($row['od_settle_case'] == '무통장')
|
||||
$tot['receiptbank'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '가상계좌')
|
||||
$tot['receiptvbank'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '계좌이체')
|
||||
$tot['receiptiche'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '휴대폰')
|
||||
$tot['receipthp'] += $row['od_receipt_price'];
|
||||
if($row['od_settle_case'] == '신용카드')
|
||||
$tot['receiptcard'] += $row['od_receipt_price'];
|
||||
$tot['receiptpoint'] += $row['od_receipt_point'];
|
||||
$tot['misu'] += $row['od_misu'];
|
||||
|
||||
if(in_array($row['od_settle_case'], array('간편결제', 'KAKAOPAY', 'lpay', 'inicis_payco', 'inicis_kakaopay', '삼성페이'))) {
|
||||
$save['receipteasy'] += $row['od_receipt_price'];
|
||||
$tot['receipteasy'] += $row['od_receipt_price'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($i == 0) {
|
||||
echo '<tr><td colspan="12" class="empty_table">자료가 없습니다.</td></tr>';
|
||||
} else {
|
||||
print_line($save);
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td>합 계</td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['ordercount']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['orderprice']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['ordercoupon']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receiptbank']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receiptvbank']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receiptiche']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receiptcard']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receipteasy']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receipthp']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['receiptpoint']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['ordercancel']); ?></td>
|
||||
<td class="td_num_right"><?php echo number_format($tot['misu']); ?></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
$sub_menu = '400750';
|
||||
include_once('./_common.php');
|
||||
|
||||
auth_check_menu($auth, $sub_menu, "r");
|
||||
|
||||
$sql_common = " from {$g5['g5_shop_sendcost_table']} ";
|
||||
|
||||
$sql_search = " where (1) ";
|
||||
$sql_order = " order by sc_id desc ";
|
||||
|
||||
$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');
|
||||
?>
|
||||
|
||||
<section id="scp_list">
|
||||
<h2>추가배송비 내역</h2>
|
||||
|
||||
<form name="fsendcost" id="fsendcost" method="post" action="./sendcostupdate.php" onsubmit="return fsendcost_submit(this);">
|
||||
<input type="hidden" name="w" value="d">
|
||||
<input type="hidden" name="page" value="<?php echo $page; ?>">
|
||||
<input type="hidden" name="token" value="">
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption>추가배송비 내역</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
<label for="chkall" class="sound_only">내역 전체</label>
|
||||
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
|
||||
</th>
|
||||
<th scope="col">지역명</th>
|
||||
<th scope="col">우편번호</th>
|
||||
<th scope="col">추가배송비</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
$bg = 'bg'.($i%2);
|
||||
?>
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td class="td_chk">
|
||||
<input type="hidden" id="sc_id_<?php echo $i; ?>" name="sc_id[<?php echo $i; ?>]" value="<?php echo $row['sc_id']; ?>">
|
||||
<input type="checkbox" id="chk_<?php echo $i; ?>" name="chk[]" value="<?php echo $i; ?>" title="내역선택">
|
||||
</td>
|
||||
<td class="td_left"><?php echo $row['sc_name']; ?></td>
|
||||
<td class="td_postalbig"><?php echo $row['sc_zip1'].' ~ '.$row['sc_zip2']; ?></td>
|
||||
<td class="td_sendcost_add"><?php echo number_format($row['sc_price']); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($i == 0)
|
||||
echo '<tr><td colspan="4" class="empty_table">자료가 없습니다.</td></tr>';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_list01 btn_list">
|
||||
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value" class="btn_frmline">
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page="); ?>
|
||||
|
||||
<section id="sendcost_postal">
|
||||
<h2 class="h2_frm">추가배송비 등록</h2>
|
||||
|
||||
<form name="fsendcost2" method="post" id="fsendcost2" action="./sendcostupdate.php" autocomplete="off">
|
||||
<input type="hidden" name="token" value="">
|
||||
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<caption>추가배송비 등록</caption>
|
||||
<colgroup>
|
||||
<col class="grid_4">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><label for="sc_name">지역명<strong class="sound_only">필수</strong></label></th>
|
||||
<td><input type="text" name="sc_name" value="" id="sc_name" class="required frm_input" size="30" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="sc_zip1">우편번호 시작<strong class="sound_only">필수</strong></label></th>
|
||||
<td>
|
||||
<input type="text" name="sc_zip1" id="sc_zip1" required class="required frm_input" size="10"> (입력 예 : 01234)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="sc_zip2">우편번호 끝<strong class="sound_only">필수</strong></label></th>
|
||||
<td>
|
||||
<input type="text" name="sc_zip2" id="sc_zip2" required class="required frm_input" size="10"> (입력 예 : 01234)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="sc_price">추가배송비<strong class="sound_only">필수</strong></label></th>
|
||||
<td><input type="text" name="sc_price" id="sc_price" size="8" required class="required frm_input"> 원</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_confirm01 btn_confirm">
|
||||
<input type="submit" value="확인" class="btn_submit btn">
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</section>
|
||||
|
||||
<script>
|
||||
function fsendcost_submit(f)
|
||||
{
|
||||
if (!is_checked("chk[]")) {
|
||||
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(document.pressed == "선택삭제") {
|
||||
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G5_ADMIN_PATH.'/admin.tail.php');
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user