총금액 옆에 총수량을 넣을수 있을까요?

총금액 옆에 총수량을 넣을수 있을까요?

QA

총금액 옆에 총수량을 넣을수 있을까요?

본문

3024375308_1692002220.565.jpg

 

블럭친것처럼 총금액이 나오는 좌측으로 총수량(총구매갯수) 갯수를 노출할려면 어떻게 해야 할까요?

선택옵션의 경우와 옵션없는 단일 상품 모두 총금액 옆에 추가로 총수량을 노출하고 싶은데 어디를 봐야할지 못찾겠네요...

이 질문에 댓글 쓰기 :

답변 3

이건 var $el_qty = $("input[name^=ct_qty]"); 이부분을 합산해서 보여주는 소스를 추가해야 할듯 하다

어디까지 바라는 거냐? 어디를 봐야 할지 모른다고 해서 위치를 찾아 줬으면 알아서 해라

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> "+number_format(String(total))+"원");
}

 

또는 shop.overide.js

하단에

 

    if (typeof price_calculate === "function") {
        price_calculate = (function() {
            var cached_function = price_calculate;

            return function() {
                
                if( $(".2017_renewal_itemform").length ){

                    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> 원");

                } else {
                    cached_function.apply(this, arguments); // use .apply() to call it
                }
                
            };
        }());
    }   //end if check function

 

 

추가 피해자 방지 https://sir.kr/conflictconsultation/245

답변을 작성하시기 전에 로그인 해주세요.
전체 0 | RSS
QA 내용 검색
  • 개별 목록 구성 제목 답변작성자조회작성일
  • 질문이 없습니다.

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT