등급별 할인 제작중.. shop.override.js 수정관련

등급별 할인 제작중.. shop.override.js 수정관련

QA

등급별 할인 제작중.. shop.override.js 수정관련

답변 1

본문

안녕하세요.

등급별 할인 작업 중에 있습니다.

옵션별로 할인을 별도로 주기위해서 작업중인데요.

 

막히는 지점이 있어서 문의 합니다.

아래 소수 추가부분에서 g5_shop_item_option 테이블에 io_price말고 새롭게 io_price_grade3

이런 변수를 추가했습니다.

 

해당 소스에서 g5_shop_item_option 테이블의 io_price_grade3 값을 읽어오고싶은데

어떻게 일어올수있을까요? 웹이랑 자바 비전공자라서 잘 모르겠습니다.

기본 item테이블의 it_price같은경우 

"var opt_prc_total = parseInt($("input#it_price").val());"

 

이렇게 추가했습니다. (다른곳 소스보고)

g5_shop_item_option의 price의경우 price=a[3], 식으로 매개변수로 가져오던데

이 매게변수 세팅하는 방법 혹은 해당 함수내에서 g5_shop_item_option 테이블내의

다른 값을 가져오는 방법이 궁금합니다.

 

미리 감사드립니다.

 

 

       add_sel_option = (function() {
            var cached_function = add_sel_option;

            return function() {
                
                if( $(".2017_renewal_itemform").length ){
                    var a = arguments;
                    var type=a[0],
                        id=a[1],
                        option=a[2],
                        price=a[3],
                        stock=a[4];
                    var item_code = $("input[name='it_id[]']").val();
                    var opt = "";
                    var li_class = "sit_opt_list";
                    if(type)
                        li_class = "sit_spl_list";

                    var opt_prc;
                    if(parseInt(price) >= 0)
                        opt_prc = "+"+number_format(String(price))+"원";
                    else
                        opt_prc = number_format(String(price))+"원";

  //-------------------------------------------------------------------

//소스 추가부분
                    var opt_prc_total = parseInt($("input#it_price").val());
                    if(type == "0") { // 선택옵션
                     opt_prc_total = parseInt(price ) + parseInt(opt_prc_total) ;
                        } else { // 추가옵션
                        opt_prc_total = parseInt(price) ;
                        }
                      

                    opt_prc_total = parseInt(opt_prc_total);
                    opt_prc_total = number_format(String(opt_prc_total))+"원";
                    val_opt_prc_total = parseInt(opt_prc_total.replace(',', ''))
                    console.log(opt_prc_total);
  //-----------------------------------------------------------------------------

이 질문에 댓글 쓰기 :

답변 1

상품 옵션을 추가하면 될것같고 소스 추가 부분 저렇게 하셔도 되요 다른값들도 상품 상세에서 옵션을 따로 넣어서 폼 서브밋 하게 되면 자바스크립트로 제어를 해야되요 

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 8
© SIRSOFT
현재 페이지 제일 처음으로