관련상품 검색기능 추가 - 참없다님 제안

This commit is contained in:
chicpro
2014-04-14 16:17:13 +09:00
parent 1d85abb4c4
commit 84bf242dd3
3 changed files with 25 additions and 9 deletions

View File

@ -700,6 +700,7 @@ strong.sodr_nonpay {display:block;padding:5px 0;text-align:right}
.srel .srel_noneimg li {padding:7px 0} .srel .srel_noneimg li {padding:7px 0}
.srel .srel_noneimg button {top:0;right:0} .srel .srel_noneimg button {top:0;right:0}
.srel .srel_pad {display:block;height:30px} .srel .srel_pad {display:block;height:30px}
.srel .srel_pad button {position:static}
/* 쿠폰관리 */ /* 쿠폰관리 */
.scp_new_win .empty_table {padding:30px 0} .scp_new_win .empty_table {padding:30px 0}

View File

@ -1335,24 +1335,28 @@ $(function(){
} }
?> ?>
</select> </select>
<label for="sch_name" class="sound_only">상품명</label>
<input type="text" name="sch_name" id="sch_name" class="frm_input" size="15">
<button type="button" id="btn_search_item" class="btn_frmline">검색</button>
</span> </span>
<div id="relation" class="srel_list"> <div id="relation" class="srel_list">
<p>상품 검색을 위해 상품의 분류를 선택해주십시오.</p> <p>상품의 분류를 선택하시거나 상품명을 입력하신 후 검색하여 주십시오.</p>
</div> </div>
<script> <script>
$(function() { $(function() {
$("#sch_relation").change(function() { $("#btn_search_item").click(function() {
var ca_id = $(this).val(); var ca_id = $("#sch_relation").val();
var it_name = $.trim($("#sch_name").val());
var $relation = $("#relation"); var $relation = $("#relation");
if(ca_id == "") { if(ca_id == "" && it_name == "") {
$relation.html("<p>상품 검색을 위해 상품의 분류를 선택해주십시오.</p>"); $relation.html("<p>상품의 분류를 선택하시거나 상품명을 입력하신 후 검색하여 주십시오.</p>");
return false; return false;
} }
$("#relation").load( $("#relation").load(
"./itemformrelation.php", "./itemformrelation.php",
{ it_id: "<?php echo $it_id; ?>", ca_id: ca_id } { it_id: "<?php echo $it_id; ?>", ca_id: ca_id, it_name: it_name }
); );
}); });

View File

@ -2,11 +2,22 @@
$sub_menu = '400300'; $sub_menu = '400300';
include_once('./_common.php'); include_once('./_common.php');
$ca_id = trim($ca_id);
$it_name = trim(stripslashes($it_name));
if(!$ca_id && !$it_name)
die('<p>상품의 분류를 선택하시거나 상품명을 입력하신 후 검색하여 주십시오.</p>');
$sql = " select ca_id, it_id, it_name, it_price $sql = " select ca_id, it_id, it_name, it_price
from {$g5['g5_shop_item_table']} from {$g5['g5_shop_item_table']}
where it_id <> '$it_id' where it_id <> '$it_id' ";
and ( ca_id like '$ca_id%' or ca_id2 like '$ca_id%' or ca_id3 like '$ca_id%' ) if($ca_id)
order by ca_id, it_name "; $sql .= " and ( ca_id like '$ca_id%' or ca_id2 like '$ca_id%' or ca_id3 like '$ca_id%' ) ";
if($it_name)
$sql .= " and it_name like '%$it_name%' ";
$sql .= " order by ca_id, it_name ";
$result = sql_query($sql); $result = sql_query($sql);
$list = ''; $list = '';