You are here

function uc_payment_get_totals in Ubercart 5

Same name and namespace in other branches
  1. 6.2 payment/uc_payment/uc_payment.module \uc_payment_get_totals()
  2. 7.3 payment/uc_payment/uc_payment.module \uc_payment_get_totals()
1 string reference to 'uc_payment_get_totals'
uc_payment_menu in payment/uc_payment/uc_payment.module
Implementation of hook_menu().

File

payment/uc_payment/uc_payment.module, line 548

Code

function uc_payment_get_totals() {
  if (is_array($_POST)) {
    foreach ($_POST as $key => $value) {
      $totals[$key] = explode(';', $value);
    }
  }
  if (is_array($totals) && count($totals) > 0) {
    usort($totals, '_total_sort');
    $output = t('Order total preview:') . ' <span id="order-total-throbber"></span><table>';
    $grand_total = 0;
    foreach ($totals as $line) {
      if (!empty($line[2])) {
        $output .= '<tr><td align="right"><b>' . $line[2] . ':</b></td>' . '<td align="right">' . uc_currency_format($line[1]) . '</td></tr>';
        if ($line[3]) {
          $grand_total += round($line[1], 2);
        }
      }
    }
    $output .= '<tr><td align="right"><b>' . t('Order total:') . '</b></td>' . '<td align="right">' . uc_currency_format($grand_total) . '</td></tr></table>';
  }
  print $output;
  exit;
}