상품 옵션이 없을 경우 sit_buy에 금액 출력
본문
제가 소스를 잘못 만져서 꼬인건가 싶어서 영카트5 데모페이지에서도 확인해보니 현상이 동일하더라구요.
https://demo.sir.kr/gnuboard5/shop/item.php?it_id=201603292
이곳에 보면
하단부에 총 금액이 없다가 수량을 수정해야 금액이 나타나는데
처음부터 총 금액이 나오게 하려면 어떻게 해야할까요?
//item.info.skin.shp
$(document).on("price_calculate", "#sit_tot_price", function(e, total) {
$(".sum_section .sit_tot_price").empty().html("<span>총 금액 </span><strong>"+number_format(String(total))+"</strong> 원");
});
//js/shop.js
// 가격계산
function price_calculate()
{
var it_price = parseInt($("input#it_price").val());
if(isNaN(it_price))
return;
var $el_prc = $("input.io_price");
var $el_qty = $("input[name^=ct_qty]");
var $el_type = $("input[name^=io_type]");
var price, type, qty, total = 0;
$el_prc.each(function(index) {
price = parseInt($(this).val());
qty = parseInt($el_qty.eq(index).val());
type = $el_type.eq(index).val();
if(type == "0") { // 선택옵션
total += (it_price + price) * qty;
} else { // 추가옵션
total += price * qty;
}
});
$("#sit_tot_price").empty().html("<span>총 금액 :</span><strong>"+number_format(String(total))+"</strong> 원");
$("#sit_tot_price").trigger("price_calculate", [total]);
}
!-->
답변을 작성하시기 전에 로그인 해주세요.