You are here

function uc_order_load_line_items_display in Ubercart 7.3

Returns an order's line items ordered by weight, prepared for display.

Parameters

$order: An order object whose line items are to be loaded.

Return value

An array of line items, which are arrays containing the following keys:

  • type: The line item type.
  • title: The line item title.
  • amount: The line item amount.
  • weight: The line item weight.
3 calls to uc_order_load_line_items_display()
template_preprocess_uc_order in uc_order/uc_order.module
Preprocesses a formatted invoice with an order's data.
theme_uc_payment_totals in payment/uc_payment/uc_payment.theme.inc
Generates markup for payment totals.
uc_checkout_pane_payment in payment/uc_payment/uc_payment_checkout_pane.inc
@file Checkout pane functions for uc_payment.module.

File

uc_order/uc_order.module, line 1461

Code

function uc_order_load_line_items_display($order) {
  $temp = clone $order;
  $line_items = uc_order_load_line_items($order);
  $temp->line_items =& $line_items;
  $items = _uc_line_item_list();
  foreach ($items as $item) {
    if (!empty($item['display_only'])) {
      $result = $item['callback']('display', $temp);
      if (is_array($result)) {
        foreach ($result as $line) {
          $line_items[] = array(
            'type' => $item['id'],
            'title' => $line['title'],
            'amount' => $line['amount'],
            'weight' => isset($line['weight']) ? $line['weight'] : $item['weight'],
            'data' => isset($line['data']) ? $line['data'] : array(),
          );
        }
      }
    }
  }
  foreach ($line_items as &$item) {
    $item['title'] = check_plain($item['title']);
    $item['formatted_amount'] = uc_currency_format($item['amount']);
  }
  usort($line_items, 'uc_weight_sort');
  return $line_items;
}