최신상품, 히트상품 등 listtype.php 내에서 카테고리 별 출력하는 방법?

최신상품, 히트상품 등 listtype.php 내에서 카테고리 별 출력하는 방법?

QA

최신상품, 히트상품 등 listtype.php 내에서 카테고리 별 출력하는 방법?

본문

3660691556_1599441934.709.png

 

위의 캡쳐본과 같이 최신상품 내에서 쇼핑몰 카테고리를 불러와서 출력하고

카테고리를 클릭하면 최신상품 내 해당 카테고리의 상품만 뜨게 어떻게하나요 ㅜㅜ

 

listtype 카테고리 등등 여러가지 검색해보았는데 안떠서 질문올립니닷

관련 자료가 있을것 같은데 혹시 링크 알고 계신분 있으시면 남겨주시면 감사하겠습니다. 

 


<?php
/**
 * core file : /eyoom/core/shop/listtype.php
 */
if (!defined('_EYOOM_')) exit;
// 상품 리스트에서 다른 필드로 정렬을 하려면 아래의 배열 코드에서 해당 필드를 추가하세요.
if( isset($sort) && ! in_array($sort, array('it_sum_qty', 'it_price', 'it_use_avg', 'it_use_cnt', 'it_update_time', 'ca_id')) ){
    $sort='';
} 

$type = preg_replace("/[\<\>\'\"\\\'\\\"\%\=\(\)\s]/", "", $_REQUEST['type']);
if ($type == 1)      $g5['title'] = '히트상품';
else if ($type == 2) $g5['title'] = '추천상품';
else if ($type == 3) $g5['title'] = '최신상품';
else if ($type == 4) $g5['title'] = '인기상품';
else if ($type == 5) $g5['title'] = '할인상품';
else
    alert('상품유형이 아닙니다.');
include_once('./_head.php');
/**
 * 한페이지에 출력하는 이미지수 = $list_mod * $list_row
 */
$list_mod   = $default['de_listtype_list_mod'];   // 한줄에 이미지 몇개씩 출력?
$list_row   = $default['de_listtype_list_row'];   // 한 페이지에 몇라인씩 출력?
$img_width  = $default['de_listtype_img_width'];  // 출력이미지 폭
$img_height = $default['de_listtype_img_height']; // 출력이미지 높이
/**
 * 상품 출력순서가 있다면
 */
$order_by = ' it_order, it_id desc ';
if ($sort != '')
    $order_by = $sort.' '.$sortodr.' , it_order, it_id desc';
else
    $order_by = 'it_order, it_id desc';
if (!$skin || preg_match('#\.+[\\\/]#', $skin))
    $skin = $default['de_listtype_list_skin'];
else
    $skin = preg_replace('#\.+[\\\/]#', '', $skin);
define('G5_SHOP_CSS_URL', G5_SHOP_SKIN_URL);
/**
 * 스킨 경로
 */
$skin_dir = EYOOM_CORE_PATH.'/'. G5_SHOP_DIR;
?>
<!-- PC화면에서 표시되는 toggle button -->
<div class="container listtype_pc_container">
    <div class="row" style="margin:0 auto 10px auto;">
        <div class="col-md-2 col-sm-2">
            <ul class="best_nav">
                <li class="active" role="presentation"><a href="#" data-toggle="tab">전체</a></li>
            <?php
                $sql = "select distinct ca_name from g5_shop_category where length(ca_id)<4";
                $result = sql_query($sql,false);
                    /* for ($i=0; $row = sql_fetch_array($result); $i++) { */
                for ($i=0; $row = sql_fetch_array($result); $i++) {
            ?>
                <li role="presentation"><a href="#" data-toggle="tab"><?php echo $row['ca_name']?></a></li>
            <?php } ?>
            </ul>
        </div>        
    </div>
</div>
<?php 
/**
 * 리스트 유형별로 출력
 */
$list_file = $skin_dir.'/'.$skin;
if (file_exists($list_file)) {
    /**
     * 총몇개 = 한줄에 몇개 * 몇줄
     */
    $items = $list_mod * $list_row;
    /**
     * 페이지가 없으면 첫 페이지 (1 페이지)
     */
    if ($page < 1) $page = 1;
    /**
     * 시작 레코드 구함
     */
    $from_record = ($page - 1) * $items;
    $list = new item_list();
    $list->set_type($type);
    $list->set_list_skin($list_file);
    $list->set_list_mod($list_mod);
    $list->set_list_row($list_row);
    $list->set_img_size($img_width, $img_height);
    $list->set_is_page(true);
    $list->set_order_by($order_by);
    $list->set_from_record($from_record);
    //----------------------20.08.21--------------------------------
    $list->set_category($ca['ca_id'], 3);
    //----------------------20.08.21 end ---------------------------
    $list->set_view('it_img', true);
    $list->set_view('it_id', false);
    $list->set_view('it_name', 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);
    $item_list = $list->run();
    /**
     * where 된 전체 상품수
     */
    $total_count = $list->total_count;
    /**
     * 전체 페이지 계산
     */
    $total_page  = ceil($total_count / $items);
}
$qstr .= '&sort='.$sort;
$paging = $eb->set_paging('itemtype', $type, $qstr);
?>
<?php
/**
 * 이윰 테마파일 출력
 */
include_once(EYOOM_THEME_SHOP_SKIN_PATH.'/listtype.skin.html.php');
include_once('./_tail.php');

?>

 

listtype.php 코드입니다.

이 질문에 댓글 쓰기 :

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

회원로그인

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