You are here

function uc_cart_checkout_review in Ubercart 7.3

Same name and namespace in other branches
  1. 5 uc_cart/uc_cart.module \uc_cart_checkout_review()
  2. 6.2 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()

2 string references to 'uc_cart_checkout_review'
uc_cart_menu in uc_cart/uc_cart.module
Implements hook_menu().
uc_cybersource_page_alter in payment/uc_cybersource/uc_cybersource.module
Implements hook_page_alter().

File

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

Code

function uc_cart_checkout_review() {
  drupal_add_js(drupal_get_path('module', 'uc_cart') . '/uc_cart.js');
  if (empty($_SESSION['cart_order']) || empty($_SESSION['uc_checkout'][$_SESSION['cart_order']]['do_review'])) {
    drupal_goto('cart/checkout');
  }
  $order = uc_order_load($_SESSION['cart_order']);
  if ($order === FALSE || uc_order_status_data($order->order_status, 'state') != 'in_checkout') {
    unset($_SESSION['uc_checkout'][$order->order_id]['do_review']);
    drupal_goto('cart/checkout');
  }
  elseif (!uc_order_product_revive($order->products)) {
    drupal_set_message(t('Some of the products in this order are no longer available.'), 'error');
    drupal_goto('cart');
  }
  $panes = _uc_checkout_pane_list();

  // If the cart isn't shippable, bypass panes with shippable == TRUE.
  if (!uc_order_is_shippable($order) && 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;
        }
      }
    }
  }
  $build = array(
    '#theme' => 'uc_cart_checkout_review',
    '#panes' => $data,
    '#form' => drupal_get_form('uc_cart_checkout_review_form', $order),
  );
  return $build;
}