/[drupal]/contributions/modules/uc_coupon/uc_coupon.js
ViewVC logotype

Contents of /contributions/modules/uc_coupon/uc_coupon.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download) (as text)
Thu Apr 30 23:09:25 2009 UTC (6 months, 3 weeks ago) by longwave
Branch: MAIN
CVS Tags: DRUPAL-6--1-1, DRUPAL-6--1-2, DRUPAL-6--1-3, HEAD
Changes since 1.3: +2 -1 lines
File MIME type: text/javascript
Display confirmation message in checkout.
1 function getCoupon() {
2 $('#coupon-message').remove();
3
4 var code = $('#edit-panes-coupon-code');
5
6 $.ajax({
7 type: "POST",
8 url: Drupal.settings.basePath + "?q=cart/checkout/coupon",
9 data: {
10 code: code.val()
11 },
12 dataType: "json",
13 success: function(coupon) {
14 code.parent().next().after('<div id="coupon-message">' + coupon.message + '</div>');
15
16 if (coupon.valid) {
17 if (window.set_line_item) {
18 set_line_item('coupon', coupon.title, -coupon.amount, 2);
19 }
20 }
21 else {
22 if (window.remove_line_item) {
23 remove_line_item('coupon');
24 }
25 }
26
27 if (window.getTax) {
28 getTax();
29 }
30 else if (window.render_line_items) {
31 render_line_items();
32 }
33 }
34 });
35 }

  ViewVC Help
Powered by ViewVC 1.1.2