가격 달러 표시 스크립트 한번 봐주세요 ㅠ

가격 달러 표시 스크립트 한번 봐주세요 ㅠ

QA

가격 달러 표시 스크립트 한번 봐주세요 ㅠ

본문

it_priceusd 라는 필드를 만들어서 원화랑 별도로 usd 달러로 표시하고 싶은데 item.skin.form 하단부분에 (320번째줄) 총금액 표시하는 부분을 total이랑  필드에 설정한 usd 달러로 표시하고 싶은데 / 필드는 전부 추가했고 관리자화면에서는 달러화 전부 출력이 됩니다.



<script>
        $(function() {
            price_calculateusd();
        });
        </script>
        <?php } ?>
    </section>
    <!-- } 선택된 옵션 끝 -->
    <!-- 총 구매액 -->
    <div id="sit_tot_priceusd"></div>
    <?php } ?>

 

경로를 따라가보니  shop.js  (424열)부분이 연결된것같아 이부분을 수정하고 있습니다. it_priceusd 라는 필드를 js 부분에 적용하려면 아래처럼 손보면 출력이 안되는데 어떻게 만져야할까요?   it_price 부분을 단순히->it_priceusd로 바꾸면 안되더라구요 ㅠ 

새로 만들 필드를 자바스크립트에 연결하려면 어떻게 해야할지 도움을 요청합니다. 
 


function price_calculateusd()
{
    var it_price = parseInt($("input#it_priceusd").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_priceusd").empty().html("<span>TOTAL PRICE :</span> "+number_format(String(total))+"USD");
}
 
 
 

이 질문에 댓글 쓰기 :

답변 2

id는 하나만 적용되는 거 아닌가요?

$("input#it_priceusd") 를 $("input[id=it_priceusd]") 로 바꾸면 될 수도 있지 않을까요??

아래처럼 하면 제품 1개가격은 나오는데 갯수를 늘리면 같이 올라가야되는데 ㅠ 안올라가네요

 // 가격계산 - usd 
function price_calculateusd()
{
    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_priceusd").empty().html("<span>TOTAL PRICE :</span> "+number_format(String(total))+"$");
}

skin\shop\basic\item.form.skin.php 또는

theme\basic\skin\shop\basic\item.form.skin.php 파일에서 it_price 부분은 수정하셨나요??


                <tr class="tr_price">
                    <th scope="row">판매가격</th>
                    <td>
                        <strong><?php echo display_price(get_price($it)); ?></strong>
                        <input type="hidden" id="it_priceusd" value="<?php echo get_price($it); ?>">
                    </td>
                </tr>

 

답변을 작성하시기 전에 로그인 해주세요.
전체 123,128 | RSS
QA 내용 검색

회원로그인

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