상품구매할때 할인율을 표기해보려하는데 몇 시간째 헤메이고있네요 ㅠㅠ
본문
--------------- item.form.skin.php -----------------
-- 생략 --
<th scope="row">시중가격</th>
<td><?php echo "<strike><span class='sct_cust_price'>".display_price($it['it_cust_price'])."</span></strike>"?></td>
</tr>
<?php } // 시중가격 끝 ?>
<tr>
<th scope="row">판매가격</th>
<td>
<strong><?php echo display_price(get_price($it)); ?></strong>
>> 대략 이 아래쪽에 소스를 짜서 넣어주면 될것같아보이는데 어렵네요 ㅠㅠ
<input type="hidden" id="it_price" value="<?php echo get_price($it); ?>">
</td>
</tr>
<?php } ?>
<?php
--생략--
위 이미지와 같이 69% 할인율을 추가해보고 싶습니다.
영카트 베이직 스킨을 사용중인데 저 부분이 어렵네요 ㅠ.ㅠ
답변 2
<?php
if ($it['it_cust_price'] && $it['it_price']) {
echo round(($it['it_cust_price'] - $it['it_price']) / $it['it_cust_price'] * 100)."%";
}
?>
작은별님 매번 도움주셔서 큰 힘이 되었습니다. 진심으로 감사드려요^^