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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
|
<?php $dir = "."; include_once($dir."/_common.php"); include('./header.php');
if($eid==''){ alert('로그인 후에 이용가능합니다.',"index.php"); exit; }
//_pr($prod_array);
$qstr = $_SERVER['QUERY_STRING']; ?> <style> .link_ico_class {/*position:absolute;*/} .background_map { background:pink; } </style> <!--<div id="contents" style="background:#999"><img src="http://placehold.it/960x150" alt="롤링배너"></div>--> <div id="contents" style="height:2px;border-bottom:1px solid #eee;background:#2f6ba9"> <span class="screen_out">header 하단 선</span> </div>
<div id="wrap"> <div id="sub-title"> <h2>상품 동기화</h2> <div class="sub-location"> <a href="./index.php" class="home"><span class="screen_out">홈</span></a> <span class="location-gt"></span> <a>상품 관리</a> <span class="location-gt"></span> <a>상품 동기화</a> </div> </div> <form name='category_search_form' method='get'> <input type='hidden' name='biztype' size='' value='<?php echo $biztype;?>'> <div id="sub-contents-area"> <div class="sub-btn-area"> <div class="sub-btn"> <a class="lignt-blue-btn" id='btn_map_new'>동기화 처리</a> <a class="blue-btn" id='btn_map_cancel'>동기화 해제</a> <!--<a class="blue-btn" id='cate_prod_move'>분류상품이동</a><?php if($Orow['ordstate']==0){ ?><a class="black-btn">전체삭제</a><?php }?><a class="gray-btn" id='buy_print'>인쇄</a>--><!--<a class="gray-btn" id='xls_down'>엑셀</a><a class="black-btn" id='sel_delete'>선택삭제</a>--> </div> </div> <div class="sub-btn-area"> <div class="sub-btn sub-btn-search"> 라인수 <?php echo paging_select($_COOKIE['page_line']);?> <!--<select name='stc'> <option value='' <?php if($stc==''){ echo "selected"; }?>>-분류차수-</option> <option value='1' <?php if($stc=='1'){ echo "selected"; }?>>1차만</option> <option value='2' <?php if($stc=='2'){ echo "selected"; }?>>2차만</option> <option value='3' <?php if($stc=='3'){ echo "selected"; }?>>3차만</option> <option value='4' <?php if($stc=='4'){ echo "selected"; }?>>4차만</option> </select>--> </div> </div> </div> </form> <div class="item_tab"> <div class="item_tab_navi"> <a value='0' ><span>전체</span></a> <a value='1'><span>11번가</span></a> <a value='9' class="on"><span>상품동기화</span></a> </div> </div>
<form name='product_list_form' id='product_list_form' method='post'> <!-- 동기화용 폼 --> <input type='hidden' name='sel_del' value=''> <input type='hidden' name='drag_idx' value=''> <input type='hidden2' name='drag_io' value='xxx'> <input type='hidden2' name='drag_key' value='xxx'> <input type='hidden' name='drag_no' value=''> <input type='hidden' name='drop_idx' value=''> <input type='hidden' name='drop_no' value=''> <input type='hidden' name='drop_ocode' value=''> </form> <form name='otms_product_form' id='otms_product_form' method='post' onsubmit='return false;'> <!-- 오픈마켓 상품 폼 --> <input type='hidden' name='sel_del' value=''> <input type='hidden' name='page' value='1'> <div class="div-list-area" style='float:left;font-size:0.8em;width:49%;margin-right:10px;'> <div class="sub-btn sub-btn-search"> <select name='sti'> <option value='aa.p_name' <?php if($sti=='aa.p_name'){?>selected<?php }?>>상품명</option> <option value='aa.p_code' <?php if($sti=='aa.p_code'){?>selected<?php }?>>상품코드</option> <option value='aa.c_name' <?php if($sti=='aa.c_name'){?>selected<?php }?>>분류명</option> </select> <input type='text' id='stx' name='stx' size='' value='<?php echo $stx;?>' class="stx_class"> <a class="black-btn" id='search_btn_press'>검색</a> </div> <br> 오픈마켓 상품 <div class="cust-list-area otms_div_class" > </div> </div> </form> <form name='cs_product_form' id='cs_product_form' method='post' onsubmit='return false;'> <!-- 천년상품 폼 --> <input type='hidden' name='sel_del' value=''> <input type='hidden' name='p_code' value=''> <input type='hidden' name='io_id' value=''> <input type='hidden' name='io_key' value=''> <div class="div-list-area" style='float:left;font-size:0.9em;width:49%;margin-right:10px;'> <div class="sub-btn sub-btn-search"> <select name='sti'> <option value='a.name' <?php if($sti=='a.name'){?>selected<?php }?>>상품명</option> <option value='a.code' <?php if($sti=='a.code'){?>selected<?php }?>>상품코드</option> <option value='c.name' <?php if($sti=='c.name'){?>selected<?php }?>>분류명</option> </select> <input type='text' id='stx' name='stx' size='' value='<?php echo $stx;?>' class="stx_class"> <a href="#" class="black-btn" id='search_btn_press'>검색</a> </div> <br> 천년경영 상품 <div class="cust-list-area cs_div_class" > </div> </div> </form>
<span class='help_info'>링크 드래그 동기화는 IE11이상, 엣지, 최신 크롬, 사파리, 파이어폭스등에서만 정상동작 보장합니다.</span>
</div><!--//wrap-->
<script> var qstr = '<?php echo $qstr;?>'; $(function(){ $(".paging_sel_class").change(function(){ // 순서변경시 var vp = $(".paging_sel_class option:selected").val(); setsave("page_line", vp, 31);
document.location.reload(); });
$(".item_tab_navi a").click(function(){ //네비게이션 탭 처리 v = $(this).attr("value"); if(v==0){ document.location.href="./product.php"; } else if(v==9){ document.location.href="./product_map.php"; } });
$(".check_all_class").click(function(){ // 전체선택 전체선택 해제 $table_obj = $(this).closest("table"); if($table_obj.hasClass("otms_table_class")==true){ $table_witch = ".otms_table_class"; } else { $table_witch = ".cs_table_class"; } if($(this).is(":checked")){ $($table_witch+" input[name='code_idx[]']").prop("checked",true); } else { $($table_witch+" input[name='code_idx[]']").prop("checked",false); } });
$("#xls_down").click(function(){ // 엑셀다운로드 document.category_search_form.action='category_xls_down.php'; document.category_search_form.target = '_blank'; document.category_search_form.submit(); });
$("#otms_product_form #search_btn_press").click(function(){ otms_prod_get(1); }); $("#cs_product_form #search_btn_press").click(function(){ cs_prod_get(1); });
$("#otms_product_form .stx_class").keypress(function(){ if(event.keyCode==13){ otms_prod_get(1); } }); $("#cs_product_form .stx_class").keypress(function(){ if(event.keyCode==13){ cs_prod_get(1); } });
$("#btn_map_new").click(function(){ // 동기화 처리 버튼 $otms_ck_cnt = $(".otms_idx_class:checked").size(); $cs_ck_cnt = $(".cs_idx_class:checked").size(); if($otms_ck_cnt==0 || $cs_ck_cnt==0){ alert('동기화할 상품을 선택하시기 바랍니다.'); return; } if($otms_ck_cnt>1 || $cs_ck_cnt>1){ alert('동기화할 상품은 1개만 선택하시기 바랍니다.'); return; }
$drag_no = $(".otms_idx_class:checked").val(); $("input[name='drag_no']").val($drag_no); $drag_idx = $(".otms_table_class input[name='codes[]']").eq($drag_no).val(); $("input[name='drag_idx']").val($drag_idx); $drag_io = $(".otms_table_class input[name='io_id[]']").eq($drag_no).val(); $("input[name='drag_io']").val($drag_io); $drag_key = $(".otms_table_class input[name='io_key[]']").eq($drag_no).val(); $("input[name='drag_key']").val($drag_key);
$drop_no = $(".cs_idx_class:checked").val(); $("input[name='drop_no']").val($drop_no); $drop_idx = $(".cs_table_class input[name='codes[]']").eq($drop_no).val(); $("input[name='drop_idx']").val($drop_idx); $ocode = $(".cs_table_class input[name='ocode[]']").eq($drop_no).val(); $("input[name='drop_ocode']").val($ocode);
link_product(); });
$("#btn_map_cancel").click(function(){ // 동기화 해제 처리 $otms_ck_cnt = $(".otms_idx_class:checked").size(); $cs_ck_cnt = $(".cs_idx_class:checked").size(); if($otms_ck_cnt==0){ alert('동기화해제 할 상품을 선택하시기 바랍니다.'); return; } if($cs_ck_cnt>0){ alert('동기화 해제는 오픈마켓 상품 기준으로 처리됩니다. 천년경영 상품 체크는 해제합니다.'); $(".cs_idx_class").prop("checked",false); } if(confirm('정말로 선택된 상품의 동기화을 해제하시겠습니까?')){ $form_obj = $("#otms_product_form"); $("input[name='sel_del']").val("map_cancel"); form_data = $form_obj.serialize();
$.ajax({type:"post", url:"ajax.product_map_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); } }); } });
$(document).on("click",".click_edit",function(){ $p_code = $(this).closest("tr").find("input[name='codes[]']").val(); $io_id = $(this).closest("tr").find("input[name='io_id[]']").val(); $io_key = $(this).closest("tr").find("input[name='io_key[]']").val(); $form_obj = $("#cs_product_form"); $form_obj.find("input[name='p_code']").val($p_code); $form_obj.find("input[name='io_id']").val($io_id); $form_obj.find("input[name='io_key']").val($io_key);
cs_prod_get(); });
otms_prod_get(1); cs_prod_get(1); });
function link_product(){ // 링크 동기화 처리 $form_obj = $("#product_list_form"); $drag_idx = $("input[name='drag_idx']").val(); $drop_idx = $("input[name='drop_idx']").val(); $drag_no = $("input[name='drag_no']").val(); $drop_no = $("input[name='drop_no']").val();
if($drag_idx!='' && $drop_idx!=''){ $mode = "map_new"; $drag_tr = $(".otms_idx_class").eq($drag_no).closest("tr"); $drop_tr = $(".cs_idx_class").eq($drop_no).closest("tr"); if($drag_tr.hasClass("background_map")==true || $drop_tr.hasClass("background_map")==true){ alert('이미 동기화된 상품들끼리 변경은 불가능합니다.'); return; } else if($drag_tr.hasClass("background_map")==true){ if(confirm('이미 오픈마켓 상품이 동기화되어 있습니다. 다시 동기화하시겠습니까?')){ $mode = "cs_new"; } else { return; }
} else if($drop_tr.hasClass("background_map")==true){ if(confirm('이미 천년 상품이 동기화되어 있습니다. 다시 동기화하시겠습니까?')){ $mode = "otms_new"; } else { return; } } $("input[name='sel_del']").val($mode); form_data = $form_obj.serialize();
$.ajax({type:"post", url:"ajax.product_map_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();
var v_dis_otms = $(xml).find("dis_otms").text(); var v_dis_cs = $(xml).find("dis_cs").text(); if(v_mode_ok!='Y'){ alert(v_msg); } else { if(v_dis_otms!=''){ // 동기화된 천년 상품을 다른 오픈마켓 상품으로 동기화할경우 $(".otms_table_class input[name='codes[]']").each(function($idx,$val){ if($(this).val()==v_dis_otms){ $(".otms_idx_class").eq($idx).prop("checked",false); $(".otms_table_class tbody tr").eq($idx).removeClass("background_map"); } }); } if(v_dis_cs!=''){ // 동기화된 오픈마켓 상품을 다른 천년경영 상품으로 동기화할경우 $(".cs_table_class input[name='codes[]']").each(function($idx,$val){ if($(this).val()==v_dis_cs){ $(".cs_idx_class").eq($idx).prop("checked",false); $(".cs_table_class tbody tr").eq($idx).removeClass("background_map"); } }); } /*$(".otms_idx_class").eq($drag_no).prop("checked",true); $(".cs_idx_class").eq($drop_no).prop("checked",true);*/
$(".otms_table_class tbody tr").eq($drag_no).addClass("background_map"); $(".cs_table_class tbody tr").eq($drop_no).addClass("background_map");
$(".otms_idx_class").prop("checked",false); $(".cs_idx_class").prop("checked",false); } }, error:function(rtn,status,error){ alert(error); } }); } }
function otms_prod_get($page){ // 오픈마켓 상품 리스트 가져오기 $sti = $("#otms_product_form select[name='sti'] option:selected").val(); $stx = $("#otms_product_form input[name='stx']").val(); $.get("ajax.product_map_list.php?page="+$page+"&stx="+$stx+"&sti="+$sti,function(rtn){ $(".otms_div_class").html(rtn); /*setTimeout(function(){ alert($("#otms_paging_area").html()); },1000);*/ }); }
function cs_prod_get($page){ // 천년경영 상품 리스트 가져오기 form_data = $("#cs_product_form").serialize(); $sti = $("#cs_product_form select[name='sti'] option:selected").val(); $stx = $("#cs_product_form input[name='stx']").val(); $.get("ajax.product_map_list_cs3.php?page="+$page+"&stx="+$stx+"&sti="+$sti+form_data,function(rtn){ $(".cs_div_class").html(rtn); }); }
</script> <?php include('./footer.php'); ?>
|