테스트 사이트 - 개발 중인 베타 버전입니다

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

klee 2년 전 조회 2,403

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

</p>

<p><script>

        $(function() {

            price_calculateusd();

        });

        </script>

        <?php } ?>

    </section>

    <!-- } 선택된 옵션 끝 --></p>

<p>    <!-- 총 구매액 -->

    <div id="sit_tot_priceusd"></div>

    <?php } ?>

 

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

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

</p>

<p>function price_calculateusd()

{

    var it_price = parseInt($("input#it_priceusd").val());</p>

<p>    if(isNaN(it_price))

        return;</p>

<p>    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;</p>

<p>    $el_prc.each(function(index) {

        price = parseInt($(this).val());

        qty = parseInt($el_qty.eq(index).val());

        type = $el_type.eq(index).val();</p>

<p>        if(type == "0") { // 선택옵션

            total += (it_price + price) * qty;

        } else { // 추가옵션

            total += price * qty;

        }

    });</p>

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

}</p>

<p> </p>

<p>
   

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

답변 2개

채택된 답변
+20 포인트

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

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

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

k
klee
2년 전
아래처럼 하면 제품 1개가격은 나오는데 갯수를 늘리면 같이 올라가야되는데 ㅠ 안올라가네요
[code] // 가격계산 - 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))+"$");
}[/code]

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

e
2년 전

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

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

</p>

<p>                <tr class="tr_price"></p>

<p>                    <th scope="row">판매가격</th></p>

<p>                    <td></p>

<p>                        <strong><?php echo display_price(get_price($it)); ?></strong></p>

<p>                        <input type="hidden" id="it_priceusd" value="<?php echo get_price($it); ?>"></p>

<p>                    </td></p>

<p>                </tr></p>

<p>

 

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

k
klee
2년 전
네~! 스킨에서는 물론 변경하였습니다~ 스크립트에러같아서요 ㅠ

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

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

로그인