shop update - no category register and listing

This commit is contained in:
Amberstone 2024-10-23 13:39:04 +09:00
parent eb273fb310
commit da6ee6a29a
Signed by: amber
GPG key ID: 094B0E55F98D8BF1
6 changed files with 37 additions and 13 deletions

View file

@ -107,21 +107,25 @@ if (empty($fr_date))
<th scope="row">상점 분류</th>
<td colspan="2">
<select name="ca_name">
<option value="">카테고리 선택</option>
<?php for ($i = 0; $i < count($category); $i++) {
<option value="no_category">미분류</option>
<?php
for ($i = 0; $i < count($category); $i++) {
if (!$category[$i])
continue;
?>
<option value="<?= $category[$i] ?>" <?= $shop['ca_name'] == $category[$i] ? "selected" : "" ?>>
<?= $category[$i] ?></option>
<?php } ?>
echo "<option value=\"{$category[$i]}\"";
if ($shop['ca_name'] == $category[$i]) {
echo " selected";
}
echo ">{$category[$i]}</option>";
} ?>
</td>
</tr>
<tr>
<th scope="row">진열 아이템</th>
<td colspan="2">
<input type="hidden" name="it_id" id="it_id" value="<?= $shop['it_id'] ?>" />
<input type="text" name="it_name" value="<?= get_item_name($shop['it_id']) ?>" id="it_name"
<input type="text" name="it_name" value="<?= Item::getName($shop['it_id']) ?>" id="it_name"
onkeyup="get_ajax_item(this, 'item_list', 'it_id');" />
<div id="item_list" class="ajax-list-box">
<div class="list"></div>

View file

@ -38,6 +38,7 @@ include_once './_common.php';
if ($w == 'u')
check_demo();
auth_check($auth[$sub_menu], 'w');
check_token();
@ -52,11 +53,13 @@ if (isset($sh_side) && is_array($sh_side) && count($sh_side)) {
$sh_side = implode("||", $sh_side);
$sh_side = "||" . $sh_side . "||";
}
// 종족 제한 설정 저장
if (isset($sh_class) && is_array($sh_class) && count($sh_class)) {
$sh_class = implode("||", $sh_class);
$sh_class = "||" . $sh_class . "||";
}
// 랭킹 제한 설정 저장
if (isset($sh_rank) && is_array($sh_rank) && count($sh_rank)) {
$sh_rank = implode("||", $sh_rank);
@ -80,11 +83,11 @@ if (!$sh_has_item && $sh_has_item_name) {
alert("교환 아이템으로 등록되는 아이템의 정보가 없습니다.");
}
}
if (!$sh_has_item_name) {
$sh_has_item = 0;
}
// 교환 타이틀 유효성 여부 체크
if (!$sh_has_title && $sh_has_title_name) {
$has_title = sql_fetch("select ti_id from {$g5['item_table']} where ti_title = '{$sh_has_title_name}'");
@ -93,10 +96,15 @@ if (!$sh_has_title && $sh_has_title_name) {
alert("교환 타이틀로 등록되는 타이틀의 정보가 없습니다.");
}
}
if (!$sh_has_title_name) {
$sh_has_title = 0;
}
if ($ca_name == "no_category") {
$ca_name = "";
}
$sql_common = "
it_id = '{$it_id}',
ca_name = '{$ca_name}',

View file

@ -148,8 +148,9 @@ $colspan = 19;
</td>
<td style="width:100px;">
<select name="ca_name[<?php echo $i ?>]" style="width:100%;">
<option value="">카테고리</option>
<?php for ($k = 0; $k < count($category); $k++) {
<option value="no_category">미분류</option>
<?php
for ($k = 0; $k < count($category); $k++) {
if (!$category[$k])
continue;
?>

View file

@ -12,9 +12,14 @@ if ($_POST['act_button'] == "선택수정") {
for ($i=0; $i<count($_POST['chk']); $i++) {
// 실제 번호를 넘김
$k = $_POST['chk'][$i];
$cate_name = $_POST['ca_name'][$k];
if ($cate_name == "no_category") {
$cate_name = "";
}
$sql = "UPDATE {$g5['shop_table']} SET
ca_name = '{$_POST['ca_name'][$k]}',
ca_name = '{$cate_name}',
sh_money = '{$_POST['sh_money'][$k]}',
sh_use_money = '{$_POST['sh_use_money'][$k]}',
sh_exp = '{$_POST['sh_exp'][$k]}',

View file

@ -68,7 +68,7 @@ class Item extends Module
}
}
return [];
return "";
}
public static function getInventoryItem($inventory_id)

View file

@ -5,12 +5,18 @@ include_once './_head.php';
$shop_cate = explode("||", $config['cf_shop_category']);
if (isset($shop_cate)) {
$shop_cate = array_merge(["전체"], $shop_cate);
} else {
$shop_cate = [];
}
if (!$cate) {
$cate = $shop_cate[0];
}
$sql_common = " from {$g5['shop_table']} ";
$sql_search = " where sh_use = '1' and ca_name = '{$cate}' ";
$sql_search = " where sh_use = '1'" . ($cate !== "전체" ? " and ca_name = '{$cate}'" : "");
$sql_order = " order by sh_order asc ";
$sql_limit = "";