You are here

function uc_cart_checkout_review in Ubercart 5

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

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

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

File

uc_cart/uc_cart.module, line 1557

Code

function uc_cart_checkout_review() {
  $form = drupal_get_form('uc_cart_checkout_review_form');
  if ($_SESSION['do_review'] !== TRUE && !uc_referer_check('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');
  }

  // Patched by quicksketch for IE compatibility and better handling!
  if (variable_get('uc_cart_submit_disable', TRUE)) {
    uc_add_js(drupal_get_path('module', 'uc_cart') . '/uc_cart.js');
  }
  $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 (variable_get('uc_pane_' . $pane['id'] . '_enabled', TRUE)) {
      $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', $help, $data, $form);
  return $output;
}