상품리스트에서 상품문의 갯수 (카운팅) 하는 방법 알수 있을 까요?

상품리스트에서 상품문의 갯수 (카운팅) 하는 방법 알수 있을 까요?

QA

상품리스트에서 상품문의 갯수 (카운팅) 하는 방법 알수 있을 까요?

답변 2

본문

후기 카운팅, 댓글 카운팅은 있는데 상품문의 카운팅은 없어서 문의드립니다.

몇일을 눈이 빠지도록 시도해보았으나 적용이 안되어 도움을 받고자 문의드립니다.

혹시 알고 계신 분 있으시면 팁을 알려주시면 감사드리겠습니다. 

 

이 질문에 댓글 쓰기 :

답변 2

/skin/shop/list.10.skin.php 파일

붉은색 참조하세요. 20,30,40.skin.php 사용하시는 스킨에는 다 넣어 주셔야 나올겁니다. 


<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가

// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_CSS_URL.'/style.css">', 0);
?>

<!-- 상품진열 10 시작 { -->
<?php
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';
    }

    // 관리자가 확인한 사용후기의 개수를 얻음
    $sql = " select count(*) as cnt from `{$g5['g5_shop_item_use_table']}` where it_id = '{$row['it_id']}' and is_confirm = '1' ";
    $crow= sql_fetch($sql);
    $item_use_count = $crow['cnt'];

    // 상품문의의 개수를 얻음
    $sql = " select count(*) as cnt from `{$g5['g5_shop_item_qa_table']}` where it_id = '{$row['it_id']}' ";
    $crow = sql_fetch($sql);
    $item_qa_count = $crow['cnt'];


    if ($i == 1) {
        if ($this->css) {
            echo "<ul class=\"{$this->css}\">\n";
        } else {
            echo "<ul class=\"sct sct_10\">\n";
        }
    }

    echo "<li class=\"sct_li{$sct_last}\" style=\"width:{$this->img_width}px\">\n";

    if ($this->href) {
        echo "<div class=\"sct_img\"><a href=\"{$this->href}{$row['it_id']}\" class=\"sct_a\">\n";
    }

    if ($this->view_it_img) {
        echo get_it_image($row['it_id'], $this->img_width, $this->img_height, '', '', stripslashes($row['it_name']))."\n";
    }

    if ($this->href) {
        echo "</a></div>\n";
    }

    if ($this->view_it_icon) {
        echo "<div class=\"sct_icon\">".item_icon($row)."</div>\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']}\" class=\"sct_a\">\n";
    }

    if ($this->view_it_name) {
        echo stripslashes($row['it_name'])."\n";
    }

    if ($this->href) {
        echo "</a></div>\n";
    }

    if ($this->view_it_basic && $row['it_basic']) {
        echo "<div class=\"sct_basic\">".stripslashes($row['it_basic'])."</div>\n";
    }

    if ($this->view_it_cust_price || $this->view_it_price) {

        echo "<div class=\"sct_cost\">\n";

        if ($this->view_it_cust_price && $row['it_cust_price']) {
            echo "<strike>".display_price($row['it_cust_price'])."</strike>\n";
        }

        if ($this->view_it_price) {
            echo display_price(get_price($row), $row['it_tel_inq'])."\n";
        }

        echo "</div>\n";

    }
   
    echo "<div class=\"sct_txt\">사용후기 : ".stripslashes($item_use_count)."</div>\n";
    echo "<div class=\"sct_txt\">상품문의 : ".stripslashes($item_qa_count)."</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\" style=\"top:{$sns_top}px\">";
        echo get_sns_share_link('facebook', $sns_url, $sns_title, G5_SHOP_SKIN_URL.'/img/sns_fb_s.png');
        echo get_sns_share_link('twitter', $sns_url, $sns_title, G5_SHOP_SKIN_URL.'/img/sns_twt_s.png');
        echo get_sns_share_link('googleplus', $sns_url, $sns_title, G5_SHOP_SKIN_URL.'/img/sns_goo_s.png');
        echo "</div>\n";
    }

    echo "</li>\n";
}

if ($i > 1) echo "</ul>\n";

if($i == 1) echo "<p class=\"sct_noitem\">등록된 상품이 없습니다.</p>\n";
?>
<!-- } 상품진열 10 끝 --> 

 

상당히 많이 변경이 되어 있네요.. 기본 클래스도 사용을 안하고...
아미나빌더최신본을 받아서 소스 분석을 좀 했습니다.

1. /shop/list.php

---------------------------------------------------------------
기존 116번째 줄
$num = $total_count - ($page - 1) * $item_rows;
$result = sql_query(" select * from `{$g5['g5_shop_item_table']}` where $where order by $order_by limit $from_record, $item_rows ");
for ($i=0; $row=sql_fetch_array($result); $i++) {
$list[$i] = $row;
$list[$i]['href'] = './item.php?it_id='.$row['it_id'].$qstr.'&amp;page='.$page;
$list[$i]['num'] = $num;
$num--;
}

--------------------------------------------------------------------

변경
$num = $total_count - ($page - 1) * $item_rows;
$result = sql_query(" select * from `{$g5['g5_shop_item_table']}` where $where order by $order_by limit $from_record, $item_rows ");
for ($i=0; $row=sql_fetch_array($result); $i++) {
$list[$i] = $row;
$list[$i]['href'] = './item.php?it_id='.$row['it_id'].$qstr.'&amp;page='.$page;
$list[$i]['num'] = $num;

$sql = " select count(*) as cnt from `{$g5['g5_shop_item_qa_table']}` where it_id = '{$row['it_id']}' ";
$crow = sql_fetch($sql);
$list[$i]['item_qa_count'] = $crow['cnt'];
$num--;
}

이렇게 변경하시고 /skin/apms/list/basic/list.skin.php 에서 <?php echo $list[$i]['item_qa_count']; ?> 이렇게 사용하시면 될 겁니다.

우와!!!!!!!!!!!!!!!!
JAVA대세 님 정말정말 감사드립니다.
제가 사용하는 빌더에 문의한 결과 안된다고만해서 막포기직전이었는데 이렇게 해결을 해주시다니 감사합니다.
복 많이 받으실 거예요.^^
타빌더를 분석까지 하셔서 해결을 해주시다니 또한번 감사드립니다.
정말정말 감사드립니다.

리스트 스킨에서 추가 쿼리를 이용하시면 됩니다.

쇼핑몰은 분석을 해본적이 없어서...

list.10.skin.php를 예를 들면

10번줄 for문 안에 

// 상품문의의 개수를 얻음

$sql = " select count(*) as cnt from `{$g5['g5_shop_item_qa_table']}` where it_id = '{$row['it_id']}' ";

$crow = sql_fetch($sql);

$item_qa_count = $crow['cnt']; 

이렇게 쿼리를 하심 상품별 $item_qa_count​에 문의 갯수를 알수 있습니다.

 

 

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 7
© SIRSOFT
현재 페이지 제일 처음으로