Ubercart alpha8, drupal 5.5, mysql 5.0.x
Problem :
Concerning a site with the wanted behaviour of no possible anonymous order.
An authenticated user is under certain circumstances able to validate a cart and a payment ... but the order in the database is saved with the uid = 0 !
Terrible consequences :
the customer/user was able to pay but our admin section could not say who passed this order ! And thus the user never see his order on his order history page.
I observed this 2 or 3 times, I believe the scenario for it to happen is when a user hesitate and comes back on the checkout pages many times with the same cart/order before submitting it to pay it.
Because I really do not need anonymous purchase in my case, I changed the uc_cart_checkout_form_submit() in uc_cart.module to force the $order->uid to be set in the beginning else statement.
function uc_cart_checkout_form_submit($form_id, $form_values) {
global $user;
if (empty($_SESSION['cart_order'])) {
$order = uc_order_new($user->uid);
$_SESSION['cart_order'] = $order->order_id;
}
else {
$order = new stdClass();
$order->order_id = $_SESSION['cart_order'];
// AKAMARVIN MODIF : force the session uid in $order->uid (2008/01/11)
$order->uid = $user->uid;
// END AKAMARVIN MODIF
$order->order_status = uc_order_state_default('in_checkout');
}
(...)
uc_order_save($order);
(...)
}
so the uc_order_save() function is sure to have a complete $order object at this time of the checkout.
And i also changed the uc_order_new() in uc_order.module to disallow the insert of uid = 0.
Feel free to comment my hack and this strange behaviour that should not happen.
Thanks.


I'm still curious to know more about whether or not this is the root issue.

Joined: 11/19/2007