--- uc_cart/uc_cart.module.orig	2008-07-30 00:22:42.000000000 +0200
+++ uc_cart/uc_cart.module	2008-09-07 19:38:08.000000000 +0200
@@ -428,7 +428,7 @@ function uc_cart_user($op, &$edit, &$use
       }
     case 'login':
       // Add items from an anonymous cart to a user's permanent cart on login.
-      uc_cart_login_update($user->uid, session_id());
+      uc_cart_login_update($user->uid, $_SESSION['uc_cart_id'] ? $_SESSION['uc_cart_id'] : '');
       break;
   }
 }
@@ -568,7 +568,7 @@ function uc_cart_checkout_pane() {
 // When a user logs in, update their cart items before the session changes.
 function uc_cart_user_login_form_submit($form_id, $form_values) {
   global $user;
-  uc_cart_login_update($user->uid, session_id());
+  uc_cart_login_update($user->uid, $_SESSION['uc_cart_id'] ? $_SESSION['uc_cart_id'] : '');
 }
 
 // Updates a user's cart to include items from their anonymous session.
@@ -1837,17 +1837,19 @@ function uc_cart_complete_sale($order, $
 }
 
 /**
- * Return the unique cart_id of the user, sid for anonymous and uid for logged in users.
+ * Return the unique cart_id of the user wether she is anonymous or logged in.
  */
 function uc_cart_get_id() {
   global $user;
   if ($user->uid) {
     return $user->uid;
   }
-  elseif ($sid = session_id()) {
-    return $sid;
+  elseif ($cid = $_SESSION['uc_cart_id']) {
+    return $cid;
+  }
+  else {
+    return $_SESSION['uc_cart_id'] = uniqid();
   }
-  // What to do if neither of these work? -RS
 }
 
 /**
