테스트 사이트 - 개발 중인 베타 버전입니다

영카트 셀렉트 박스 검색 채택완료

kooky 3년 전 조회 1,572

안녕하세요 !

 

영카트로 페이지 제작중인데

 

셀렉트 박스로 물품 검색을 하려고 하는데

 

선택한 값은 넘어오는것 같은데

 

검색이 안나옵니다

 

list 부분을 수정해야하는건가요?

댓글을 작성하려면 로그인이 필요합니다.

답변 3개

채택된 답변
+20 포인트

여러 가지 방법이있지만

새로운 검색 페이지 를 만든다면 

search.php 안에 소스를 확인 해 보시는 것을 추천합니다

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

k
kooky
3년 전
$sql_common = " from {$g5['g5_shop_item_table']} a, {$g5['g5_shop_category_table']} b ";

$where = array();
$where[] = " (a.ca_id = b.ca_id and a.it_use = 1 and b.ca_use = 1) ";

$search_all = true;
// 상세검색 이라면
if (isset($_GET['qname']) || isset($_GET['qexplan']) || isset($_GET['qid']) || isset($_GET['qbasic']) || isset($_GET['qmaker']) || isset($_GET['qmodel']))
$search_all = false;

$q = utf8_strcut(get_search_string(trim($_GET['q'])), 30, "");
$qname = isset($_GET['qname']) ? trim($_GET['qname']) : '';
$qexplan = isset($_GET['qexplan']) ? trim($_GET['qexplan']) : '';
$qid = isset($_GET['qid']) ? trim($_GET['qid']) : '';
$qbasic = isset($_GET['qbasic']) ? trim($_GET['qbasic']) : '';
$qmaker = isset($_GET['qmaker']) ? trim($_GET['qmaker']) : '';
$qmodel = isset($_GET['qmodel']) ? trim($_GET['qmodel']) : '';
$qcaid = isset($_GET['qcaid']) ? preg_replace('#[^a-z0-9]#i', '', trim($_GET['qcaid'])) : '';
$qfrom = isset($_GET['qfrom']) ? preg_replace('/[^0-9]/', '', trim($_GET['qfrom'])) : '';
$qto = isset($_GET['qto']) ? preg_replace('/[^0-9]/', '', trim($_GET['qto'])) : '';
if (isset($_GET['qsort'])) {
$qsort = trim($_GET['qsort']);
$qsort = preg_replace("/[\<\>\'\"\\\'\\\"\%\=\(\)\s]/", "", $qsort);
} else {
$qsort = '';
}
if (isset($_GET['qorder'])) {
$qorder = preg_match("/^(asc|desc)$/i", $qorder) ? $qorder : '';
} else {
$qorder = '';
}

if(!($qname))
$search_all = true;

// 검색범위 checkbox 처리
$qname_check = false;
$qexplan_check = false;
$qid_check = false;
$qbasic_check = false;
$qmaker_check = false;
$qmodel_check = false;

if($search_all) {
$qname_check = true;
$qexplan_check = true;
$qid_check = true;
$qbasic_check = true;
$qmaker_check = true;
$qmodel_check = true;
} else {
if($qname)
$qname_check = true;
if($qexplan)
$qexplan_check = true;
if($qid)
$qid_check = true;
if($qbasic)
$qbasic_check = true;
if($qmaker)
$qmaker_check = true;
if($qmodel)
$qmodel_check = true;
}

if ($q) {
$arr = explode(" ", $q);
$detail_where = array();
for ($i=0; $i<count($arr); $i++) {
$word = trim($arr[$i]);
if (!$word) continue;

$concat = array();
if ($search_all || $qname)
$concat[] = "a.it_name";
if ($search_all || $qexplan)
$concat[] = "a.it_explan2";
if ($search_all || $qid)
$concat[] = "a.it_id";
if ($search_all || $qmaker)
$concat[] = "a.it_maker";
if ($search_all || $qmodel)
$concat[] = "a.it_model";
$concat_fields = "concat(".implode(",' ',",$concat).")";

$detail_where[] = $concat_fields." like '%$word%' ";

search.php 부분에 새로 it_maker, it_model, it_name 추가해주었는데 여전히 안나오는데
sql 부분도 수정해줘야 하나요?

댓글을 작성하려면 로그인이 필요합니다.

https://sir.kr/developers_pr/13" rel="nofollow noreferrer noopener" target="_blank">https://sir.kr/developers_pr/13

저의 연락처가 있습니다 전화 주시면 설명해 드릴게요.

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

검색 폼을 어떻게 만드셨나요?

sfl, stx 등이요.

로그인 후 평가할 수 있습니다

답변에 대한 댓글 2개

k
kooky
3년 전
<form name="frmsearch1" action="<?php echo G5_SHOP_URL; ?>/search.php">
<input type="hidden" name="sfl" value="it_maker||it_model||it_name">
<input type="hidden" name="sop" value="and">

<select id='it_maker' name='q' onchange='categoryChange(this)' >
<option value="">선택하세요</option>
<option value='APPLE'<?php if($q == "APPLE")echo "selected";?>>APPLE</option>
<option value='SAMSUNG'<?if($q == "SAMSUNG")echo "selected";?>>SAMSUNG</option>
<option value='LG'<?if($q == "LG")echo "selected";?>>LG</option>
<option value='삼성 태블릿'<?if($q == "삼성 태블릿")echo "selected";?>>삼성 태블릿</option>
<option value='아이패드'<?if($q == "아이패드")echo "selected";?>>아이패드</option>
<option value='갤럭시 워치'<?if($q == "갤럭시 워치")echo "selected";?>>갤럭시 워치</option>
<option value='애플 워치'<?if($q == "애플 워치")echo "selected";?>>애플 워치</option>
</select>


<select id='it_model' name='q1' onchange='seriesChange(this)'>
<option value="">선택하세요</option>

</select>

<select id='it_name' name='q2' onchange="this.form.submit();">
<option value="">선택하세요</option>
</select>
</form>

이곳에서 선택하도록 했습니다!
k
kooky
3년 전
지금 q에서 선택한 apple 에 속한 제품들이 모두 검색되어 나옵니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인