쇼핑몰 썸네일 한개 등록시 여러 개 출력 되는데 한개만 나오는방법이요~
관련링크
본문
RF 리모컨 부분에 제품이 한개 등록 되어있는데
위,아래 같은 스킨 적용 하니, 이렇게 됩니다.
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_SKIN_URL.'/style.css">', 0);
?>
<!-- 상품진열 10 시작 { -->
<?php
$i=0;
foreach((array) $list as $row){
if( empty($row) ) continue;
$i++;
$item_link_href = shop_item_url($row['it_id']);
$star_score = $row['it_use_avg'] ? (int) get_star($row['it_use_avg']) : '';
$is_soldout = is_soldout($row['it_id'], true); // 품절인지 체크
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';
}
if ($i == 1) {
if ($this->css) {
echo "<ul class=\"{$this->css}\">\n";
} else {
echo "<ul class=\"sct smt_40 owl-carousel\">\n";
}
}
echo "<li class=\"sct_li {$sct_last}\" style=\"width:{$this->img_width}px\">\n";
echo "<div class=\"sct_img\">\n";
if ($this->href) {
echo "<a href=\"{$item_link_href}\">\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>\n";
}
if ($this->view_it_icon) {
// 품절
if ($is_soldout) {
echo '<span class="shop_icon_soldout h160"><span class="soldout_txt">SOLD OUT</span></span>';
}
}
echo "</div>\n";
if ($this->view_it_id) {
echo "<div class=\"sct_id\"><".stripslashes($row['it_id'])."></div>\n";
}
// 사용후기 평점표시
if ($this->view_star && $star_score) {
echo "<div class=\"sct_star\"><span class=\"sound_only\">고객평점</span><img src=\"".G5_SHOP_URL."/img/s_star".$star_score.".png\" alt=\"별점 ".$star_score."점\" class=\"sit_star\"></div>\n";
}
if ($this->href) {
echo "<div class=\"sct_txt\"><a href=\"{$item_link_href}\">\n";
}
if ($this->view_it_name) {
echo stripslashes($row['it_name'])."\n";
}
if ($this->href) {
echo "</a></div>\n";
}
if ($this->view_it_cust_price || $this->view_it_price) {
echo "<div class=\"sct_cost\">\n";
if ($this->view_it_price) {
echo display_price(get_price($row), $row['it_tel_inq'])."\n";
}
echo "</div>\n";
}
echo "</li>\n";
}
if ($i >= 1) echo "</ul>\n";
if($i == 0) echo "<p class=\"sct_noitem\">There is no registered product.</p>\n";
?>
<!-- } 상품진열 10 끝 -->
답변 1
PHP코드를 전부 봐야 되는데, 힘드네요..
가장 좋은 방법은 디버거를 통해서 여러개 프린트 하는 부분 (for 같은 loop)을 벗어나는 조건이 맞는지를 체크하는 것입니다.
PHP 디버거는 xdebug나 https://sir.kr/g5_tip/13330 추천드립니다.