#179 에 따른 상품요약정보 상품등록폼에 통합

This commit is contained in:
chicpro
2013-05-15 13:37:55 +09:00
parent 7ac8856147
commit 6bb536dc38
7 changed files with 121 additions and 212 deletions

View File

@ -2,123 +2,67 @@
include_once('./_common.php');
include_once(G4_LIB_PATH.'/iteminfo.lib.php');
$it_id = trim($_GET['it_id']);
if ($_GET['gubun']) {
$gubun = $_GET['gubun'];
} else {
$sql = " select ii_gubun from {$g4['shop_item_info_table']} where it_id = '$it_id' group by ii_gubun ";
$row = sql_fetch($sql);
$gubun = $row['ii_gubun'] ? $row['ii_gubun'] : "wear";
}
$it_id = trim($_POST['it_id']);
$gubun = $_POST['gubun'] ? $_POST['gubun'] : 'wear';
if($it['it_id'])
$it_id = $it['it_id'];
$null_text = "상품페이지 참고";
$sql = " select it_id, it_info_gubun, it_info_value from {$g4['shop_item_table']} where it_id = '$it_id' ";
$it = sql_fetch($sql);
$g4['title'] = "상품요약정보 설정";
if($gubun)
$g4['title'] .= ' : '.$item_info[$gubun]['title'];
include_once(G4_PATH.'/head.sub.php');
if(!$_POST['gubun'] && $it['it_info_gubun'])
$gubun = $it['it_info_gubun'];
?>
<form id="fiteminfo" method="post" action="#" onsubmit="return fiteminfo_submit(this)">
<input type="hidden" name="it_id" value="<?php echo $it_id; ?>">
<div class="cbox">
<h1><?php echo $g4['title']; ?></h1>
<p>모든 필드를 반드시 입력하셔야 합니다.</p>
<table class="frm_tbl">
<colgroup>
<col class="grid_3">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="gubun">상품군</label></th>
<td>
<?php echo help("상품군을 선택하면 자동으로 페이지가 전환됩니다."); ?>
<select id="gubun" name="gubun" onchange="location.href='?it_id=<?php echo $it_id; ?>&amp;gubun='+this.value;">
<option value="">상품군을 선택하세요.</option>
<?php
foreach($item_info as $key=>$value) {
$opt_value = $key;
$opt_text = $value['title'];
echo '<option value="'.$opt_value.'" '.get_selected($gubun, $opt_value).'>'.$opt_text.'</option>'.PHP_EOL;
}
?>
</select>
</td>
</tr>
<?php
$article = $item_info[$gubun]['article'];
if ($article) {
foreach($article as $key=>$value) {
$el_name = $key;
$el_title = $value[0];
$el_example = $value[1];
$sql = " select ii_value from {$g4['shop_item_info_table']} where it_id = '$it_id' and ii_gubun = '$gubun' and ii_article = '$key' ";
$row = sql_fetch($sql);
if ($row['ii_value']) $el_value = $row['ii_value'];
?>
<tr>
<th scope="row"><label for="<?php echo $el_name.$i?>"><?php echo $el_title; ?></label></th>
<td>
<input type="hidden" name="<?php echo $el_name; ?>[]" value="<?php echo $el_title; ?>">
<?php if ($el_example != "") echo help($el_example); ?>
<input type="text" name="<?php echo $el_name; ?>[]" value="<?php echo $el_value; ?>" id="<?php echo $el_name.$i; ?>" required class="frm_input required" />
</td>
</tr>
<?php
}
}
?>
<tr>
<th>빈 칸 일괄채우기</th>
<td>
<?php echo help("상품페이지에 상품요약정보가 포함되어 있어 생략 가능한 경우 선택하십시오."); ?>
<label for="null">비어있는 칸을 &quot;<?php echo $null_text; ?>&quot;로 채우기</label>
<input type="checkbox" id="null">
</td>
</tr>
</tbody>
</table>
<div class="btn_confirm">
<input type="submit" value="입력" class="btn_submit">
<button type="button" onclick="javascript:window.close()">창닫기</button>
</div>
</div>
</form>
<script>
$(function(){
$("#null").click(function(){
var $f = $("#fiteminfo input[type=text], #fiteminfo textarea");
if (this.checked) {
$.each($f, function(){
if ($(this).val() == "") {
$(this).val("<?php echo $null_text; ?>");
}
});
} else {
$.each($f, function(){
if ($(this).val() == "<?php echo $null_text; ?>") {
$(this).val("");
}
});
}
});
});
function fiteminfo_submit(f)
{
f.action = "./iteminfoupdate.php";
return true;
}
</script>
<p><strong>전자상거래 등에서의 상품 등의 정보제공에 관한 고시</strong>에 따라 총 35개 상품군에 대해 상품 특성 등을 양식에 따라 입력할 수 있습니다.</p>
<table class="frm_tbl">
<colgroup>
<col class="grid_3">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="it_info_gubun">상품군</label></th>
<td>
<?php echo help("상품군을 선택하면 자동으로 항목이 변환됩니다."); ?>
<select id="it_info_gubun" name="it_info_gubun">
<option value="">상품군을 선택하세요.</option>
<?php
foreach($item_info as $key=>$value) {
$opt_value = $key;
$opt_text = $value['title'];
echo '<option value="'.$opt_value.'" '.get_selected($gubun, $opt_value).'>'.$opt_text.'</option>'.PHP_EOL;
}
?>
</select>
</td>
</tr>
<?php
include_once(G4_PATH.'/tail.sub.php');
?>
if($it['it_info_value'])
$info_value = unserialize($it['it_info_value']);
$article = $item_info[$gubun]['article'];
if ($article) {
foreach($article as $key=>$value) {
$el_name = $key;
$el_title = $value[0];
$el_example = $value[1];
$el_value = '상품페이지 참고';
if($gubun == $it['it_info_gubun'] && $info_value[$key])
$el_value = $info_value[$key];
?>
<tr>
<th scope="row"><label for="ii_article_<?php echo $el_name; ?>"><?php echo $el_title; ?></label></th>
<td>
<input type="hidden" name="ii_article[]" value="<?php echo $el_name; ?>">
<?php if ($el_example != "") echo help($el_example); ?>
<input type="text" name="ii_value[]" value="<?php echo $el_value; ?>" id="ii_article_<?php echo $el_name; ?>" required class="frm_input required" />
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>