You are here

function uc_cart_checkout_review in Ubercart 6.2

Same name and namespace in other branches
  1. 5 uc_cart/uc_cart.module \uc_cart_checkout_review()
  2. 7.3 uc_cart/uc_cart.pages.inc \uc_cart_checkout_review()

Allows a customer to review their order before finally submitting it.

See also

uc_cart_checkout_form()

1 string reference to 'uc_cart_checkout_review'
uc_cart_menu in uc_cart/uc_cart.module
Implements hook_menu().

File

uc_cart/uc_cart.pages.inc, line 363
Cart menu items.

Code

function uc_cart_checkout_review() {
  drupal_add_js(drupal_get_path('module', 'uc_cart') . '/uc_cart.js');
  $form = drupal_get_form('uc_cart_checkout_review_form');
  if ($_SESSION['do_review'] !== TRUE && !uc_referer_check(array(
    'cart/checkout',
  ))) {
    drupal_goto('cart/checkout');
  }
  unset($_SESSION['do_review']);
  $order = uc_order_load($_SESSION['cart_order']);
  if ($order === FALSE || uc_order_status_data($order->order_status, 'state') != 'in_checkout') {
    unset($_SESSION['cart_order']);
    drupal_goto('cart/checkout');
  }
  $panes = _checkout_pane_list();

  // If the cart isn't shippable, bypass panes with shippable == TRUE.
  if (!uc_cart_is_shippable() && variable_get('uc_cart_delivery_not_shippable', TRUE)) {
    $panes = uc_cart_filter_checkout_panes($panes, array(
      'shippable' => TRUE,
    ));
  }
  foreach ($panes as $pane) {
    if ($pane['enabled']) {
      $func = $pane['callback'];
      if (function_exists($func)) {
        $return = $func('review', $order, NULL);
        if (!is_null($return)) {
          $data[$pane['title']] = $return;
        }
      }
    }
  }
  $output = theme('uc_cart_checkout_review', $data, $form);
  return $output;
}