You are here

function basic_cart_checkout in Basic cart 7.2

Same name and namespace in other branches
  1. 7 basic_cart.cart.inc \basic_cart_checkout()

Checkout form implementation.

1 string reference to 'basic_cart_checkout'
basic_cart_menu in ./basic_cart.module
Implements hook_menu().

File

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

Code

function basic_cart_checkout() {
  $shopping_cart = basic_cart_get_cart();

  // Price.
  $price = basic_cart_get_total_price();
  $total = basic_cart_price_format($price->total);
  $options = array(
    'cart' => $shopping_cart,
    'price' => $total,
  );

  // Checking the VAT.
  $vat_is_enabled = (int) variable_get('basic_cart_vat_state');
  if (!empty($vat_is_enabled) && $vat_is_enabled) {
    $options['vat'] = basic_cart_price_format($price->vat);
  }

  // The flat cart (just the listing part).
  $cart = theme('basic_cart_cart_flat', $options);

  // If the cart is empty, we don't want to show the checkout form.
  if (empty($shopping_cart)) {
    return $cart;
  }
  $form = drupal_get_form('basic_cart_checkout_form');
  $form = drupal_render($form);
  return $cart . $form;
}