uc_cart_get_id

Versions
5 – 6
uc_cart_get_id()

Return the unique cart_id of the user.

▾ 11 functions call uc_cart_get_id()

hook_update_cart_item in contributions/ubercart/docs/hooks.php
Handle requests to update a cart item.
uc_2checkout_form in contributions/ubercart/payment/uc_2checkout/uc_2checkout.module
Form to build the submission to 2Checkout.com.
uc_cart_add_item in contributions/ubercart/uc_cart/uc_cart.module
Add an item to a user's cart.
uc_cart_complete_sale in contributions/ubercart/uc_cart/uc_cart.module
Complete a sale, including adjusting order status and creating user account.
uc_cart_get_contents in contributions/ubercart/uc_cart/uc_cart.module
Grab the items in a shopping cart for a user.
uc_cart_get_total_qty in contributions/ubercart/uc_cart/uc_cart.module
Return the total number of items in the shopping cart.
uc_cart_links_process in contributions/ubercart/uc_cart_links/uc_cart_links.pages.inc
Process a cart link to fiddle with the cart and redirect the user.
uc_cart_remove_item in contributions/ubercart/uc_cart/uc_cart.module
Remove an item from the cart
uc_google_checkout_cart_request in contributions/ubercart/payment/uc_google_checkout/uc_google_checkout.module
uc_product_kit_update_cart_item in contributions/ubercart/uc_product_kit/uc_product_kit.module
Implementation of hook_update_cart_item().
uc_product_update_cart_item in contributions/ubercart/uc_product/uc_product.module
Implementation of hook_update_cart_item().

Code

contributions/ubercart/uc_cart/uc_cart.module, line 1309

<?php
function uc_cart_get_id() {
  global $user;

  if ($user->uid) {
    return $user->uid;
  }
  elseif (!isset($_SESSION['uc_cart_id'])) {
    $_SESSION['uc_cart_id'] = md5(uniqid(rand(), TRUE));
  }

  return $_SESSION['uc_cart_id'];
}
?>

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.