영카트 셀렉트 박스 검색

영카트 셀렉트 박스 검색

QA

영카트 셀렉트 박스 검색

본문

안녕하세요 !

 

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

 

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

 

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

 

검색이 안나옵니다

 

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

이 질문에 댓글 쓰기 :

답변 3

여러 가지 방법이있지만

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

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

$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 부분도 수정해줘야 하나요?

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

sfl, stx 등이요.

<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>

이곳에서 선택하도록 했습니다!

답변을 작성하시기 전에 로그인 해주세요.
전체 123,157 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT