관련상품이 없을때 안보이게 하려면? 채택완료
공대그녀
10년 전
조회 2,720
item.form.skin 파일에 아래 소스를 삽입하여 관련상품을 불러오고 있는데요.
관련상품이 없을때는
관련상품
부분은 안보이게 하고 싶은데,어떻게 해야 될지 모르겠어요.
도움 부탁 드려요.
관련상품
$sql = " select b.* from {$g5['g5_shop_item_relation_table']} a left join {$g5['g5_shop_item_table']} b on (a.it_id2=b.it_id) where a.it_id = '{$it['it_id']}' and b.it_use='1' ";
$list = new item_list($rel_skin_file, 1, 1, $default['de_mobile_rel_img_width'], $default['de_mobile_rel_img_height']); $list->set_mobile(true); $list->set_query($sql); $list->set_view('sns', true); echo $list->run(); ?>
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
채택된 답변
+20 포인트
10년 전
관련상품이 있는지 먼저 체크후 출력하시면 됩니다.
아래와 같이 해주세요.
</p><p><?php</p><p>$tmp = sql_fetch(" select count(*) as cnt from {$g5['g5_shop_item_relation_table']} a left
join {$g5['g5_shop_item_table']} b on (a.it_id2=b.it_id) where a.it_id =
'{$it['it_id']}' and b.it_use='1' ");</p><p>if ($tmp['cnt'] > 0) { </p><p>?> </p><p><h1 id="win_title">관련상품</h1></p><p>
<?php
$rel_skin_file = $skin_dir.'/'.$default['de_mobile_rel_list_skin'];
if(!is_file($rel_skin_file))
$rel_skin_file = G5_MSHOP_SKIN_PATH.'/'.$default['de_mobile_rel_list_skin'];</p><p>
$sql = " select b.* from {$g5['g5_shop_item_relation_table']} a left
join {$g5['g5_shop_item_table']} b on (a.it_id2=b.it_id) where a.it_id =
'{$it['it_id']}' and b.it_use='1' ";</p><p> $list = new item_list($rel_skin_file, 1, 1, $default['de_mobile_rel_img_width'], $default['de_mobile_rel_img_height']);
$list->set_mobile(true);
$list->set_query($sql);
$list->set_view('sns', true);
echo $list->run();
?> </p><p><?php } ?></p><p>
로그인 후 평가할 수 있습니다
답변에 대한 댓글 2개
�
공대그녀
10년 전
�
판다왕
4년 전
꼭 필요해서 검색하다가 덕분에 해결 했습니다. ^^
감사합니다.
감사합니다.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
감사합니다.히힛.