You are here

function basic_cart_get_cart in Basic cart 7.3

Same name and namespace in other branches
  1. 8.6 basic_cart.inc \basic_cart_get_cart()
  2. 8 basic_cart.inc \basic_cart_get_cart()
  3. 8.0 basic_cart.inc \basic_cart_get_cart()
  4. 8.2 basic_cart.inc \basic_cart_get_cart()
  5. 8.3 basic_cart.inc \basic_cart_get_cart()
  6. 8.4 basic_cart.inc \basic_cart_get_cart()
  7. 8.5 basic_cart.inc \basic_cart_get_cart()
  8. 7 basic_cart.cart.inc \basic_cart_get_cart()
  9. 7.2 basic_cart.cart.inc \basic_cart_get_cart()

Function for shopping cart retrieval.

Parameters

int $nid: We are using the node id to store the node in the shopping cart

Return value

mixed Returning the shopping cart contents. An empty array if there is nothing in the cart

10 calls to basic_cart_get_cart()
basic_cart_add_to_cart in ./basic_cart.cart.inc
Callback function for cart/add/.
basic_cart_block_view in ./basic_cart.module
Implements hook_block_view().
basic_cart_cart in ./basic_cart.cart.inc
Callback function for cart listing.
basic_cart_cart_form in ./basic_cart.cart.inc
Shopping cart form.
basic_cart_get_total_price in ./basic_cart.cart.inc
Returns the final price for the shopping cart.

... See full list

File

./basic_cart.cart.inc, line 168
Basic cart shopping cart implementation functions.

Code

function basic_cart_get_cart($nid = NULL) {
  if (isset($nid)) {
    return $_SESSION['basic_cart']['cart'][$nid];
  }
  if (isset($_SESSION['basic_cart']['cart'])) {
    return $_SESSION['basic_cart']['cart'];
  }

  // Empty cart.
  return array();
}