/home/mjc1/public_html/j3demo/shop/cart.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?php
include_once("./_common.php");
include_once(
$j3_shop_path."/shop_header.php");

if(
$configshop['buy_level']>$cinfo['mb_lv']){
    
alert('주문하실 권한이 없습니다.'); exit;
}
if(
$configshop['price_level']>$cinfo['mb_lv'] && $configshop['price_level_buy']=='1'){
    
alert('주문하실 권한이 없습니다.'); exit;
}

//$custinfo = customer_info_get($id_ccode);
$custinfo $cinfo;
if(
$custinfo['pt_index']!='2'){ $configshop['po_use'] = '0'; }

$od_id get_od_id("cart"); //세션에 저장된 주문번호 가져오고 기존 장바구니가 있으면 주문번호 변경한다.
init_cart($od_id); // 장바구니 돌아올때 바로주문이나 선택주문의 ct_state를 초기화 한다.

$where2 " and a.od_id = '{$od_id}' and a.ct_state in (0)";

$list_num 9999;
if(
$_COOKIE['page_line']!=''){ $list_num $_COOKIE['page_line']; }
if (
$page 1) { $page 1; } // 페이지가 없으면 첫 페이지 (1 페이지)

$ct_box 0;
$list_array prod_cart_list_get($id_ccode$where2$page$list_num);

$total_page $list_array[0]['total_page'];
$list_num $list_array[0]['list_num'];
$total_count $list_array[0]['total_count'];

$qstr $_SERVER['QUERY_STRING'];

?>
<div id="container">
    <div id="wrapper">

<?php
    skin_module_show
("cart",$sample_idx); // 장바구니 스킨을 불러온다.
?>

    </div><!-- #wrapper -->
</div><!-- #container -->
<script>
$(function(){
    $(".check_all_class").click(function(){ // 전체선택 전체선택 해제
        if($(this).is(":checked")){
            $("input[name='code_idx[]']").prop("checked",true);
        } else {
            $("input[name='code_idx[]']").prop("checked",false);            
        }
    });

    $(".shop_continue_class").click(function(){ // 쇼핑계속하기 클릭시
        document.location.href='<?php echo $j3_shop_url;?>';
    });

    $(".cart_del_class").click(function(){ // 단일 삭제
        if(confirm('삭제하시겠습니까?')){    
            $(".code_idx_calss").attr("checked",false);
            $(this).closest("tr").find(".code_idx_calss").click();
            $("#sel_del").val("Y");
            cart_delete_process();
        }
    });

    $(".cart_sel_del_class").click(function(){ // 선택 삭제
        ck_cnt = 0;
        $(".code_idx_calss").each(function(){    if($(this).is(":checked")){ ck_cnt++; }    });
        if(ck_cnt==0){ alert("삭제하실 상품을 선택하시기 바랍니다."); return; }
        if(confirm('삭제하시겠습니까?')){    
            $("#sel_del").val("Y");
            cart_delete_process();        
        }
    });

    // 수량 +,- 직접 변경관련 script는 common.js에 통합관리하기로 변경함
    // $(".qty_minus_class").click(function(){
    // $(".qty_plus_class").click(function(){

    $(".qty_ch_class").click(function(){ // 수량변경 버튼
        if(confirm('수량을 변경하시겠습니까??')){    
            $(".code_idx_calss").attr("checked",false);
            $(this).closest("tr").find(".code_idx_calss").click();
            $("#sel_del").val("qty_ch");
            cart_delete_process();
        }
    });

    $(".opt_ch_class").click(function(){ // 옵션 변경 처리    
        $code = $(this).closest("tr").find("input[name='pcode[]']").val();
        $od_ids = $(this).closest("tr").find("input[name='od_ids[]']").val();
        $ev_code = $(this).closest("tr").find("input[name='p_ev_code[]']").val();
        $.get("cart_option.inc.php?od_ids="+$od_ids+"&code="+$code+"&ev_code="+$ev_code,function(rtn){
            $("#modal_member_box").html(rtn).dialog({
                resizable: true, height:600, width:520, modal: true, title:"상품옵션 [변경]",
                buttons: {
                    변경: function() {
                        prod_cart_save('cart');
                    },
                    닫기: function() {
                        $( this ).dialog( "close" );
                    }
                }
            });
        });    
    });

    $(".cart_sel_order_class").click(function(){ // 선택주문하기
        ck_cnt = 0;
        $(".code_idx_calss").each(function(){    if($(this).is(":checked")){ ck_cnt++; }    });
        if(ck_cnt==0){ alert("주문하실 상품을 선택하시기 바랍니다."); return; }
        cart_order_process();
    });
    
    $(".cart_order_class").click(function(){ // 전체주문하기
        $(".code_idx_calss").attr("checked",true);
        cart_order_process();
    });


});

function cart_delete_process(){
    form_data = $("#cart_list_form").serialize();
    $.ajax({type:"post", url:"ajax.prod_cart_process.php", data:form_data, async:false, dataType : "xml", 
        success:function(xml){    
            var v_mode = $(xml).find("mode").text();
            var v_mode_ok = $(xml).find("mode_ok").text();
            var v_msg = $(xml).find("msg").text();
            if(v_mode_ok!='Y'){
                alert(v_msg);
            } else {
                document.location.reload();
            }
        },
        error:function(rtn,status,error){    alert(error);        }
    });
}

/* prod_cart_save() 는 common.php로 이동함 */

function cart_order_process(){ // 주문하기
    $form_obj = $("#cart_list_form");
    form_data = $form_obj.serialize();

    $.ajax({type:"post", url:"ajax.cart_order_process.php", data:form_data, async:false, dataType : "xml", 
        success:function(xml){    
            var v_mode = $(xml).find("mode").text();
            var v_mode_ok = $(xml).find("mode_ok").text();
            var v_msg = $(xml).find("msg").text();
            if(v_mode_ok!='Y'){
                alert(v_msg);
            } else {
                if(v_msg!=''){ alert(v_msg); }
                document.location.href='orderform.php'
            }
        },
        error:function(rtn,status,error){    alert(error);        }
    });
}
</script>
<?php
include_once($j3_shop_path."/shop_footer.php");
?>
<div id="modal_member_box" title="거래처수정" style="display:none;width:100%; height:100%; padding-top:3px;padding-left:3px;background-color:#FFFFFF;position:relative;"></div>