#176 상품추가옵션 작업 중
This commit is contained in:
@ -347,8 +347,8 @@ $pg_anchor ='<ul class="anchor">
|
|||||||
<table class="frm_tbl">
|
<table class="frm_tbl">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th>옵션명</th>
|
<th>선택옵션명</th>
|
||||||
<th>옵션항목(,로 구분)</th>
|
<th colspan="2">선택옵션항목(,로 구분)</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><input type="text" id="opt1_subject" name="opt1_subject" value="<?php echo $opt_subject[0]; ?>" class="frm_input" size="15" /></td>
|
<td><input type="text" id="opt1_subject" name="opt1_subject" value="<?php echo $opt_subject[0]; ?>" class="frm_input" size="15" /></td>
|
||||||
@ -398,6 +398,9 @@ $pg_anchor ='<ul class="anchor">
|
|||||||
$("input[name=opt1]").val(arr_opt1.join());
|
$("input[name=opt1]").val(arr_opt1.join());
|
||||||
$("input[name=opt2]").val(arr_opt2.join());
|
$("input[name=opt2]").val(arr_opt2.join());
|
||||||
$("input[name=opt3]").val(arr_opt3.join());
|
$("input[name=opt3]").val(arr_opt3.join());
|
||||||
|
|
||||||
|
if($("#option_table").height() > 500)
|
||||||
|
$("#option_table").addClass("a");
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
// 옵션목록생성
|
// 옵션목록생성
|
||||||
$("#option_table_create").click(function() {
|
$("#option_table_create").click(function() {
|
||||||
@ -461,6 +464,90 @@ $pg_anchor ='<ul class="anchor">
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">상품추가옵션</th>
|
||||||
|
<td colspan="2">
|
||||||
|
<table class="frm_tbl">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th>추가옵션명</th>
|
||||||
|
<th colspan="2">추가옵션항목(,로 구분)</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><input type="text" name="spl_subject[]" value="" class="frm_input" size="15"></td>
|
||||||
|
<td><input type="text" name="spl[]" value="" class="frm_input" size="50"></td>
|
||||||
|
<td><button type="button" id="supply_table_create">옵션목록생성</button></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3"><button type="button" id="add_supply_row">입력필드추가</button></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div id="supply_table"><?php include_once(G4_ADMIN_PATH.'/shop_admin/itemsupply.php'); ?></div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
// 입력필드추가
|
||||||
|
$("#add_supply_row").click(function() {
|
||||||
|
var $el = $(this).closest("tr");
|
||||||
|
var fld = "<tr><td><input type=\"text\" name=\"spl_subject[]\" value=\"\" class=\"frm_input\" size=\"15\"></td>";
|
||||||
|
fld += "<td><input type=\"text\" name=\"spl[]\" value=\"\" class=\"frm_input\" size=\"50\">";
|
||||||
|
fld += "<button type=\"button\" id=\"del_supply_row\">삭제</button></td></tr>";
|
||||||
|
|
||||||
|
$el.before(fld);
|
||||||
|
|
||||||
|
var rowspan = $("input[name='spl[]']").size();
|
||||||
|
$("#supply_table_create").parent().attr("rowspan", rowspan);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 입력필드삭제
|
||||||
|
$("#del_supply_row").live("click", function() {
|
||||||
|
$(this).closest("tr").remove();
|
||||||
|
var rowspan = $("input[name='spl[]']").size();
|
||||||
|
$("#supply_table_create").parent().attr("rowspan", rowspan);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 옵션목록생성
|
||||||
|
$("#supply_table_create").click(function() {
|
||||||
|
var subject = new Array();
|
||||||
|
var supply = new Array();
|
||||||
|
var subj, spl;
|
||||||
|
var count = 0;
|
||||||
|
var $el_subj = $("input[name='spl_subject[]']");
|
||||||
|
var $el_spl = $("input[name='spl[]']");
|
||||||
|
var $supply_table = $("#supply_table");
|
||||||
|
|
||||||
|
$el_subj.each(function(index) {
|
||||||
|
subj = $.trim($(this).val());
|
||||||
|
spl = $.trim($el_spl.eq(index).val());
|
||||||
|
|
||||||
|
if(subj && spl) {
|
||||||
|
subject.push(subj);
|
||||||
|
supply.push(spl);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(!count) {
|
||||||
|
alert("추가옵션명과 추가옵션항목을 입력해 주십시오.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.post(
|
||||||
|
"<?php echo G4_ADMIN_URL; ?>/shop_admin/itemsupply.php",
|
||||||
|
{ 'subject[]': subject, 'supply[]': supply },
|
||||||
|
function(data) {
|
||||||
|
$supply_table.removeClass("b");
|
||||||
|
$supply_table.empty().html(data);
|
||||||
|
if($supply_table.height() > 500) {
|
||||||
|
$supply_table.addClass("b");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><label for="it_basic">기본설명</label></th>
|
<th scope="row"><label for="it_basic">기본설명</label></th>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
111
adm/shop_admin/itemsupply.php
Normal file
111
adm/shop_admin/itemsupply.php
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
<?php
|
||||||
|
include_once('./_common.php');
|
||||||
|
|
||||||
|
$ps_run = false;
|
||||||
|
|
||||||
|
if($it['it_id']) {
|
||||||
|
$sql = " select * from {$g4['shop_item_option_table']} where io_type = '1' and it_id = '{$it['it_id']}' order by io_no asc ";
|
||||||
|
$result = sql_query($sql);
|
||||||
|
if(mysql_num_rows($result))
|
||||||
|
$ps_run = true;
|
||||||
|
} else if(!empty($_POST)) {
|
||||||
|
$ps_run = true;
|
||||||
|
$subject_count = count($_POST['subject']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($ps_run) {
|
||||||
|
?>
|
||||||
|
|
||||||
|
<table class="frm_tbl">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td><input type="checkbox" name="spl_chk_all" value="1"></td>
|
||||||
|
<td>옵션명</td>
|
||||||
|
<td>옵션항목</td>
|
||||||
|
<td>추가금액</td>
|
||||||
|
<td>재고수량</td>
|
||||||
|
<td>통보수량</td>
|
||||||
|
<td>사용여부</td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
if($it['it_id']) {
|
||||||
|
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||||
|
$spl_id = $row['io_id'];
|
||||||
|
$spl_val = explode(chr(30), $spl_id);
|
||||||
|
$spl_subject = $spl_val[0];
|
||||||
|
$spl = $spl_val[1];
|
||||||
|
$spl_price = $row['io_price'];
|
||||||
|
$spl_stock_qty = $row['io_stock_qty'];
|
||||||
|
$spl_noti_qty = $row['io_noti_qty'];
|
||||||
|
$spl_use = $row['io_use'];
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<input type="hidden" name="spl_id[]" value="<?php echo $spl_id; ?>">
|
||||||
|
<td><input type="checkbox" name="spl_chk[]" value="1"></td>
|
||||||
|
<td><?php echo $spl_subject; ?></td>
|
||||||
|
<td><?php echo $spl; ?></td>
|
||||||
|
<td><input type="text" name="spl_price[]" value="<?php echo $spl_price; ?>" class="frm_input" size="5"></td>
|
||||||
|
<td><input type="text" name="spl_stock_qty[]" value="<?php echo $spl_stock_qty; ?>" class="frm_input" size="5"></td>
|
||||||
|
<td><input type="text" name="spl_noti_qty[]" value="<?php echo $spl_noti_qty; ?>" class="frm_input" size="5"></td>
|
||||||
|
<td>
|
||||||
|
<select name="spl_use[]">
|
||||||
|
<option value="1" <?php echo get_selected('1', $spl_use); ?>>사용함</option>
|
||||||
|
<option value="0" <?php echo get_selected('0', $spl_use); ?>>사용안함</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
} // for
|
||||||
|
} else {
|
||||||
|
for($i=0; $i<$subject_count; $i++) {
|
||||||
|
$spl_subject = trim($_POST['subject'][$i]);
|
||||||
|
$spl_val = explode(',', trim($_POST['supply'][$i]));
|
||||||
|
$spl_count = count($spl_val);
|
||||||
|
|
||||||
|
for($j=0; $j<$spl_count; $j++) {
|
||||||
|
$spl = trim($spl_val[$j]);
|
||||||
|
if($spl_subject && $spl) {
|
||||||
|
$spl_id = $spl_subject.chr(30).$spl;
|
||||||
|
$spl_price = 0;
|
||||||
|
$spl_stock_qty = 0;
|
||||||
|
$spl_noti_qty = 0;
|
||||||
|
$spl_use = 1;
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<input type="hidden" name="spl_id[]" value="<?php echo $spl_id; ?>">
|
||||||
|
<td><input type="checkbox" name="spl_chk[]" value="1"></td>
|
||||||
|
<td><?php echo $spl_subject; ?></td>
|
||||||
|
<td><?php echo $spl; ?></td>
|
||||||
|
<td><input type="text" name="spl_price[]" value="<?php echo $spl_price; ?>" class="frm_input" size="5"></td>
|
||||||
|
<td><input type="text" name="spl_stock_qty[]" value="<?php echo $spl_stock_qty; ?>" class="frm_input" size="5"></td>
|
||||||
|
<td><input type="text" name="spl_noti_qty[]" value="<?php echo $spl_noti_qty; ?>" class="frm_input" size="5"></td>
|
||||||
|
<td>
|
||||||
|
<select name="spl_use[]">
|
||||||
|
<option value="1" <?php echo get_selected('1', $spl_use); ?>>사용함</option>
|
||||||
|
<option value="0" <?php echo get_selected('0', $spl_use); ?>>사용안함</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
} // if
|
||||||
|
} // for
|
||||||
|
} // for
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div><button type="button" id="sel_supply_delete">선택삭제</button></div>
|
||||||
|
<div>
|
||||||
|
<label for="spl_com_price">추가금액</label><input type="text" name="spl_com_price" value="0" id="spl_com_price" class="frm_input" size="5">
|
||||||
|
<label for="spl_com_stock">재고수량</label><input type="text" name="spl_com_stock" value="0" id="spl_com_stock" class="frm_input" size="5">
|
||||||
|
<label for="spl_com_noti">통보수량</label><input type="text" name="spl_com_noti" value="0" id="spl_com_noti" class="frm_input" size="5">
|
||||||
|
<label for="spl_com_use">사용여부</label>
|
||||||
|
<select name="spl_com_use" id="spl_com_use">
|
||||||
|
<option value="1">사용함</option>
|
||||||
|
<option value="0">사용안함</option>
|
||||||
|
</select>
|
||||||
|
<button type="button" id="spl_value_apply">일괄적용</button>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user