Page not updating when I click "Apply Coupon"

vood002 - March 3, 2009 - 17:54
Project:Ubercart Discount Coupons
Version:5.x-1.7
Component:Code
Category:bug report
Priority:normal
Assigned:longwave
Status:closed
Description

I upgraded to 1.7 and when I tested the "apply coupon" code didn't work. I didn't get any Javascript errors and no errors are logged. I'm using the latest build of Drupal (5.16). In the source code the script appears to be at the correct location, it is showing:

<script type="text/javascript" src="/sites/all/modules/uc_coupon/uc_coupon.js?98999"></script>

I tested this in Firefox and IE7 on three different computers and had the same result. I've reverted back to uc_coupon 1.6 and it is working fine. If I can provide any other information please let me know.

#1

vood002 - March 3, 2009 - 17:54

Sorry, make that the "Apply Coupon" Button, not Code. Upon clicking it nothing happens on the page.

#2

longwave - March 5, 2009 - 22:38

Do you have the order total preview pane enabled? Clicking the button updates that pane in the same way as selecting a shipping option does, and the coupon should still be applied on the review order stage - is this working correctly?

#3

vood002 - March 10, 2009 - 00:23

Thank you for the response Longwave.

The Total Preview Pane is indeed enabled. When I select "calculate shipping" this pane updates like it should, however, when I try to apply a coupon code it does not. I just threw 1.7 back on to test again with the same result.

This is happening on Firefox for Mac and PC, as well as IE7 for PC, so i think it's safe to say that it isn't a browser issue in my case.
I'm going to leave 1.7 active on my site as I've only handed out a couple of coupons. The site is http://www.sportsciencelab.com, an available 15% off coupon is MARCHMADNESS. If I press "Review Order" without entering CC details then the pane will return updated.

Here is all the js from the head, as my first guess is that something here must be interfering with the uc_coupon script...If you have a hunch that any particular module's JS is causing the issue let me know and I'll test it out.

<script type="text/javascript" src="/misc/jquery.js"></script>
<script type="text/javascript" src="/misc/drupal.js"></script>
<script type="text/javascript" defer="defer" src="/sites/all/modules/admin_menu/admin_menu.js"></script>
<script type="text/javascript" src="/sites/all/modules/admin_menu_dropdown/admin_menu_dropdown.js"></script>
<script type="text/javascript" src="/sites/all/modules/date/date_timezone/date_timezone.js"></script>
<script type="text/javascript" src="/sites/all/modules/thickbox/thickbox.js"></script>

<script type="text/javascript" src="/sites/all/modules/panels/js/panels.js"></script>
<script type="text/javascript" src="/sites/all/modules/devel/devel.js"></script>
<script type="text/javascript" src="/misc/textarea.js"></script>
<script type="text/javascript" src="/misc/collapse.js"></script>
<script type="text/javascript" src="/sites/all/modules/ubercart/uc_cart/uc_cart_block.js?80366"></script>
<script type="text/javascript">Drupal.extend({ settings: { "admin_menu": { "margin_top": 1 }, "thickbox": { "close": "Close", "next": "Next \x3e", "prev": "\x3c Prev", "esc_key": "or Esc Key", "next_close": "Next / Close on last", "image_count": "Image !current of !total" }, "base_path": "/" } });</script>
<script type="text/javascript">hidden = 0; visibilityCombo = 'ctrl + alt'; disableCombo = 'ctrl + alt + shift';</script>
<script type="text/javascript">
    addthis_pub = 'my-username';
    addthis_logo = 'http://www.addthis.com/images/yourlogo.png';
    addthis_logo_background = 'EFEFFF';
    addthis_logo_color = '666699';
    addthis_brand = 'SSL';
    addthis_options = 'favorites, email, stumbleupon, digg, delicious, myspace, facebook, google, live, more';
</script>
<script type="text/javascript">var collapsed_block = true;</script>

<script type="text/javascript">var uc_cart_path = '/sites/all/modules/ubercart/uc_cart';</script>

There is also a ga tracking code in the closure.

#4

longwave - March 10, 2009 - 01:19
Assigned to:Anonymous» longwave

Thanks for the detailed bug report and link to your site that demonstrates the issue, I wouldn't have tracked it down without those!

It turns out this is due to an unexpected interaction between the Secure Pages module and uc_coupon.js. The AJAX request is a GET to the https URL, and Secure Pages intercepts this and sends a redirect to the http URL, but this is not handled by the JavaScript code.

I think the correct fix for this is switch the AJAX request to a POST, this is what the other checkout AJAX calls use. This needs to be done for both 5.x and 6.x releases, and I will try to find time to fix this in the near future. Adding cart/checkout/coupon/* to the "Ignore pages" Secure Pages setting should work around this for now.

#5

vood002 - March 10, 2009 - 18:34

Sweet--happy to help of course---and it is working fine after adding cart/checkout/coupon/* to ignore pages.

#6

longwave - April 8, 2009 - 00:46
Status:active» fixed

Fix committed to both branches.

#7

System Message - April 22, 2009 - 00:50
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.