채택완료

영카트 사용자정의 쿼리를 넣을때요

2015-10-14 (수) 00:15:17 3,845

        $list = new item_list($skin_file, $ca['ca_list_mod'], $ca['ca_list_row'], $ca['ca_img_width'], $ca['ca_img_height']);

        $list->set_category($ca['ca_id'], 1);

        $list->set_category($ca['ca_id'], 2);

        $list->set_category($ca['ca_id'], 3);

        $list->set_is_page(true);

$list->set_query("SELECT * FROM `g5_shop_item` WHERE it_use = '1' AND ( ca_id2 LIKE '1010%' ) ORDER BY it_order, it_id DESC");

궁금한게 쿼리로 하면 끝부분에 limit 10,10 이런 부분 설정안해도 

페이징은 기존 영카트  페이징처리로 되는지요?

|

답변 1개 / 댓글 1개

채택된 답변
+20 포인트

소스(shop.lib.php)를 보시면 아시겠지만

        if ($this->query) {

            $sql = $this->query;
            $result = sql_query($sql);
            $this->total_count = @mysql_num_rows($result);

        } else {

페이징 처리를 위한 limit처리는 안하고 있는걸로 보입니다.

그렇지만 어짜피 클래스내에 limit변수와 함수가 존재하고 스킨자체도 페이징처리도 가능하게 되어있는걸로 보이므로... 

$sql = $this->query;
$result = sql_query($sql); 

$sql_limit = " limit " . $this->from_record . " , " . ($this->list_mod * $this->list_row);

$sql = $sql.$sql_limit;

​$result = sql_query($sql);

$this->total_count = @mysql_num_rows($result);

위와 같이 limit 설정만 해주면 가능할 것으로 보입니다.

참고소스로만 활용하시고 테스트는 안해봐서 직접 해셔야 할것 같습니다. 

답변에 대한 댓글 1개

아.. 맨위부분에 $result = sql_query($sql); 삭제요망.....삭제를 안했네요.ㅎㅎ

답변을 작성하려면 로그인이 필요합니다.