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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
<?php include_once("./_common.php");
$prodinfo = product_info_get($code); // 제품정보 가져옴 $cateinfo = cate_info_get($prodinfo['code2']); // 분류정보 가져옴 $hasWishcnt = prod_wish_heart($prodinfo['code']);
if($prodinfo['p_use']=='0'){ alert("판매중인 상품이 아닙니다."); }
$is_soldout = false; if($prodinfo['opt_yn']==1){ // 옵션 상품 일 경우 $opt_array = prod_opt_get($prodinfo['code'], "" ,""); // 상품옵션 가져옴 } else { if($prodinfo['jego']<='0' || $prodinfo['p_soldout']=='1'){ // 품절 체크 $is_soldout = true; } } $addopt_array = prod_addopt_get($prodinfo['code'], "" ,""); // 추가상품옵션 가져옴
if(table_field_ck("shop_cart", "ev_code")){ // 이벤트 전용단가별로 장바구니 가져옴 $add_where = " and ev_code = '{$ev_code}' "; } $sql = "select * from shop_cart where od_id = '{$od_ids}' and pcode = '{$code}' {$add_where}"; $res = mysql_query($sql,$connect_j3); while($info=mysql_fetch_array($res)){ $ct_array[] = $info; }
//_pr($prodinfo);
?>
<table class="sit_ov_tbl" class="width480"> <colgroup> <col class="width100"> <col class="width300"> <col class="width100"> </colgroup> <tr> <td class="p15_0 txt14 align_c gray_line_b2"><a href='<?php echo $it_href;?>'><img src="<?php echo $thumb_file = get_it_thumbnail($prodinfo['pcode'],$prodinfo['pic1'],80,80);?>" class="box80" alt=""></a></td> <td class="p15_10 txt14 gray2 gray_line_b2"> <p class="mb10 txt15 bold"><?php echo $prodinfo['name'];?></p> </td> <td class="p15_10 txt14 gray2 gray_line_b2"> <p class="mb10 txt15 bold"><?php echo number_format($prodinfo['saleprice']);?>원</p> </td> </tr> </table> <br> <table class="sit_ov_tbl" class="width480"> <colgroup> <col class="width140"><col class="width340"> </colgroup> <?php if($prodinfo['opt_yn']==1){ // 옵션상품일경우 ?> <tr><td colspan="2" class="dotline"></td></tr> <tr> <th class="align_l txt14 height30 l_height30">상품선택</th> <td class="l_height30"> <div class="sit_ov_sel relative box340_30 gray_line" style="background:url('<?php echo $cur_img_url;?>/location.png') 0 -85px no-repeat;"> <label for="opt" class="absolute ab_top_left10 width300 ellipsis pointer label_class" id='label_id' >선택</label> <select id="opt" title="옵션선택" class="width_full height30 l_height30 p0_10 opacity0 pointer"> <option value=''> 선택 </option> <?php $jego_cnt = 0; foreach($opt_array as $key=>$opt){ if($opt['p_soldout']!='1'){ if($opt['jego']>0){ $jego_cnt += $opt['jego']; } } ?> <option value='<?php echo $opt['code']?>'> <?php echo $opt['name']." ".$opt['opt_price'];?> <?php if($opt['jego']<"0" || $opt['p_soldout']==1){ echo "[품절]"; } else { if($configshop['qty_hidden']!='1'){ echo "[재고:".number_format($opt['jego'])."]"; } } ?> </option> <?php } if($jego_cnt=='0'){ $is_soldout = true; } ?> </select> </div> </td> </tr> <?php }?> <?php if(count($addopt_array)>0){ ?> <tr><td colspan="2" class="dotline"></td></tr> <tr> <th class="align_l txt14 height30">추가구성상품</th> <td class="l_height30"> <div class="sit_ov_sel relative box340_30 gray_line" style="background:url('<?php echo $cur_img_url;?>/location.png') 0 -85px no-repeat;"> <label for="opt_add" class="absolute ab_top_left10 width300 ellipsis pointer">선택</label> <select id="opt_add" title="옵션선택" class="width_full height30 l_height30 p0_10 opacity0 pointer"> <option value=''> 선택 </option> <?php foreach($addopt_array as $key=>$opt){ ?> <option value='<?php echo $opt['code']?>'> <?php echo $opt['name']." +".$opt['saleprice'];?>원 <?php if($opt['jego']<"0" || $opt['p_soldout']==1){ echo "[품절]"; } else { if($configshop['qty_hidden']!='1'){ echo "[재고:".number_format($opt['jego'])."]"; } } ?> </option> <?php } ?> </select> </div> </td> </tr> <?php } ?> </table> <form name='item_cart_form' id='item_cart_form' method='post'> <!-- 옵션 선택 항목이 이곳에 표시됨 --> <input type='hidden' name='od_ids' value='<?php echo $od_ids;?>'> <input type='hidden' name='code' value='<?php echo $prodinfo['code'];?>'> <input type='hidden' name='ct_name' value='<?php echo $prodinfo['name'];?>'> <input type='hidden' name='ct_price' value='<?php echo $prodinfo['saleprice'];?>'> <div class='opt_sel_class'> </div> <!-- .opt_sel_class end--> </form>
<div id="sit_tot_price" class="mt20">총 상품금액 : <div class="float_r"><span class="gray">총 수량 <span class='all_qty_class'>0</span>개 │</span><span class="ml10 cost2 all_price_class">0</span>원</div> </div>
<script> $(function(){ <?php foreach($ct_array as $key=>$val){?> add_opt_info_get('<?php echo $val['opt_pcode']?>','<?php echo $val['opt_mode']?>','<?php echo $val['ct_qty']?>'); <?php }?>
var select = $("#opt, #opt_add"); // 옵션 셀렉트 처리 select.change(function(){ var select_name = $(this).children("option:selected").text(); $(this).siblings("label").text(select_name);
code = $(this).val(); if($(this).attr("id")=='opt'){ mode = 'opt'; } else { mode = 'addopt'; } add_opt_info_get(code,mode,''); });
// *********************************** // 옵션 수량변경(+,-)과 옵션상품 삭제는 common.js로 옮겼음 // ***********************************
}); function add_opt_info_get(code,mode,ct_qty){ // 옵션 상품 정보 가져옴 if(code==''){ return; } $.get("ajax.opt_sel_get.php?code="+code+"&mode="+mode+"&ct_qty="+ct_qty+"&ev_code=<?php echo $ev_code;?>",function(rtn){ $v = rtn.split("§§§"); $pcode = $v[0]; $rtn = $v[1]; if($pcode==0){ if($rtn!=''){ alert($rtn); } return; } // 품절 상품일 경우 처리 $dflag = 0; $(".opt_sel_class").find("input[name='opt_code[]']").each(function(){ // 기존 옵션 중복 체크 if($pcode==$(this).val()){ $dflag = 1; } }); if($dflag==0){ $(".opt_sel_class").append($rtn); sum_opt_price(); } }); }
function sum_opt_price(){ // 합산처리 $sum_price = 0; $cnt = 0; $(".sit_sel_option_class").each(function(){ $price = $(this).find("input[name='opt_price[]']").val(); $qty = $(this).find("input[name='qty[]']").val(); $sum_price = $sum_price + (parseInt($price)*parseInt($qty)); $cnt++; }); //alert($sum_price); $(".all_qty_class").html($cnt); $(".all_price_class").html(formatCurrency($sum_price)); } </script>
|