상품 리스트 내에 인기상품 불러오기

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
상품 리스트 내에 인기상품 불러오기

QA

상품 리스트 내에 인기상품 불러오기

본문

메인페이지에 인기상품 슬라이드가 있습니다(main.10.skin.php)

상품 리스트( ex. list.php?ca_id=10 ) 내에 이 슬라이드를 추가하고 싶어요


    <?php
    $list = new item_list();
    $list->set_category('10', 1);
    $list->set_type(3);
    $list->set_list_skin(G5_SHOP_SKIN_PATH.'/main.10.skin.php');
    $list->set_view('it_id', false);
    $list->set_view('it_name', true);
    $list->set_view('it_basic', true);
    $list->set_view('it_cust_price', true);
    $list->set_view('it_price', true);
    $list->set_view('it_icon', true);
    $list->set_view('sns', true);
    echo $list->run();
    ?>

 

원하는 페이지모습은 목록페이지에

아래처럼 해당 목록의 인기상품을 슬라이드로 추가하는 건데

 

카테고리10 베스트

상품 상품 상품 상품

─────────

(카테고리10 목록)

상품 상품 상품 상품

상품 상품 상품 상품

상품 상품 상품 상품

상품 상품 상품 상품

 

위 코드를 list.10.skin.php에 그대로 넣으니 원래 나오는 상품목록에도 bx-wrapper가 붙으면서

레이아웃이 엉망이 됐습니다

list.skin.php내에 list를 추가로 불러오려면 어떤 함수/쿼리문을 써야하나요?

이 질문에 댓글 쓰기 :

답변 2

작업중이신 페이지의 url 이나 소스를 추가적으로 보여주실 수 있을까요?

소스코드를 올리느라 댓글말고 답변으로 추가했습니다ㅠㅠ
테마사용중이며 list.10.skin.php 페이지인데
해당 페이지의 상품목록 윗부분에 같은 카테고리중에 인기상품을 불러오려는거라서요ㅜㅜ


<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_SKIN_URL.'/style.css">', 0);
add_javascript('<script src="'.G5_THEME_JS_URL.'/jquery.shop.list.js"></script>', 10);
?>
<div class="">
    <ul id="sct_lst">
        <li><button type="button" class="sct_lst_view sct_lst_list"><i class="fa fa-th-list" aria-hidden="true"></i><span class="sound_only">리스트뷰</span></button></li>
        <li><button type="button" class="sct_lst_view sct_lst_gallery"><i class="fa fa-th-large" aria-hidden="true"></i><span class="sound_only">갤러리뷰</span></button></li>
    </ul>
