/home/mjc1/public_html/adm/shop_admin/orderformupdate.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
$sub_menu 
'270100';
include_once(
'./_common.php');

if(
$_POST['mod_type'] == 'od_delete'){ // 주문삭제 기능

    //_pr($_POST); exit;
    
$sql "select * from {$g5['g5_shop_cart_table']} where od_id = '$od_id' ";
    
$res sql_query($sql);
    while(
$info=sql_fetch_array($res)){
        if(
$info['ct_stock_use']=='1'){
            
$sql "select * from {$g5['g5_shop_item_table']} where it_id = '{$info['it_id']}'";
            
$it sql_fetch($sql);

            if(
$it['it_3']=='2'){ // 셋트재고 방식일경우
                
$sql "select * from {$g5['g5_shop_item_option_table']} where it_id = '{$info['it_id']}' and io_id = '{$info['io_id']}' ";
                
$io sql_fetch($sql);
                
$use_qty $info['ct_qty']*$io['io_qty_weight']; // 셋트재고일경우 가중치 적용

                
$sql "update {$g5['g5_shop_item_table']} set it_stock_qty =  it_stock_qty + {$use_qty} where it_id = '{$info['it_id']}' ";
                
//_pr($sql);
                
sql_query($sql);

                
set_item_qty_cal($info['it_id']); // 셋트옵션일 경우 본상품 재고 기반으로 재계산함
            
} else {
                
$use_qty $info['ct_qty'];

                if(
$info['io_id']!=''){ // 옵션일경우
                    
$sql "update {$g5['g5_shop_item_option_table']} set io_stock_qty =  io_stock_qty + {$use_qty} where it_id = '{$info['it_id']}' and io_id = '{$info['io_id']}' ";
                } else {
                    
$sql "update {$g5['g5_shop_item_table']} set it_stock_qty =  it_stock_qty + {$use_qty} where it_id = '{$info['it_id']}' ";
                }
                
//_pr($sql);
                
sql_query($sql);
            }
        }
        if(
$info['ct_point_use']=='1'){ // 포인트 적립하면 해당 포인트 삭제
            
$sql "delete from {$g5['point_table']} where po_rel_action = '{$info['od_id']},{$info['ct_id']}' ";
            
sql_query($sql);
        }
    }
    
$sql "delete from {$g5['g5_shop_cart_table']} where od_id = '$od_id'"// 장바구니 삭제
    
sql_query($sql);
    
$sql "delete from {$g5['g5_shop_order_table']} where od_id = '$od_id'"// 주문 삭제
    
sql_query($sql);


} else if(
$_POST['mod_type'] == 'info') {
    
$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&amp;sort2=$sort2&amp;sel_field=$sel_field&amp;search=$search&amp;page=$page&od_status=$od_status";

if(
$_POST['mod_type'] == 'od_delete'){
    
goto_url("./orderlist.php?od_id=$od_id&amp;$qstr");
} else {
    
goto_url("./orderform.php?od_id=$od_id&amp;$qstr");
}
?>