채택완료

가격계산 스크립트 한번만 부탁드립니다.

32287339_1679891551.9703.png
예전질문에서 아직 끙끙 앓고 있는데요 ;; https://sir.kr/qa/494765

shop.js 부분에서 theme 의 item.form.skin의 가격계산부분에서 막히는게 있어서 질문드립니다. 

제품 수량을 올리면 갯수랑 제품 단가랑 곱해져서 총금액이 출력되어야되는데 갯수를 올려도 변환이 안되고 하나 가격으로 출력되고 있어서 어떻게 손보면 될까요?   문제는 $("input#it_price") 요부분인거 같은데 


Copy
// 가격계산 - usd 
function price_calculateusd()
{
    var it_usd = parseInt($("input#it_price").val());

    if(isNaN(it_usd))
        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_usd + price) * qty;
        } else { // 추가옵션
            total += price * qty;
        }
    });

    $("#sit_tot_priceusd").empty().html("<span>TOTAL PRICE :</span> "+number_format(String(total))+"$");
}
 
|

답변 1개 / 댓글 1개

채택된 답변
+20 포인트

작업중인 사이트 주소가 있나요?

답변에 대한 댓글 1개

안녕하세요~! 쪽지 드리겠습니다.

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