채택완료

시중가격 미입력시 할인율 표기

2020-07-21 (화) 22:47:35 2,574
Copy
if ($this->view_it_price) {

        echo "<div class=\"sct_cost\">\n";
        echo display_price(get_price($row), $row['it_tel_inq'])."\n";
        
        echo "<span class=\"sct_vjtpsxm\">".$sale_per=ceil(( ( $row['it_cust_price']-get_price($row) ) /$row['it_cust_price'])*100).'% Off' ;
        
        echo "</span>\n";
      

        echo "</div>\n";

        }
      
            echo "<span class=\"sct_discount\">".display_price($row['it_cust_price'])."</span>\n";

    echo "</div></li>\n";
}

3554187964_1595339087.7095.png

list.10.skin.php

시중가격 미입력시에  0원 0% off 가 안나오게 하고싶습니다. 

--------------------------------------------------------------------------------------------------------

main.10.skin.php  메인 에서는 잘 됩니다.

Copy
if ($this->view_it_price) {

            // 가격 추가
            if ($this->view_it_cust_price && $row['it_cust_price']) {
                echo "<span class=\"sct_discount\">".display_price($row['it_cust_price'])."</span>\n";
            }

            echo "<div class=\"sct_cost\">\n";
            echo display_price(get_price($row), $row['it_tel_inq'])."\n";
            // 할인율 추가 2020.06.24
            if ($this->view_it_cust_price && $row['it_cust_price']) {
            echo "<span class=\"sct_vjtpsxm\">".$sale_per=ceil(( ( $row['it_cust_price']-get_price($row) ) /$row['it_cust_price'])*100).'% Off' ;
            // echo "<span class=\"sct_vjtpsxm\">".$sale_per=ceil(((get_price($row)-$row['it_cust_price'])/$row['it_cust_price'])*100).'%';
            echo "</span>\n";
        }
        //
             echo "</div>\n";
            }

        echo "</div></li>\n";
    }

3554187964_1595339233.4416.png

|

답변 1개 / 댓글 3개

채택된 답변
+20 포인트
Copy
if ($this->view_it_price) {
        echo "<div class=\"sct_cost\">\n";
        echo display_price(get_price($row), $row['it_tel_inq'])."\n";
        if ($this->view_it_cust_price && $row['it_cust_price']) {
          echo "<span class=\"sct_vjtpsxm\">".$sale_per=ceil(( ( $row['it_cust_price']-get_price($row) ) /$row['it_cust_price'])*100).'% Off' ;

        }        
        echo "</span>\n";      
        echo "</div>\n";
        }
      if ($this->view_it_cust_price && $row['it_cust_price']) {
            echo "<span class=\"sct_discount\">".display_price($row['it_cust_price'])."</span>\n";

      }
    echo "</div></li>\n";
}

답변에 대한 댓글 3개

답변 감사합니다. 적용하니, 시중 가격및 할인율까지 모두 안나오네요 ..

영카트 기본으로 하면 적용이 되니, 소스상으론 문제가 없어 보입니다.



아래 소스가 문제가 있는거 같은데, 찾기가 쉽지 않네요

[code]
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_CSS_URL.'/style.css">', 0);
add_javascript('<script src="'.G5_THEME_JS_URL.'/jquery.shop.list.js"></script>', 10);
?>

<?php if($config['cf_kakao_js_apikey']) { ?>
<script src="https://developers.kakao.com/sdk/js/kakao.min.js"></script>
<script src="<?php echo G5_JS_URL; ?>/kakaolink.js"></script>
<script>
// 사용할 앱의 Javascript 키를 설정해 주세요.
Kakao.init("<?php echo $config['cf_kakao_js_apikey']; ?>");
</script>
<?php } ?>
<div class="sct-size">
<button type="button" class="btn-size" id="btn-big">이미지크게보기</button>
<button type="button" class="btn-size active" id="btn-small">이미지작게보기</button>
</div>
<!-- 상품진열 10 시작 { -->
<div class="sct_wrap" >
<?php
$li_width = intval(100 / $this->list_mod);
$li_width_style = ' style="width:'.$li_width.'%;"';

for ($i=0; $row=sql_fetch_array($result); $i++) {
if ($i == 0) {
if ($this->css) {
echo "<ul id=\"sct_wrap\" class=\"{$this->css}\">\n";
} else {
echo "<ul id=\"sct_wrap\" class=\"sct sct_10\">\n";
}
}

if($i % $this->list_mod == 0)
$li_clear = ' sct_clear';
else
$li_clear = '';

echo "<li class=\"sct_li\"><div class=\"sct_li_wr\">\n";

echo "<div class=\"img_wr\">";

if ($this->href) {
echo "<div class=\"sct_img\"><a href=\"{$this->href}{$row['it_id']}\" class=\"sct_a\">\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></div>\n";
}

echo "<div class=\"sct_btn\">
<div class=\"sct_cart_btn\">
<button type=\"button\" class=\"btn_cart\" data-it_id=\"{$row['it_id']}\"><span class=\"sound_only\">장바구니</span><i class=\"fa fa-shopping-cart\" aria-hidden=\"true\"></i></button>
<button type=\"button\" class=\"btn_wish\" data-it_id=\"{$row['it_id']}\"><span class=\"sound_only\">위시리스트</span><i class=\"fa fa-heart\" aria-hidden=\"true\"></i></button>
</div>
</div>\n";

echo "</div>";

echo "<div class=\"sct_cartop\"></div>\n";
if ($this->href) {
echo "<div class=\"sct_txt\"><a href=\"{$this->href}{$row['it_id']}\" class=\"sct_a\">\n";
}

if ($this->view_it_name) {
echo stripslashes($row['it_name'])."\n";
}

if ($this->href) {
echo "</a></div>\n";
}

if ($this->view_it_price) {
echo "<div class=\"sct_cost\">\n";
echo display_price(get_price($row), $row['it_tel_inq'])."\n";
if ($this->view_it_cust_price && $row['it_cust_price']) {
echo "<span class=\"sct_vjtpsxm\">".$sale_per=ceil(( ( $row['it_cust_price']-get_price($row) ) /$row['it_cust_price'])*100).'% Off' ;
}
echo "</span>\n";
echo "</div>\n";
}
if ($this->view_it_cust_price && $row['it_cust_price']) {
echo "<span class=\"sct_discount\">".display_price($row['it_cust_price'])."</span>\n";
}
echo "</div></li>\n";
}

if ($i > 0) echo "</ul>\n";

if($i == 0) echo "<p class=\"sct_noitem\">등록된 상품이 없습니다.</p>\n";
?>

</div>
<style>
.sct_discount{
/* margin-top:0; */
}
</style>
<script>

$(".sct-size button").click(function () {
$(".sct-size button").removeClass("active");
$(this).addClass("active");
});
$("#btn-small").click(function () {
$(".sct_wrap").removeClass("big").addClass("small");
});
$("#btn-big").click(function () {
$(".sct_wrap").removeClass("small").addClass("big");
});

</script>
<!-- } 상품진열 10 끝 -->

[/code]
if ($this->view_it_cust_price && $row['it_cust_price']) {
를 아래와 같이 수정해보세요.
if ($row['it_cust_price']) {
if ($row['it_cust_price']) { 여기가 문제였군요
감사합니다!!

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