6 replies [Last post]
michels's picture
Offline
Uber DonorBug FinderInternationalizationizer
Joined: 08/12/2007
Juice: 205
Was this information Helpful?

Hey there.

I waste a whole day by debugging a strange behaviour in IE. I updated a site from RC4 to 1.0, after that everything went fine. Today I noticed, that IE-Users can't finish the checkout process. Respectively they can finish the checkout process, but they don't get an Order-ID and the order stays in "in_checkout" state.

While debugging I detect, that in the step between cart/checkout/review and cart/checkout/complete the $_SESSION[cart_order] gets lost.

In theme_uc_cart_checkout_review() $_SESSION[cart_order] is still set. But in uc_cart_checkout_review_form_submit() $_SESSION[cart_order] doesn't exist. Therefore $order = uc_order_load($_SESSION['cart_order']) (~line 1678) can't work corectly. I point that out by writing print_r($_SESSION) in both functions.

The result is, that the IE-User gets a message similar to "Order is complete, Your Order-ID is: ... " without a number. In the database the order_status is still "in_checkout".

I have NO idea where to search. In Firefox/Opera everything works well. And in IE only the $_SESSION[cart_order] gets lost, not the whole session.

I could understand it, if the whole session gets lost, then it would be a browser problem. And I would understand it, if a Session variable gets lost in every browser, then it would be a code problem. But one variable? And just in one browser?

I'm very thankful for every hint!

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Strange checkout-problem with Internet Explorer

Hmm... thanks for the info. Someone else posted this sort of issue, but I had no clue where to start looking. There seems to be a lead here, so I'm going to redirect that thread here.

I'm curious if there's anything that's possibly trying to load in IE that fails and "loads" /cart where the cart_order session variable gets unset. This may be the case, and solarian has submitted a patch that I haven't had a chance to test out yet.

You need to add this code to the top of uc_cart_view() in uc_cart.module:

<?php
 
// Failsafe so that this function only works when called with no arguments.
  // This prevents the accidental wiping of the cart_order session variable.
 
if ((func_num_args() > 0)) {
    return
drupal_not_found();
  }
?>

Let me know if that gets you anywhere.

michels's picture
Offline
Uber DonorBug FinderInternationalizationizer
Joined: 08/12/2007
Juice: 205
Re: Re: Strange checkout-problem with Internet Explorer

Thanks for your quick reply.

The code seems to have no effect.
For debugging I wrote under every unset($_SESSION['cart_order']) a drupal_set_message("UNSET LINE XYZ");

But I can't detect any differences between the browsers. The only unset between /review and /complete is called in uc_cart_complete_sale():

~line 1840: unset($_SESSION['cart_order'], $_SESSION['do_complete'], $_SESSION['new_user']);"

And that's ok.

I'm not even sure if this is a browser, an ubercart or a module problem.

michels's picture
Offline
Uber DonorBug FinderInternationalizationizer
Joined: 08/12/2007
Juice: 205
Re: Re: Re: Strange checkout-problem with Internet Explorer

Ok, I found the problem in uc_cart_checkout_form():

<?php
  $referer
= referer_uri();
  if (
substr($referer, -20, 20) == 'cart/checkout/review' || substr($referer, -13, 13) == 'cart/checkout') {
    if (
$order == FALSE || uc_order_status_data($order->order_status, 'state') != 'in_checkout') {
       unset(
$_SESSION['cart_order']);
     
$order = NULL;
    }
    if (
uc_order_status_data($order->order_status, 'state') != 'in_checkout' || ($user->uid > 0 && $user->uid != $order->uid)) {
     
$order = NULL;
    }
  }
  else {
   
//@problem unset($_SESSION['cart_order']);
 
}
?>

For now it solves my problem when I comment out unset($_SESSION['cart_order']);

Reasons? Dunno..
Do you see any problems by commenting in out?

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Re: Strange checkout-problem with Internet Explorer

Ahh, something about the HTTP Referer is different from IE to FF. I was actually just about to review and implement the patch here or some similar solution. The idea is to check w/ another variable where the user is coming from instead of relying on HTTP Referer.

mrimagineer's picture
Offline
Joined: 12/14/2009
Juice: 4
After two Boylston

After two Boylston Technology Group developers and a few hours, we found the cause of this issue.

Client Issue
A small subset of purchases being made in Internet Explorer are experiencing glitches. It happens sporadically; some orders go through, some others get an issue that when they click "Review Order", the checkout page refreshes and does not advance to a page where the user can complete the order.

Ubercart Issue
Ubercart makes 2 calls every second for shipping quote via uc_quote.js, line 101:

progress.startMonitoring(Drupal.settings.basePath + "?q=cart/checkout/shipping/quote", 0);

Resulting in:

#fa331ba4 T+0.010000 [RESPNSE] 2009-12-14 09:45:55.203684 200 OK
#fa756594 T=0.000000 [REQUEST] 2009-12-14 09:45:59.353684 GET /?q=cart/checkout/shipping/quote HTTP/1.1
#fa756594 T+0.010000 [RESPNSE] 2009-12-14 09:45:59.353684 200 OK
#fa9cb894 T=0.000000 [REQUEST] 2009-12-14 09:46:01.833684 GET /?q=cart/checkout/shipping/quote HTTP/1.1
#fa9cb894 T+0.010000 [RESPNSE] 2009-12-14 09:46:01.833684 200 OK
#fab64ff4 T=0.000000 [REQUEST] 2009-12-14 09:46:03.413684 GET /?q=cart/checkout/shipping/quote HTTP/1.1
#fab64ff4 T+0.010000 [RESPNSE] 2009-12-14 09:46:03.413684 200 OK

Ubercart queries on a timer interval instead of on event basis, such as a change in address field. It also queries twice, once for shipping address and once for billing address, which serves no purpose.

The issue becomes more apparent when the order is bigger, as the shipping calculation takes longer to load, resulting in an increased chance of failure.

Solution
After investigation, the issue boils down to this: In internet explorer, it fails if you press submit while it is still loading the shipping quote. The entire shipping section should be reworked so that the calculation is done properly, however we'll leave that up to Ubercart developers.

Until then, there are two fixes:

  • Adding a delay of 15 seconds serves as a temporary solution, or
  • Disable JS Shipping calculation in /admin/store/settings/checkout/edit/panes
  • Thanks to our team here at Boylston Technology Group for narrowing down this issue!

    TR
    TR's picture
    Offline
    Bug FinderFAQ ModeratorGetting busy with the Ubercode.
    Joined: 11/05/2007
    Juice: 3424
    Re: After two Boylston

    I responded to mrimagineer's post in another thread where he made the exact same post: http://www.ubercart.org/forum/support/11370/cant_checkout_losing_session...

    Please follow-up in that other thread, not here.

    <tr>.