영카트 추가옵션 금액이 합산이 안됩니다..
본문
영카트에서 추가옵션에 가격을 추가하였는데
제품 상세페이지에서 추가옵션을 선택하면 기본가격에 추가옵션 가격 합산이 안되는데 제가 css수정하면
서 잘못 건들인건지 원래 추가옵션은 가격을 추가해도 합산이 안되는지 궁금합니다.
js/shop.js 파일을 살펴보니 추가옵션부분에는 따로 가격합산 부분이 없는거같은데.. 제가 잘못알고있는건가요??
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(number_format(String(total)));
}
위 코드의 22번째 줄에있는 else 문에서
total += price * qty; << 이부분인데, 선택옵션과 달리 추가옵션을 따로 더해주는거같진 않더라구요..
!-->
답변 1
if (type == "0" ) { // 선택옵션 |
20 | total += (it_price + price) * qty; |
21 | } else { // 추가옵션 |
22 | total += price * qty; |
23 | } |
이부분에서 가격과 옵션가격을 더한값 그리고 수량을 곱한값이 잇는데..
$(
"#sit_tot_price"
).
empty
().html(number_format(String(total))); 이부분이 적용하는 부분이구요
뭔가 잘못건들으셨던가.. id값이 틀리다거나.. 정확히 감은 안잡히는데..
원래는 잘되는 기능들입니다.
답변을 작성하시기 전에 로그인 해주세요.