You are here

function rooms_booking_manager_cart_view in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Display the shopping cart form and associated information.

1 string reference to 'rooms_booking_manager_cart_view'
rooms_booking_manager_menu in modules/rooms_booking_manager/rooms_booking_manager.module
Implements hook_menu().

File

modules/rooms_booking_manager/rooms_booking_manager.module, line 117
Rooms Booking Manager brings together all the pieces required to find a room and book it - including the DrupalCommerce integration

Code

function rooms_booking_manager_cart_view() {
  global $user;

  // Default to displaying an empty message.
  $content = theme('commerce_cart_empty_page');
  commerce_cart_order_refresh(commerce_cart_order_load($user->uid));

  // First check to make sure we have a valid order.
  if ($order = commerce_cart_order_load($user->uid)) {
    $wrapper = entity_metadata_wrapper('commerce_order', $order);

    // Only show the cart form if we found product line items.
    if (commerce_line_items_quantity($wrapper->commerce_line_items, commerce_product_line_item_types()) > 0) {
      drupal_add_css(drupal_get_path('module', 'commerce_cart') . '/theme/commerce_cart.theme.css');

      // Add the form for editing the cart contents.
      $content = commerce_embed_view('booking_cart_form', 'default', array(
        $order->order_id,
      ), 'cart');
    }
  }
  return $content;
}