주문시 + - 클릭시 소계 보여주기
item.php 페이지에서 상품 주문시
+(증가) 버튼을 클릭해도 바로 옆의 금액은 + 로 되어서 고정이 되어 있는데,
이를 해당 금액만큼 표기하게 수정
+(증가) 나 -(차감) 클릭시, 해당 수량만큼의 소계를 보여줌
================================================================
/js/shop.js 476라인 ~ 480 라인
/js/shop.override.js 155라인 ~ 159 라인
if(type == "0") { // 선택옵션
//total += (it_price + price) * qty;
tmp_price = (it_price + price) * qty;
total += tmp_price;
} else { // 추가옵션
//total += price * qty;
tmp_price = price * qty;
total += tmp_price;
}
$("#sit_opt_added li").eq(index).find("span.sit_opt_prc").empty().html(""+number_format(String(tmp_price))+"원");
// 2020.09.11 중간 오른쪽 화면도 계산을 해야해서 추가함
$("#sit_buy .sit_opt_added li").eq(index).find("span.sit_opt_prc").empty().html(""+number_format(String(tmp_price))+"원");
================================================================
+(증가) 버튼을 클릭해도 바로 옆의 금액은 + 로 되어서 고정이 되어 있는데,
이를 해당 금액만큼 표기하게 수정
+(증가) 나 -(차감) 클릭시, 해당 수량만큼의 소계를 보여줌
================================================================
/js/shop.js 476라인 ~ 480 라인
/js/shop.override.js 155라인 ~ 159 라인
if(type == "0") { // 선택옵션
//total += (it_price + price) * qty;
tmp_price = (it_price + price) * qty;
total += tmp_price;
} else { // 추가옵션
//total += price * qty;
tmp_price = price * qty;
total += tmp_price;
}
$("#sit_opt_added li").eq(index).find("span.sit_opt_prc").empty().html(""+number_format(String(tmp_price))+"원");
// 2020.09.11 중간 오른쪽 화면도 계산을 해야해서 추가함
$("#sit_buy .sit_opt_added li").eq(index).find("span.sit_opt_prc").empty().html(""+number_format(String(tmp_price))+"원");
================================================================
댓글 8개
eoduddld123
5년 전
와우 좋은 정보 감사합니다. 최고네요.
coDribble
5년 전
오... 완전 꿀팁이네요! 감사드립니다!!
DawnDew
5년 전
오 꿀팁 감사합니다. 스크랩해둘께요
5년 전
Uncaught ReferenceError: index is not defined
at price_calculate (shop.js:514)
at HTMLDocument.<anonymous> (item.php?it_id=1598683429:868)
at i (jquery-1.12.4.min.js:2)
at Object.fireWith [as resolveWith] (jquery-1.12.4.min.js:2)
at Function.ready (jquery-1.12.4.min.js:2)
at HTMLDocument.K (jquery-1.12.4.min.js:2)
콘솔에서 이렇게 나오면서 표시가 안되는데 이유가 뭘까요?
514 부분은 올려주신 소스 넣은 것 중
$("#sit_opt_added li").eq(index).find("span.sit_opt_prc").empty().html(""+number_format(String(tmp_price))+"원");
부분입니다
at price_calculate (shop.js:514)
at HTMLDocument.<anonymous> (item.php?it_id=1598683429:868)
at i (jquery-1.12.4.min.js:2)
at Object.fireWith [as resolveWith] (jquery-1.12.4.min.js:2)
at Function.ready (jquery-1.12.4.min.js:2)
at HTMLDocument.K (jquery-1.12.4.min.js:2)
콘솔에서 이렇게 나오면서 표시가 안되는데 이유가 뭘까요?
514 부분은 올려주신 소스 넣은 것 중
$("#sit_opt_added li").eq(index).find("span.sit_opt_prc").empty().html(""+number_format(String(tmp_price))+"원");
부분입니다
5년 전
Uncaught ReferenceError: index is not defined
=> index 를 못찾는듯합니다.
아래소스보시면, function(index) 가 보입니다.
index 를 제대로 가져오는지 확인하세요.
=======================================
$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;
tmp_price = (it_price + price) * qty;
total += tmp_price;
} else { // 추가옵션
//total += price * qty;
tmp_price = price * qty;
total += tmp_price;
}
$("#sit_opt_added li").eq(index).find("span.sit_opt_prc").empty().html(""+number_format(String(tmp_price))+"원");
});
=======================================
=> index 를 못찾는듯합니다.
아래소스보시면, function(index) 가 보입니다.
index 를 제대로 가져오는지 확인하세요.
=======================================
$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;
tmp_price = (it_price + price) * qty;
total += tmp_price;
} else { // 추가옵션
//total += price * qty;
tmp_price = price * qty;
total += tmp_price;
}
$("#sit_opt_added li").eq(index).find("span.sit_opt_prc").empty().html(""+number_format(String(tmp_price))+"원");
});
=======================================
5년 전
감사합니다 있다가 해볼게요 ㅠㅠ 근데 특별히 고친 것도 없는데 왜 index를 못 찾을까요
4년 전
꼭 필요한 수정사항이였는데
정말 감사합니다.^^
정말 감사합니다.^^
Bsori
2년 전
유용한 팁 감사합니다.
게시판 목록
영카트5 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 101 | 10년 전 | 5225 | ||
| 100 | 10년 전 | 5109 | ||
| 99 | 10년 전 | 5396 | ||
| 98 | 10년 전 | 6735 | ||
| 97 |
|
10년 전 | 5434 | |
| 96 | 10년 전 | 3235 | ||
| 95 |
맥콜맛치킨
|
10년 전 | 2899 | |
| 94 | 10년 전 | 6720 | ||
| 93 | 10년 전 | 7942 | ||
| 92 |
RedDJ
|
10년 전 | 6286 | |
| 91 | 10년 전 | 4779 | ||
| 90 | 10년 전 | 6765 | ||
| 89 | 10년 전 | 9941 | ||
| 88 |
|
10년 전 | 5874 | |
| 87 | 10년 전 | 5461 | ||
| 86 |
RedDJ
|
10년 전 | 4455 | |
| 85 | 10년 전 | 5453 | ||
| 84 |
꼬리가보여
|
10년 전 | 7677 | |
| 83 | 10년 전 | 5151 | ||
| 82 | 10년 전 | 6384 | ||
| 81 | 10년 전 | 5685 | ||
| 80 | 10년 전 | 9739 | ||
| 79 |
|
10년 전 | 6587 | |
| 78 | 10년 전 | 15026 | ||
| 77 | 10년 전 | 5693 | ||
| 76 | 10년 전 | 5612 | ||
| 75 | 10년 전 | 8474 | ||
| 74 | 10년 전 | 11519 | ||
| 73 | 10년 전 | 5185 | ||
| 72 | 10년 전 | 11554 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기