You are here

function theme_uc_payment_totals in Ubercart 6.2

Same name and namespace in other branches
  1. 7.3 payment/uc_payment/uc_payment.theme.inc \theme_uc_payment_totals()

Generates markup for payment totals.

1 theme call to theme_uc_payment_totals()
uc_payment_get_totals in payment/uc_payment/uc_payment.module
Returns a formatted list of line items for an order total preview.

File

payment/uc_payment/uc_payment.module, line 370

Code

function theme_uc_payment_totals($order) {
  $output = t('Order total preview:') . ' <span id="order-total-throbber"></span><table id="uc-order-total-preview">';
  $grand_total = 0;
  $context = array(
    'type' => 'line_item',
    'subject' => array(
      'order' => $order,
    ),
  );
  foreach ($order->line_items as $line) {
    if (!empty($line['title'])) {
      $context['revision'] = 'themed';
      $context['subject']['line_item'] = $line;
      $attributes = drupal_attributes(array(
        'class' => 'line-item-' . $line['type'],
      ));
      $output .= '<tr' . $attributes . '><td align="right"><b>' . filter_xss($line['title']) . ':</b></td>' . '<td align="right">' . uc_price($line['amount'], $context) . '</td></tr>';
      if ($line['summed']) {
        $context['revision'] = 'altered';
      }
    }
  }
  $context['revision'] = 'themed';
  $context['type'] = 'amount';
  unset($context['subject']);
  $output .= '<tr class="line-item-total"><td align="right"><b>' . t('Order total:') . '</b></td>' . '<td align="right">' . uc_price(uc_order_get_total($order), $context) . '</td></tr></table>';
  return $output;
}