상품요약정보 관련 파일 및 코드 추가

This commit is contained in:
chicpro
2013-01-30 13:43:31 +09:00
parent 26ce8cbbb7
commit 21659c5935
5 changed files with 760 additions and 0 deletions

View File

@ -2,6 +2,7 @@
$sub_menu = "400300";
include_once("./_common.php");
include_once(G4_CKEDITOR_PATH.'/ckeditor.lib.php');
include_once(G4_LIB_PATH.'/iteminfo.lib.php');
auth_check($auth[$sub_menu], "w");
@ -304,6 +305,27 @@ ul { margin: 0; padding: 0; list-style: none; }
<?=help("상품상세페이지의 상품설명 상단에 표시되는 설명입니다.\nHTML 입력도 가능합니다.", -150, -100);?>
</td>
</tr>
<? if ($it['it_id']) { ?>
<?
$sql = " select distinct ii_gubun from {$g4['yc4_item_info_table']} where it_id = '$it_id' group by ii_gubun ";
$ii = sql_fetch($sql, false);
if ($ii) {
$item_info_gubun = item_info_gubun($ii['ii_gubun']);
$item_info_gubun .= $item_info_gubun ? " 등록됨" : "";
} else {
// 상품상세정보 테이블이 없다고 가정하여 생성
create_table_item_info();
}
?>
<tr class=ht>
<td>요약상품정보</td>
<td colspan=3>
<input type="button" onclick="window.open('./iteminfo.php?it_id=<?=$it['it_id']?>', '_blank', 'width=670 height=800');" value="상품요약정보 설정" />
<span id="item_info_gubun"><?=$item_info_gubun?></span>
<?=help("전자상거래 등에서의 상품 등의 정보제공에 관한 고시에 따라 총 35개 상품군에 대해 상품 특성 등을 양식에 따라 입력할 수 있습니다.");?>
</td>
</tr>
<?}//if?>
<input type=hidden name=it_explan_html value=1>
<tr>
<td>상품설명</td>

116
adm/shop_admin/iteminfo.php Normal file
View File

@ -0,0 +1,116 @@
<?
include_once("./_common.php");
include_once(G4_LIB_PATH.'/iteminfo.lib.php');
include_once(G4_PATH.'/head.sub.php');
$it_id = trim($_GET['it_id']);
if ($_GET['gubun']) {
$gubun = $_GET['gubun'];
} else {
$sql = " select ii_gubun from {$g4['yc4_item_info_table']} where it_id = '$it_id' group by ii_gubun ";
$row = sql_fetch($sql);
$gubun = $row['ii_gubun'] ? $row['ii_gubun'] : "wear";
}
$null_text = "상품페이지 참고";
?>
<style>
.confirm {text-align:center}
.confirm input {padding:3px}
</style>
<form id="fiteminfo" method="post" action="#" onsubmit="return fiteminfo_submit(this)">
<input type="hidden" name="it_id" value="<?=$it_id?>">
<div style="width:95%;padding:10px">
<div style="float:left;"><?=subtitle("요약상품정보")?></div>
<div style="float:right;">(모든필드 필수입력)</div>
<table width=100% cellpadding=0 cellspacing=0 border=0>
<colgroup width=15%></colgroup>
<colgroup width=85% bgcolor=#FFFFFF></colgroup>
<tbody>
<tr><td colspan=2 height=2 bgcolor=0E87F9></td></tr>
<tr><td colspan=2 height=5></td></tr>
<tr class=ht>
<td style='padding:3px;' valign='top' width='25%'><b>상품군</b></td>
<td style='padding:3px;' valign='top'>
<div style="float:left;">
<select id="gubun" name="gubun" onchange="location.href='?it_id=<?=$it_id?>&amp;gubun='+this.value;">
<option value="">상품군을 선택하세요.</option>
<?
foreach($item_info as $key=>$value) {
$opt_value = $key;
$opt_text = $value['title'];
echo "<option value='$opt_value'>$opt_text</option>\n";
}
?>
</select>
<script>document.getElementById("gubun").value="<?=$gubun?>";</script>
</div>
<div style="float:right;"><label><input type="checkbox" id="null" />비어있는 필드를 "<?=$null_text?>"로 채우기</label></div>
</td>
</tr>
<?
$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['yc4_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'];
echo "<tr class='ht'>\n";
echo "<td style='padding:3px;' valign='top'><b>$el_title</b></td>\n";
echo "<td style='padding:3px;' valign='top'>";
echo "<input type='hidden' name='{$el_name}[]' value='$el_title' />";
echo "<input type='text' name='{$el_name}[]' value='$el_value' class='ed' style='width:99%;' required itemname='$el_title' />";
if ($el_example != "") {
echo "<p style=\"margin:2px 0;padding:0\">$el_example</p>";
}
echo "</td>\n";
echo "</tr>\n";
}
}
?>
</tbody>
</table>
<p class="confirm">
<input type="submit" value="입력">
<input type="button" value="창닫기" onclick="javascript:window.close()">
</p>
</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("<?=$null_text?>");
}
});
} else {
$.each($f, function(){
if ($(this).val() == "<?=$null_text?>") {
$(this).val("");
}
});
}
});
});
function fiteminfo_submit(f)
{
f.action = "./iteminfoupdate.php";
return true;
}
</script>
<?
include_once(G4_PATH.'/tail.sub.php');
?>

View File

@ -0,0 +1,36 @@
<?
include_once("./_common.php");
include_once(G4_LIB_PATH.'/iteminfo.lib.php');
// 기존의 상품요약정보를 삭제하고 다시 만든다.
sql_query(" delete from {$g4['yc4_item_info_table']} where it_id = '{$_POST['it_id']}' ");
$gubun = "";
foreach ($_POST as $key=>$value) {
if ($key == "it_id") continue;
if ($key == "gubun") {
$gubun = $value;
continue;
}
$sql = " insert {$g4['yc4_item_info_table']}
set it_id = '{$_POST['it_id']}',
ii_gubun = '$gubun',
ii_article = '$key',
ii_title = '$value[0]',
ii_value = '$value[1]' ";
sql_query($sql);
}
$item_info_gubun = item_info_gubun($gubun);
$item_info_gubun .= $item_info_gubun ? " 등록됨" : "";
include_once(G4_PATH.'/head.sub.php');
?>
<script type="text/javascript">
opener.document.getElementById("item_info_gubun").innerHTML = "<?=$item_info_gubun?>";
window.close();
</script>
<?
include_once(G4_PATH.'/tail.sub.php');
?>