247 lines
7.7 KiB
PHP
247 lines
7.7 KiB
PHP
<?
|
|
include $_SERVER[DOCUMENT_ROOT] . "/backoffice/header.php";
|
|
include $_SERVER[DOCUMENT_ROOT] . "/module/product/product.lib.php";
|
|
include $_SERVER[DOCUMENT_ROOT] . "/module/category/category.lib.php";
|
|
if(!in_array("product_manage",$_SESSION[$_SITE["DOMAIN"]]["ADMIN"]["AUTH"]) && $_SESSION[$_SITE["DOMAIN"]]["ADMIN"]["GRADE"]!="ROOT"):
|
|
jsMsg("권한이 없습니다.");
|
|
jsHistory("-1");
|
|
endif;
|
|
|
|
//DB연결
|
|
$dblink = SetConn($_conf_db["main_db"]);
|
|
|
|
if($_REQUEST[st]=="1"){
|
|
$order_by = " A.sort_num DESC, A.idx DESC ";
|
|
}else{
|
|
$order_by = " A.idx DESC ";
|
|
}
|
|
|
|
//제품 리스트
|
|
$arrList = getProductListBaseNFile(
|
|
mysql_real_escape_string($_REQUEST[cat_no]),
|
|
$order_by,
|
|
mysql_real_escape_string($_REQUEST[sw]),
|
|
mysql_real_escape_string($_REQUEST[sk]),
|
|
$scale, $_REQUEST[offset]);
|
|
|
|
//전체 카테고리 가져오기
|
|
$arrAllCategory = getCategoryAll();
|
|
|
|
//제품분류 리스트
|
|
$arrCategory = getCategoryList(0);//1차카테고리
|
|
|
|
$arrCategoryInfo = getCategoryInfo(mysql_real_escape_string($_REQUEST[cat_no]));
|
|
|
|
//카테고리 정보
|
|
$arrCatCode = explode("/", $arrCategoryInfo["list"][0][cat_code]);
|
|
|
|
//DB해제
|
|
//SetDisConn($dblink);
|
|
?>
|
|
|
|
<script language="javascript">
|
|
function delProduct(idx){
|
|
var cfm;
|
|
cfm =false;
|
|
cfm = confirm("이 제품을 삭제 하시겠습니까?");
|
|
if(cfm==true){
|
|
document.getElementById("idx").value = idx;
|
|
document.frmListHidden.submit();
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<div id="admin-container">
|
|
<? include "menu.php"; ?>
|
|
<div id="admin-content">
|
|
<h2 class="admin-title">제품 관리</h2>
|
|
<h3 class="admin-title-middle">제품검색</h3>
|
|
<form name="frmSort" method="get" action="<?=$_SERVER[DOCUMENT_URI]?>" style="position:relative;">
|
|
<input type="hidden" name="cat_no" id="cat_no">
|
|
<table class="admin-table-type1" summary="제품검색">
|
|
<colgroup>
|
|
<col width="140" />
|
|
<col width="*" />
|
|
</colgroup>
|
|
<tbody>
|
|
<tr>
|
|
<th>분류선택</th>
|
|
<td class="space-left">
|
|
<select name="cat" id="cat" class="first-category depth1" depth="1">
|
|
<option value="">==========1차분류==========</option>
|
|
<?for($i=0;$i<$arrCategory["total"];$i++){?>
|
|
<option value="<?=$arrCategory["list"][$i][cat_no]?>"<?=$arrCatCode[0]==$arrCategory["list"][$i][cat_no]?" selected":""?>><?=$arrCategory["list"][$i][cat_name]?></option>
|
|
<?}?>
|
|
</select>
|
|
<?php
|
|
$dblink = SetConn($_conf_db["main_db"]);
|
|
for($i=2;$i<$_SITE["PRODUCT"]["CATEGORY_DEPTH"]+1;$i++){ //카테고리 $_SITE["PRODUCT"]["CATEGORY_DEPTH"]차까지 만듬 => 1차 초기화는 따로위에서 함
|
|
$_dep = $i-2;
|
|
?>
|
|
<select name="cat<?=$i?>" id="cat<?=$i?>" class="subcategory depth<?=$i?>" depth="<?=$i?>">
|
|
<option value="">==========<?=$i?>차분류==========</option>
|
|
<?php
|
|
if (strlen($arrCatCode[$_dep])) {
|
|
$subCa = getCategoryList($arrCatCode[$_dep]);
|
|
for ($j=0; $j<$subCa['total']; $j++) {
|
|
?>
|
|
<option value="<?php echo $subCa['list'][$j]['cat_no']; ?>" <?=$arrCatCode[$_dep+1]==$subCa['list'][$j]['cat_no']?" selected='selected'":""?>><?php echo $subCa['list'][$j]['cat_name']; ?></option>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
<?
|
|
}
|
|
?>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>정렬</th>
|
|
<td class="space-left">
|
|
<select name="st">
|
|
<option value="0"<?=$_REQUEST[st]=="0"?" selected":""?>>제품번호 역순</option>
|
|
<option value="1"<?=$_REQUEST[st]=="1"?" selected":""?>>정렬번호 역순</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>제품명</th>
|
|
<td class="space-left"><input type="text" name="sk" value="<?=$_REQUEST[sk]?>" class="input" style="width:300px;" /> <input type="image" src="/backoffice/images/btn_search.gif" alt="검색"/></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</form>
|
|
|
|
<br />
|
|
<br />
|
|
|
|
<div class="mgb5"> <strong>전체 : <?=number_format($arrList['total'])?> 개</strong></div>
|
|
<table class="admin-table-type1">
|
|
<thead>
|
|
<tr>
|
|
<th width="50">No.</th>
|
|
<th width="70">사진</th>
|
|
<th width="200">제품분류</th>
|
|
<th width="*">제품명</th>
|
|
<!-- <th width="60">메인표시</th> -->
|
|
<th width="60">정렬번호</th>
|
|
<th width="120">등록일</th>
|
|
<th width="80">관리</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?if($arrList['list']['total'] > 0):?>
|
|
|
|
<?for ($i=0;$i<$arrList['list']['total'];$i++) {
|
|
//카테고리 정보
|
|
$arrThisCatCode = explode("/", $arrList["list"][$i][cat_code]);
|
|
?>
|
|
<tr>
|
|
<td><?=$arrList['list'][$i]['idx']?></td>
|
|
<td>
|
|
<a href="/product/product_detail.php?idx=<?=$arrList['list'][$i]['idx']?>" target="_blank">
|
|
<?if($arrList['list'][$i]['re_name']){?>
|
|
<img src="/uploaded/product/<?=$arrList['list'][$i]['idx']?>/<?=$arrList['list'][$i]['p_image']?$arrList['list'][$i]['p_image']:$arrList['list'][$i]['re_name']?>" width="70">
|
|
<?}?>
|
|
</a>
|
|
</td>
|
|
<td align="left">
|
|
<?for($j=0; $j <count($arrThisCatCode)-1;$j++){?>
|
|
<?=$arrAllCategory[$arrThisCatCode[$j]]?>
|
|
<?=($j < count($arrThisCatCode)-2)?" > ":""?>
|
|
<?}?>
|
|
</td>
|
|
<td class="space-left"><?=$arrList['list'][$i]['p_name']?></td>
|
|
<!-- <td><?=$arrList['list'][$i]['show_main']?></td> -->
|
|
<td><?=$arrList['list'][$i]['sort_num']?></td>
|
|
<td><?=$arrList['list'][$i]['wdate']?></td>
|
|
<td class="b02"><a href="product_info.php?idx=<?=$arrList['list'][$i]['idx']?>&listURL=<?=urlencode($_SERVER[REQUEST_URI])?>"><img src="/backoffice/images/k_modify.gif" alt="수정" /></a> <a href="javascript:delProduct('<?=$arrList['list'][$i]['idx']?>');"><img src="/backoffice/images/k_delete.gif" alt="삭제" /></a></td>
|
|
</tr>
|
|
<?}?>
|
|
|
|
<?else:?>
|
|
<tr height="100" align="center">
|
|
<td colspan="12" >등록된 제품이 없습니다.</td>
|
|
</tr>
|
|
<?endif;?>
|
|
</tbody>
|
|
</table>
|
|
|
|
<div class="paginate">
|
|
<?=pageNavigation($arrList['total'],$scale,$pagescale,$_GET[offset],"cat_no=".$_REQUEST[cat_no]."&sw=".$_REQUEST[sw]."&sk=".$_REQUEST[sk]."&st=".$_REQUEST[st])?>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<form name="frmListHidden" method="post" action="product_evn.php">
|
|
<input type="hidden" name="evnMode" value="delete">
|
|
<input type="hidden" name="idx" id="idx">
|
|
</form>
|
|
|
|
<script language="javascript">
|
|
jQuery(function($) {
|
|
function reset_category(obj) {
|
|
$(obj).empty().append("<option value=\"\">=========="+$(obj).attr("depth")+"차분류==========</option>");
|
|
}
|
|
function category_set(obj) {
|
|
var cat = $(obj).val();
|
|
if (cat.length) {
|
|
$("#cat_no").val(cat);
|
|
$.ajax({
|
|
type:"POST",
|
|
url:"/module/category/ajax.category.php",
|
|
data:{
|
|
cat : cat,
|
|
mode : "getsub"
|
|
},
|
|
datatype:"json",
|
|
success: function(msg){
|
|
//if (!$("#debug").length) $("body").prepend("<div id='debug' style='position:absolute;width:80%;50%;background-color:#fff;left:10%;top:10%;z-index:9999;'></div>");
|
|
//$("#debug").html(msg);
|
|
data = JSON.parse(msg);
|
|
if (data.success) {
|
|
var target, idx;
|
|
idx = parseInt($(obj).attr("depth")) + 1;
|
|
target = ".depth"+idx;
|
|
if ($(target).length) {
|
|
reset_category(target);
|
|
for(var i=0; i<data.calist.length; i++) {
|
|
$(target).append("<option value=\""+data.calist[i].cat_no+"\">"+data.calist[i].cat_name+"</option>");
|
|
}
|
|
}
|
|
}
|
|
},
|
|
error:function(msg){
|
|
alert("로드에러");
|
|
document.reload();
|
|
},
|
|
complete : function(){
|
|
},
|
|
beforeSend : function() {
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
// 초기화
|
|
$(".subcategory").each(function(idx) {
|
|
//reset_category(this);
|
|
$(this).bind("change",function() {
|
|
category_set(this);
|
|
});
|
|
});
|
|
|
|
$("#cat").change(function() {
|
|
category_set(this);
|
|
});
|
|
});
|
|
|
|
</script>
|
|
|
|
<?
|
|
include $_SERVER[DOCUMENT_ROOT] . "/backoffice/footer.php" ;
|
|
?>
|