개별상품할인 쿠폰 적용된 상품만 출력하기
본문
특정 페이지에 개별상품할인 쿠폰이 적용된 상품을 출력하고자 합니다.
$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();
로 적용하면 상품정보를 제대로 가지고 오지 못하는데요, 뭐가 잘못되었을까요?
!-->답변 1
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 등 숫자타입은 따옴표 없이 숫자만 쓰면 됩니다.
답변을 작성하시기 전에 로그인 해주세요.