상품 검색 페이지 검색 결과 관련 문의

상품 검색 페이지 검색 결과 관련 문의

QA

상품 검색 페이지 검색 결과 관련 문의

본문

영카트5 버전 쓰고 있습니다.

search.php 로 접속 했을때 기본적으로 전 상품이 검색되어져 나오는데,

첫 화면에서는 아무것도 안나오게, 즉

검색조건을 주었을 때만 결과를 나오게 하려면 어디를 수정해야 할지 모르겠습니다.

 

 

이 질문에 댓글 쓰기 :

답변 3

search.php 의 다음 코드 부분을 다음과 같이 수정하면 될 듯 합니다.


$sql_where = " where " . implode(" and ", $where);

->


$sql_where = " where " . implode(" and ", $where);
if ($_SERVER['QUERY_STRING'] == "") // 검색 조건을 주지 않은 경우에는
    $sql_where = " where 0 ";

검색시 count($where) 가 1이상 나오는 거을 이용하여 

skin/shop/basic/ 에 shop.skin.php 를 이용하시면 

 

56라인에 

<?php if(count($where)>1){?>
    <!-- 검색된 분류 시작 { -->    
    <div id="ssch_cate">
        <ul>
        <?php
        $total_cnt = 0;
        foreach( $categorys as $row ){
            if( empty($row) ) continue;
            echo "<li><a href=\"#\" onclick=\"set_ca_id('{$row['ca_id']}'); return false;\">{$row['ca_name']} (".$row['cnt'].")</a></li>\n";
            $total_cnt += $row['cnt'];
        }
        echo '<li><a href="#" onclick="set_ca_id(\'\'); return false;">전체분류 <span>('.$total_cnt.')</span></a></li>'.PHP_EOL;
        ?>
        </ul>
    </div>
    <!-- } 검색된 분류 끝 -->
    <?php } ?>

 

리스트 나오는 부분을 if(count($where)>1){  로 둘러싸 주시면 됩니다

 

if(count($where)>1){ 
    
            $list_file = G5_SHOP_SKIN_PATH.'/'.$default['de_search_list_skin'];
            if (file_exists($list_file)) {
                define('G5_SHOP_CSS_URL', G5_SHOP_SKIN_URL);
                $list = new item_list($list_file, $default['de_search_list_mod'], $default['de_search_list_row'], $default['de_search_img_width'], $default['de_search_img_height']);
                $list->set_query(" select * $sql_common $sql_where {$order_by} limit $from_record, $items ");
                $list->set_is_page(true);
                $list->set_view('it_img', true);
                $list->set_view('it_id', true);
                $list->set_view('it_name', true);
                $list->set_view('it_basic', true);
                $list->set_view('it_cust_price', false);
                $list->set_view('it_price', true);
                $list->set_view('it_icon', true);
                $list->set_view('sns', true);
                echo $list->run();
            }
            else
            {
                $i = 0;
                $error = '<p class="sct_nofile">'.$list_file.' 파일을 찾을 수 없습니다.<br>관리자에게 알려주시면 감사하겠습니다.</p>';
            }
        
            if ($i==0)
            {
                echo '<div>'.$error.'</div>';
            }
        }

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

회원로그인

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