You are here

function uc_payment_get_totals in Ubercart 6.2

Same name and namespace in other branches
  1. 5 payment/uc_payment/uc_payment.module \uc_payment_get_totals()
  2. 7.3 payment/uc_payment/uc_payment.module \uc_payment_get_totals()

Returns a formatted list of line items for an order total preview.

Parameters

$return: TRUE or FALSE to specify whether or not to return the results instead of printing them and exiting.

$order: Optionally pass in a full order object to use instead of finding it in the $_POST data.

Return value

The formatted HTML of the order total preview if $return is set to TRUE.

1 string reference to 'uc_payment_get_totals'
uc_payment_menu in payment/uc_payment/uc_payment.module
Implements hook_menu().

File

payment/uc_payment/uc_payment.module, line 345

Code

function uc_payment_get_totals($return = FALSE, $order = NULL) {
  $output = '';
  if (empty($order) && is_array($_POST) && isset($_POST['order'])) {
    $order = unserialize($_POST['order']);
  }
  if ($order) {
    usort($order->line_items, 'uc_weight_sort');
    $output = theme('uc_payment_totals', $order);
  }
  if ($return) {
    return $output;
  }
  print $output;
  exit;
}