테스트 사이트 - 개발 중인 베타 버전입니다

개별상품할인 쿠폰 적용된 상품만 출력하기 채택완료

무돌이 7년 전 조회 2,186

특정 페이지에 개별상품할인 쿠폰이 적용된 상품을 출력하고자 합니다.

 

</p>

<p>$list_mod = 4;     // 가로 이미지수

$list_row = 1;     // 이미지줄 수, Query를 직접 지정하기 때문에 이미지줄 수는 적용되지 않음

$img_width = 230;  // 이미지 폭

$img_height = 230; // 이미지 높이

$skin = G5_SHOP_SKIN_PATH.'/main.10.skin.php'; // 스킨

$sql = " select * from {$g5['g5_shop_item_table']} a, {$g5['g5_shop_coupon_table']} b where a.it_soldout = '0' and a.it_stock_qty > '0' and b.cp_method = '0' and b.cp_start <= '".G5_TIME_YMD."' and b.cp_end >= '".G5_TIME_YMD."' limit 20";

$list = new item_list($skin, $list_mod, $list_row, $img_width, $img_height);

$list->set_query($sql);

$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', true);

$list->set_view('it_price', true);

$list->set_view('it_icon', true);

$list->set_view('sns', true);

echo $list->run();</p>

<p>

 

로 적용하면 상품정보를 제대로 가지고 오지 못하는데요, 뭐가 잘못되었을까요?

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

답변 1개

7년 전

it_soldout, it_stock_qty, cp_method 다

DB의 항목의 값이 숫자여야 하네요.

 

it_soldout

tinyint(4)

 0 

상품품절

it_stock_qty

int(11)

 0

재고수량

 

where a.it_soldout = 0 and a.it_stock_qty > 0 and b.cp_method = 0 으로 수정해보세요. 

sql에서나 php등의 프로그램에서나 data의 type에 맞게 지정하고 사용해야 합니다.

문자는 따옴표로 묶어주지만 int, tiny 등 숫자타입은 따옴표 없이 숫자만 쓰면 됩니다.

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

무돌이
7년 전
답변 감사합니다.
그런데 따옴표의 유무와 상관없이 똑같은 결과가 나오네요.ㅠㅠ

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

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

로그인