[YC5] 영카트4 서비스 전환후 일부 주문정보를 영카트5로 이식할때 > 기술자료 | 해피정닷컴

[YC5] 영카트4 서비스 전환후 일부 주문정보를 영카트5로 이식할때 > 기술자료

본문 바로가기

사이트 내 전체검색

[YC5] 영카트4 서비스 전환후 일부 주문정보를 영카트5로 이식할때 > 기술자료

영카트 [YC5] 영카트4 서비스 전환후 일부 주문정보를 영카트5로 이식할때

페이지 정보


본문


1. 디비 yc4_order_temp  테이블 생성

CREATE TABLE IF NOT EXISTS `yc4_order_temp` (
  `od_id` varchar(10) NOT NULL default '',
  `on_uid` varchar(32) NOT NULL default '',
  `mb_id` varchar(20) NOT NULL default '',
  `od_pwd` varchar(255) NOT NULL default '',
  `od_name` varchar(20) NOT NULL default '',
  `od_email` varchar(100) NOT NULL default '',
  `od_tel` varchar(20) NOT NULL default '',
  `od_hp` varchar(20) NOT NULL default '',
  `od_zip1` char(3) NOT NULL default '',
  `od_zip2` char(3) NOT NULL default '',
  `od_addr1` varchar(100) NOT NULL default '',
  `od_addr2` varchar(100) NOT NULL default '',
  `od_deposit_name` varchar(20) NOT NULL default '',
  `od_b_name` varchar(20) NOT NULL default '',
  `od_b_tel` varchar(20) NOT NULL default '',
  `od_b_hp` varchar(20) NOT NULL default '',
  `od_b_zip1` char(3) NOT NULL default '',
  `od_b_zip2` char(3) NOT NULL default '',
  `od_b_addr1` varchar(100) NOT NULL default '',
  `od_b_addr2` varchar(100) NOT NULL default '',
  `od_memo` text NOT NULL,
  `od_send_cost` int(11) NOT NULL default '0',
  `od_temp_bank` int(11) NOT NULL default '0',
  `od_temp_card` int(11) NOT NULL default '0',
  `od_temp_hp` int(11) NOT NULL,
  `od_temp_point` int(11) NOT NULL default '0',
  `od_receipt_bank` int(11) NOT NULL default '0',
  `od_receipt_card` int(11) NOT NULL default '0',
  `od_receipt_hp` int(11) NOT NULL default '0',
  `od_receipt_point` int(11) NOT NULL default '0',
  `od_bank_account` varchar(255) NOT NULL default '',
  `od_bank_time` datetime NOT NULL default '0000-00-00 00:00:00',
  `od_card_time` datetime NOT NULL default '0000-00-00 00:00:00',
  `od_hp_time` datetime NOT NULL,
  `od_cancel_card` int(11) NOT NULL default '0',
  `od_dc_amount` int(11) NOT NULL default '0',
  `od_refund_amount` int(11) NOT NULL default '0',
  `od_shop_memo` text NOT NULL,
  `dl_id` int(11) NOT NULL default '0',
  `od_invoice` varchar(255) NOT NULL default '',
  `od_invoice_time` datetime NOT NULL default '0000-00-00 00:00:00',
  `od_hope_date` date NOT NULL default '0000-00-00',
  `od_time` datetime NOT NULL default '0000-00-00 00:00:00',
  `od_ip` varchar(25) NOT NULL default '',
  `od_settle_case` varchar(255) NOT NULL default '',
  `od_escrow1` varchar(255) NOT NULL default '',
  `od_escrow2` varchar(255) NOT NULL default '',
  `od_escrow3` varchar(255) NOT NULL default '',
  `od_cash_no` varchar(255) NOT NULL,
  `od_cash_receipt_no` varchar(255) NOT NULL,
  `od_cash_app_time` varchar(255) NOT NULL,
  `od_cash_reg_stat` varchar(255) NOT NULL,
  `od_cash_reg_desc` varchar(255) NOT NULL,
  `od_cash_tr_code` varchar(255) NOT NULL,
  `od_cash_id_info` varchar(255) NOT NULL,
  `od_cash` tinyint(4) NOT NULL,
  `od_cash_allthegate_gubun_cd` varchar(255) NOT NULL,
  `od_cash_allthegate_confirm_no` varchar(255) NOT NULL,
  `od_cash_allthegate_adm_no` varchar(255) NOT NULL,
  `od_cash_tgcorp_mxissueno` varchar(255) NOT NULL,
  `od_cash_inicis_noappl` varchar(255) NOT NULL,
  `od_cash_inicis_pgauthdate` varchar(255) NOT NULL,
  `od_cash_inicis_pgauthtime` varchar(255) NOT NULL,
  `od_cash_inicis_tid` varchar(255) NOT NULL,
  `od_cash_inicis_ruseopt` varchar(255) NOT NULL,
  `od_cash_receiptnumber` varchar(255) NOT NULL,
  `od_cash_kspay_revatransactionno` varchar(255) NOT NULL,
  PRIMARY KEY  (`od_id`),
  UNIQUE KEY `index1` (`on_uid`),
  KEY `index2` (`mb_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


2. yc4_import_order.php  파일 생성

<?php
include_once('./_common.php');
include_once(G5_LIB_PATH.'/connect.lib.php');
include_once(G5_LIB_PATH.'/outlogin.lib.php');

$g5['title'] = '영카트4 DB 데이터 이전';
include_once(G5_PATH.'/head.sub.php');

//if(get_session('yc4_tables_copied') == 'done')
//    alert('DB 데이터 변환을 이미 실행하였습니다. 중복 실행시 오류가 발생할 수 있습니다.', G5_URL);

if($is_admin != 'super')
    alert('최고관리자로 로그인 후 실행해 주십시오.', G5_URL);
?>

<style>
#g4_import p {padding:0 0 10px;line-height:1.8em}
#g4_import_frm {margin:20px 0 30px;padding:30px 0;border:1px solid #e9e9e9;background:#f5f8f9;text-align:center}
#g4_import_frm .frm_input {background-color:#fff !important}
#g4_import_frm .btn_submit {padding:0 10px;height:24px}
</style>

<!-- 상단 시작 { -->
<div id="hd">
    <h1 id="hd_h1"><?php echo $g5['title'] ?></h1>

    <div id="skip_to_container"><a href="#container">본문 바로가기</a></div>

    <div id="hd_wrapper">

        <div id="logo">
            <a href="<?php echo G5_URL ?>"><img src="<?php echo G5_IMG_URL ?>/logo.jpg" alt="<?php echo $config['cf_title']; ?>"></a>
        </div>

        <ul id="tnb">
            <?php if ($is_member) {  ?>
            <?php if ($is_admin) {  ?>
            <li><a href="<?php echo G5_ADMIN_URL ?>"><b>관리자</b></a></li>
            <?php }  ?>
            <li><a href="<?php echo G5_BBS_URL ?>/member_confirm.php?url=<?php echo G5_BBS_URL ?>/register_form.php">정보수정</a></li>
            <li><a href="<?php echo G5_BBS_URL ?>/logout.php">로그아웃</a></li>
            <?php } else {  ?>
            <li><a href="<?php echo G5_BBS_URL ?>/register.php">회원가입</a></li>
            <li><a href="<?php echo G5_BBS_URL ?>/login.php"><b>로그인</b></a></li>
            <?php }  ?>
            <li><a href="<?php echo G5_BBS_URL ?>/qalist.php">1:1문의</a></li>
            <li><a href="<?php echo G5_BBS_URL ?>/current_connect.php">접속자 <?php echo connect(); // 현재 접속자수  ?></a></li>
            <li><a href="<?php echo G5_BBS_URL ?>/new.php">새글</a></li>
        </ul>
    </div>
</div>

<hr>

<div id="wrapper">
    <div id="container">
        <?php if ((!$bo_table || $w == 's' ) && !defined("_INDEX_")) { ?><div id="container_title"><?php echo $g5['title'] ?></div><?php } ?>

        <div id="g4_import">
            <p>
                이 프로그램은 영카트4의 일부 주문정보를 복제하고자 할때 사용합니다.<br>
                yc4_order_temp 테이블을 생성후 이전을 원하는 주문정보를 미리 저장합니다.<br>
                또한 중복해서 실행하실 경우에도 DB 데이터의 오류가 발생할 수 있으니 반드시 한번만 실행해 주십시오.
            </p>
            <p>프로그램을 실행하시려면 영카트4의 config.php 파일 경로를 입력하신 후 확인을 클릭해 주십시오.</p>

            <form name="fimport" method="post" action="./yc4_import_order_run.php" onsubmit="return fimport_submit(this);">
            <div id="g4_import_frm">
                <label for="file_path">config.php 파일 경로</label>
                <input type="text" name="file_path" id="file_path" required class="frm_input required">
                <label for="file_path">order 테이블</label>
                <input type="text" name="order_table_temp" id="file_path" required class="frm_input required" value="yc4_order_temp">
                <input type="submit" value="확인" class="btn_submit">
            </div>
            </form>

            <p>
                경로는 영카트5 설치 루트를 기준으로 영카트4의 config.php 파일의 상대경로입니다.<br>
                예를 들어 영카트4를 웹루트에 설치하셨고 영카트5를 yc5라는 하위 폴더에 설치하셨다면 입력하실 경로는 ../config.php 입니다.
            </p>

        </div>

        <script>
        function fimport_submit(f)
        {
            return confirm('영카트4의 DB 데이터를 이전하시겠습니까?');
        }
        </script>

    </div>
</div>

<!-- } 콘텐츠 끝 -->

<hr>

<!-- 하단 시작 { -->
<div id="ft">
    <div id="ft_catch"><img src="<?php echo G5_IMG_URL; ?>/ft.png" alt="<?php echo G5_VERSION ?>"></div>
    <div id="ft_copy">
        <p>
            Copyright &copy; <b>소유하신 도메인.</b> All rights reserved.<br>
            <a href="#">상단으로</a>
        </p>
    </div>
</div>

<script>
$(function() {
    // 폰트 리사이즈 쿠키있으면 실행
    font_resize("container", get_cookie("ck_font_resize_rmv_class"), get_cookie("ck_font_resize_add_class"));
});
</script>

<?php
include_once(G5_PATH.'/tail.sub.php');
?>


3. yc4_import_order_run.php  파일 생성

<?php
include_once('./_common.php');

ob_end_clean();

include_once(G5_LIB_PATH.'/connect.lib.php');
include_once(G5_LIB_PATH.'/outlogin.lib.php');

set_time_limit ( 0 );
ini_set('memory_limit', '100M');

$g5['title'] = '영카트4 DB 데이터 이전';
include_once(G5_PATH.'/head.sub.php');

echo '<link rel="stylesheet" href="'.G5_URL.'/g4_import.css">';

if(empty($_POST))
    alert('올바른 방법으로 이용해 주십시오.', G5_URL);

//if(get_session('yc4_tables_copied') == 'done')
//    alert('DB 데이터 변환을 이미 실행하였습니다. 중복 실행시 오류가 발생할 수 있습니다.', G5_URL);

if($is_admin != 'super')
    alert('최고관리자로 로그인 후 실행해 주십시오.', G5_URL);

$g4_config_file = trim($_POST['file_path']);

if(!$g4_config_file)
    alert('config.php 파일의 경로를 입력해 주십시오.');

$g4_config_file = preg_replace('#/config.php$#i', '', $g4_config_file).'/config.php';

if(!is_file($g4_config_file))
    alert('입력하신 경로에 config.php 파일이 존재하지 않습니다.');

$shop_config_file = str_replace('config.php', 'shop.config.php', $g4_config_file);

if(!is_file($shop_config_file))
    alert('입력하신 경로에 shop.config.php 파일이 존재하지 않습니다.\\nshop.config.php 파일은 config.php 파일과 동일한 위치에 있어야 합니다.');

$item_img_path = str_replace('config.php', 'data/item', $g4_config_file);

if(!file_exists($item_img_path))
    alert('상품이미지 폴더를 확인할 수 없습니다. 상품이미지 폴더의 상대경로가 '.$item_img_path.' 이 아니라면\\nyc4_import_run.php 파일에서 $item_img_path 의 값을 수정하신 후 실행해 주십시오.');

$is_euckr = false;
?>
<script>
// 새로고침 방지
function noRefresh()
{
    /* CTRL + N키 막음. */
    if ((event.keyCode == 78) && (event.ctrlKey == true))
    {
        event.keyCode = 0;
        return false;
    }
    /* F5 번키 막음. */
    if(event.keyCode == 116)
    {
        event.keyCode = 0;
        return false;
    }
}

document.onkeydown = noRefresh ;
</script>

<style>
#g4_import_run {}
#g4_import_run ol {margin: 0;padding: 0 0 0 25px;border: 1px solid #E9E9E9;border-bottom: 0;background: #f5f8f9;list-style:none;zoom:1}
#g4_import_run li {padding:7px 10px;border-bottom:1px solid #e9e9e9}
#g4_import_run #run_msg {padding:30px 0;text-align:center}
</style>

<!-- 상단 시작 { -->
<div id="hd">
    <h1 id="hd_h1"><?php echo $g5['title'] ?></h1>
    
    <div id="skip_to_container"><a href="#container">본문 바로가기</a></div>
    
    <div id="hd_wrapper">
    
        <div id="logo">
            <a href="<?php echo G5_URL ?>"><img src="<?php echo G5_IMG_URL ?>/logo.jpg" alt="<?php echo $config['cf_title']; ?>"></a>
        </div>

        <ul id="tnb">
            <?php if ($is_member) {  ?>
            <?php if ($is_admin) {  ?>
            <li><a href="<?php echo G5_ADMIN_URL ?>"><b>관리자</b></a></li>
            <?php }  ?>
            <li><a href="<?php echo G5_BBS_URL ?>/member_confirm.php?url=<?php echo G5_BBS_URL ?>/register_form.php">정보수정</a></li>
            <li><a href="<?php echo G5_BBS_URL ?>/logout.php">로그아웃</a></li>
            <?php } else {  ?>
            <li><a href="<?php echo G5_BBS_URL ?>/register.php">회원가입</a></li>
            <li><a href="<?php echo G5_BBS_URL ?>/login.php"><b>로그인</b></a></li>
            <?php }  ?>
            <li><a href="<?php echo G5_BBS_URL ?>/qalist.php">1:1문의</a></li>
            <li><a href="<?php echo G5_BBS_URL ?>/current_connect.php">접속자 <?php echo connect(); // 현재 접속자수  ?></a></li>
            <li><a href="<?php echo G5_BBS_URL ?>/new.php">새글</a></li>
        </ul>
    </div>
</div>

<hr>

<div id="wrapper">
    <div id="container">
        <div id="g4_import_run">
            <ol>
        <?php
        flush();
        
        // yc4의 confing.php, shop.config.php
        require($g4_config_file);
        require($shop_config_file);
        
        if(preg_replace('/[^a-z]/', '', strtolower($g4['charset'])) == 'euckr')
            $is_euckr = true;
            
        // order table 복사
        $sql = " select * from {$order_table_temp} ";
        $result = sql_query($sql);
        $excl_fld = array('on_uid', 'od_temp_bank', 'od_temp_card', 'od_temp_hp', 'od_temp_point', 'od_receipt_card', 'od_receipt_bank', 'od_receipt_hp', 'od_bank_time', 'od_card_time', 'od_hp_time', 'od_cancel_card', 'od_dc_amount', 'od_refund_amount', 'dl_id', 'od_escrow1', 'od_escrow2', 'od_escrow3', 'od_cash_no', 'od_cash_receipt_no', 'od_cash_app_time', 'od_cash_reg_stat', 'od_cash_reg_desc', 'od_cash_tr_code', 'od_cash_id_info', 'od_cash', 'od_cash_allthegate_gubun_cd', 'od_cash_allthegate_confirm_no', 'od_cash_allthegate_adm_no', 'od_cash_tgcorp_mxissueno', 'od_cash_inicis_noappl', 'od_cash_inicis_pgauthdate', 'od_cash_inicis_pgauthtime', 'od_cash_inicis_tid', 'od_cash_inicis_ruseopt', 'od_cash_receiptnumber', 'od_cash_kspay_revatransactionno');

        for($i=0; $row=sql_fetch_array($result); $i++) {
            if($is_euckr)
                $row = array_map('iconv_utf8', $row);
            $comma = '';
            $sql_common = '';
            foreach($row as $key=>$val) {
                if(in_array($key, $excl_fld))
                    continue;
                $sql_common .= $comma . " $key = '".addslashes($val)."' ";
                $comma = ',';
            }
            
            $od_receipt_price = $row['od_receipt_bank'] + $row['od_receipt_card'] + $row['od_receipt_hp'];
            $od_refund_price = $row['od_refund_amount'];
            $od_receipt_time = $row['od_bank_time'];
            if(!is_null_time($row['od_card_time']))
                $od_receipt_time = $row['od_card_time'];
            else if(!is_null_time($row['od_hp_time']))
                $od_receipt_time = $row['od_hp_time'];
                
            // 배송정보
            $od_status = '주문';
            $od_delivery_company = '';
            if($row['dl_id'] && $row['od_invoice']) {
                $dl = sql_fetch(" select dl_company from {$g4['yc4_delivery_table']} where dl_id = '{$row['dl_id']}' ");
                $od_delivery_company = addslashes($dl['dl_company']);

                $od_status = '배송';
            }
            $sql_common .= $comma . " od_receipt_price = '$od_receipt_price', od_refund_price = '$od_refund_price', od_status = '$od_status', od_delivery_company = '$od_delivery_company', od_receipt_time = '$od_receipt_time' ";
            sql_query(" INSERT INTO {$g5['g5_shop_order_table']} SET $sql_common ");
            
            /*
            // 장바구니자료복사
            $sql2 = " select * from {$g4['yc4_cart_table']} where on_uid = '{$row['on_uid']}' ";
            $result2 = sql_query($sql2);
            $excl_fld2 = array('ct_id', 'on_uid', 'it_opt1', 'it_opt2', 'it_opt3', 'it_opt4', 'it_opt5', 'it_opt6', 'ct_amount', 'ct_send_cost');
            for($k=0; $row2=sql_fetch_array($result2); $k++) {
                if($is_euckr)
                    $row2 = array_map('iconv_utf8', $row2);
                $comma = '';
                $sql_common2 = '';

                foreach($row2 as $key=>$val) {
                    if(in_array($key, $excl_fld2))
                        continue;
                        
                    $sql_common2 .= $comma . " $key = '".addslashes($val)."' ";
                    $comma = ',';
                }
                
                $od_id = $row['od_id'];
                
                $ct_price = $row2['ct_amount'];
                
                // 상품명
                $it = sql_fetch(" select it_name from {$g5['g5_shop_item_table']} where it_id = '{$row2['it_id']}' ");
                $it_name = addslashes($it['it_name']);
                
                // 주문옵션
                $ct_option = '';
                $deli = '';
                for($j=1; $j<=6; $j++) {
                    if($row2['it_opt'.$j]) {
                        $ct_option .= $deli . $row2['it_opt'.$j];
                    }
                }
                
                if($ct_option)
                    $ct_option = addslashes($ct_option);
                    
                $sql_common2 .= $comma . " ct_price = '$ct_price', it_name = '$it_name', ct_option = '$ct_option' ";
                
                //sql_query(" INSERT INTO {$g5['g5_shop_cart_table']} SET od_id = '$od_id', $sql_common2 , ct_select = '1' ");
            }
            */
            
            // 주문상품의 상태체크
            $cnt1 = sql_fetch(" select count(*) as cnt from {$g5['g5_shop_cart_table']} where od_id = '$od_id' ");
            $cnt2 = sql_fetch(" select count(*) as cnt from {$g5['g5_shop_cart_table']} where od_id = '$od_id' and ct_status = '완료' ");
            if($cnt1['cnt'] == $cnt2['cnt'] && $cnt2['cnt'] > 0)
                $od_status = '완료';
                
            // 미수금 등의 정보
            $info = get_order_info($od_id);
            
            if(!$info)
                continue;
                
            $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_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);
        }
        echo '<li>order table 복사</li>'.PHP_EOL;
        
        // wish table 복사
        $sql = " select * from {$g4['yc4_wish_table']} ";
        $result = sql_query($sql);
        for($i=0; $row=sql_fetch_array($result); $i++) {
            if($is_euckr)
                $row = array_map('iconv_utf8', $row);
                
            $comma = '';
            $sql_common = '';

            foreach($row as $key=>$val) {
                if($key == 'wi_id')
                    continue;
                    
                $sql_common .= $comma . " $key = '".addslashes($val)."' ";
                
                $comma = ',';
            }
            
            //sql_query(" INSERT INTO {$g5['g5_shop_wish_table']} SET $sql_common ");
        }
        //echo '<li>event item table 복사</li>'.PHP_EOL;
        
        echo '</ol>'.PHP_EOL;
        
        echo '<div id="run_msg">영카트4 DB 추가 주문데이터 이전 완료</div>'.PHP_EOL;
        
        // 실행완료 세션에 기록
        set_session('yc4_tables_copied', 'done');
        ?>
        </div>
    </div>
</div>

<hr>

<script>
$(function() {
    // 폰트 리사이즈 쿠키있으면 실행
    font_resize("container", get_cookie("ck_font_resize_rmv_class"), get_cookie("ck_font_resize_add_class"));
});
</script>

<?php include_once(G5_PATH.'/tail.sub.php'); ?>

댓글목록

등록된 댓글이 없습니다.


Total 2,633건 10 페이지
  • RSS
기술자료 목록
2453
PHP   7878  2021-03-04 19:10 ~ 2021-06-22 00:03  
2452
PHP   6627  2021-03-03 16:20 ~ 2021-03-03 16:21  
2451
그누보드   4406  2021-02-25 22:28 ~ 2021-03-17 11:33  
2450
그누보드   5738  2021-02-18 10:28 ~ 2021-02-18 14:10  
2449
그누보드   6180  2021-02-08 14:43 ~ 2021-02-08 16:31  
2448
PHP   10792  2021-01-20 12:07 ~ 2021-01-27 13:35  
2447
전자결제   7914  2021-01-01 01:20 ~ 2021-01-13 19:41  
2446
JavaScript   6293  2020-12-24 19:40  
2445
HTML   4910  2020-12-20 11:42  
2444
SNS   8183  2020-12-18 07:58  
2443
그누보드   7019  2020-12-14 18:09 ~ 2023-04-04 11:18  
2442
SNS   6109  2020-12-11 09:37 ~ 2020-12-18 11:55  
2441
Apple   5708  2020-12-10 14:22 ~ 2020-12-17 00:27  
2440
Android   9109  2020-12-10 12:22 ~ 2020-12-17 00:27  
2439
그누보드   6116  2020-12-07 15:15 ~ 2022-12-17 21:15  
2438
SNS   6426  2020-11-30 14:39 ~ 2020-12-12 09:04  
2437
SNS   5780  2020-11-29 16:55 ~ 2020-12-18 19:53  
2436
SNS   9747  2020-11-25 14:04 ~ 2020-12-12 09:05  
2435
Apple   5265  2020-11-24 19:27 ~ 2020-11-24 19:34  
2434
SNS   5812  2020-11-23 03:38 ~ 2020-12-17 09:25  

검색

해피정닷컴 정보

회사소개 회사연혁 협력사 오시는길 서비스 이용약관 개인정보 처리방침

회사명: 해피정닷컴   대표: 정창용   전화: 070-7600-3500   팩스: 042-670-8272
주소: 서울센터 (08393) 서울시 구로구 디지털로32가길 16 파트너스타워2차 1206-280호
        대전센터 (34368) 대전시 대덕구 대화로 160 대전산업용재유통단지 지원1동 205호
개인정보보호책임자: 정창용   사업자번호: 119-05-36414
통신판매업신고: 2014-서울구로-0074 [사업자등록확인]  
Copyright 2001~2024 해피정닷컴. All Rights Reserved.