<!-- 상품진열 10 시작 { -->
    
<div>
    <?php
    /*
    $list = new item_list();
    $list->set_category('10', 1);
    $list->set_type(3);
    $list->set_list_skin(G5_SHOP_SKIN_PATH.'/main.10.skin.php');
    $list->set_view('it_id', false);
    $list->set_view('it_name', true);
    $list->set_view('it_basic', true);
    $list->set_view('it_cust_price', true);
    $list->set_view('it_price', true);
    $list->set_view('it_icon', true);
    $list->set_view('sns', true);
    $list->set_view('it_star_score', true); // 별점 보이기
    $list->set_order_by('rand()'); //순서 랜덤
    echo $list->run();
    */
    ?>
</div>

<div id="curr_brand">
    <h2></h2>
    <?php
    $row2 = sql_fetch(" select count(*) as cnt from {$g5['g5_shop_item_table']} where (ca_id like '$ca_id%' or ca_id2 like '$ca_id%' or ca_id3 like '$ca_id%') and it_use = '1'  ");
    ?>
    <p><span class="pointTxt"><?php echo $row2['cnt']; ?></span>개의 상품의 있습니다.</p>
</div>
<?php
$qq = sql_query("select it_id from {$g5['g5_shop_wish_table']} where mb_id = '{$member['mb_id']}' ");
$wishArr = array();
while($row_wish = sql_fetch_array($qq)) {
    $wishArr[] = $row_wish['it_id'];
}
for ($i=1; $row=sql_fetch_array($result); $i++) {
    if ($this->list_mod >= 2) { // 1줄 이미지 : 2개 이상
        if ($i%$this->list_mod == 0) $sct_last = 'sct_last'; // 줄 마지막
        else if ($i%$this->list_mod == 1) $sct_last = 'sct_clear'; // 줄 첫번째
        else $sct_last = '';
    } else { // 1줄 이미지 : 1개
        $sct_last = 'sct_clear';
    }
    if ($i == 1) {
        if ($this->css) {
            echo "<ul class=\"{$this->css}\">\n";
        } else {
            echo "<ul class=\"sct sct_10 list_10\">\n";
        }
    }

    echo "<li class=\"sct_li {$sct_last}\" style=\"width:{$this->img_width}px\">\n";
    echo "<div class=\"sct_img\">\n";
    if ($this->href) {
        echo "<a href=\"{$this->href}{$row['it_id']}\">\n";
    }
    if ($this->view_it_img) {
        echo "<span class=\"sct_img_01\">".get_it_image($row['it_id'], $this->img_width, $this->img_height, '', '', stripslashes($row['it_name']))."</span>\n";
    }
    if ($this->href) {
        echo "</a>\n";
    }
    if ($this->view_it_icon) {
        echo item_icon2($row);
    }
    echo "</div>\n";
    echo "<div class=\"txt_wr\">\n";
    if ($this->view_it_id) {
        echo "<div class=\"sct_id\"><".stripslashes($row['it_id'])."></div>\n";
    }
    if ($this->href) {
        echo "<div class=\"sct_txt\"><a href=\"{$this->href}{$row['it_id']}\">\n";
    }
    
    $sql = " select * from {$g5['g5_shop_category_table']} where ca_id = '{$row['ca_id3']}' and ca_use = '1' ";
    $ca = sql_fetch($sql);
    echo "<div class=\"sct_brand\">".$ca['ca_name']."</div>\n";
    if ($this->view_it_name) {
        echo stripslashes($row['it_name'])."\n";
    }
    if ($this->href) {
        echo "</a></div>\n";
    }
    if ($this->view_it_cust_price || $this->view_it_price) {
        echo "<span class=\"sct_cost\">\n";
        if ($this->view_it_cust_price && $row['it_cust_price']) {
            echo "<span class=\"sct_discount\" style=\"text-decoration:line-through;\">".display_price($row['it_cust_price'])."</span>\n";
            $sale_per = "<strong class=\"sale_per\">".ceil((1 - (get_price($row)/$row["it_cust_price"]))*100)."%</strong>";
            echo str_replace("-", "", $sale_per);
        }
        if ($this->view_it_price) {
            echo "<span class=\"sct_price\">".display_price(get_price($row), $row['it_tel_inq'])."</span>\n";
        }
        echo "</span>\n";
    }
 
    echo "<div class=\"sct_cart_btn\"><button type=\"button\" class=\"btn_cart btn_b02 btn_s\" data-it_id=\"{$row['it_id']}\">장바구니</button> \n";
    
    echo "</div>\n";
    if (in_array($row['it_id'], $wishArr)) {
        echo "<div class=\"sct_btn\"><div class=\"sct_btn_wish\"><button type=\"button\" class=\"btn_wish on\" data-it_id=\"{$row['it_id']}\"><span class=\"sound_only\">위시리스트</span><img src=".G5_DOMAIN."/img/icon_heart_.png></button>\n";
        echo "<span>".get_wish_item_count($row['it_id'])."</span>";
    } else {
        echo "<div class=\"sct_btn\"><button type=\"button\" class=\"btn_wish\" data-it_id=\"{$row['it_id']}\"><span class=\"sound_only\">위시리스트</span><img src=".G5_DOMAIN."/img/icon_heart_.png></button>\n";
        echo "<span>".get_wish_item_count($row['it_id'])."</span>";
    }
    
    //별점보기
    $star_score = get_star_image($row['it_id']);
    if ($star_score) {
        echo "<div class=\"sct_btn_star\"><img src=".G5_DOMAIN."/img/s_star.png><span>".$star_score."</span></div>\n";
    } else {
        echo "<div class=\"sct_btn_star\"><img src=".G5_DOMAIN."/img/s_star.png><span>0</span></div>\n";
    }
    
    //후기 개수
    $sql = " select count(*) as cnt from `{$g5['g5_shop_item_use_table']}` where it_id = '{$row['it_id']}' and is_confirm = '1'  ";
    $row = sql_fetch($sql);
    $item_use_count = $row['cnt'];
    echo "<div class=\"sct_btn_review\"><img src=".G5_DOMAIN."/img/s_comment.png><span>".$item_use_count."</span></div>\n";

     if ($this->view_sns) {
        $sns_top = $this->img_height + 10;
        $sns_url  = G5_SHOP_URL.'/item.php?it_id='.$row['it_id'];
        $sns_title = get_text($row['it_name']).' | '.get_text($config['cf_title']);
        echo "<div class=\"sct_sns\"><div class=\"sct_sns_wr\"><h3>SNS 공유</h3><div>";
        echo get_sns_share_link('facebook', $sns_url, $sns_title, G5_MSHOP_SKIN_URL.'/img/facebook.png');
        echo get_sns_share_link('twitter', $sns_url, $sns_title, G5_MSHOP_SKIN_URL.'/img/twitter.png');
        echo get_sns_share_link('googleplus', $sns_url, $sns_title, G5_MSHOP_SKIN_URL.'/img/gplus.png');
        echo get_sns_share_link('kakaotalk', $sns_url, $sns_title, G5_MSHOP_SKIN_URL.'/img/sns_kakao.png');
        echo "</div><button type=\"button\" class=\"btn_close\"><i class=\"fa fa-times\" aria-hidden=\"true\"></i></button></div><div class=\"bg\"></div></div>\n";
    }
    echo "</div>\n";
    echo "<div class=\"sct_cartop\"></div>\n";
   
    echo "</li>\n";
}

if ($i > 1) echo "</ul>\n";
if($i == 1) echo "<p class=\"sct_noitem\">등록된 상품이 없습니다.</p>\n";
?>
</div>
답변을 작성하시기 전에 로그인 해주세요.
전체 0
QA 내용 검색

회원로그인

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