You are here

function dc_ajax_add_cart_get_commerce_cart_details in Commerce Ajax Add to Cart 7.2

Same name and namespace in other branches
  1. 7 dc_ajax_add_cart.module \dc_ajax_add_cart_get_commerce_cart_details()

This function returns the current status of cart.

Return value

array Array containing the current status of cart.

4 calls to dc_ajax_add_cart_get_commerce_cart_details()
dc_ajax_add_cart_ajax_cart_form in ./dc_ajax_add_cart.module
AJAX-ify the product add to cart.
dc_ajax_add_cart_block_view in ./dc_ajax_add_cart.module
Implements hook_block_view().
dc_ajax_add_cart_remove_commerce_line_item in ./dc_ajax_add_cart.module
Menu callback: Removes the product item from cart.
dc_ajax_add_cart_update_quantity_refresh in ./dc_ajax_add_cart.module
Callback that will update the quantity of line item.

File

./dc_ajax_add_cart.module, line 385
Ajax add to cart module.

Code

function dc_ajax_add_cart_get_commerce_cart_details() {
  global $user;
  $output = array();
  $order = commerce_cart_order_load($user->uid);
  if ($order) {
    $wrapper = entity_metadata_wrapper('commerce_order', $order);
    $output['order'] = $order;
    $output['wrapper'] = $wrapper;
  }
  else {
    $output['order'] = NULL;
    $output['wrapper'] = NULL;
  }
  return $output;
}