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

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


Copy
<script>
        $(function() {
            price_calculateusd();
        });
        </script>
        <?php } ?>
    </section>
    <!-- } 선택된 옵션 끝 -->

    <!-- 총 구매액 -->
    <div id="sit_tot_priceusd"></div>
    <?php } ?>

 

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

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

Copy
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개

채택된 답변
+20 포인트

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

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

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

답변에 대한 댓글 1개

아래처럼 하면 제품 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]

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

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

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

Copy
<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>

 

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

답변에 대한 댓글 1개

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

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

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

로그인
🐛 버그신고