function uc_order_get_total in Ubercart 7.3
Same name and namespace in other branches
- 5 uc_order/uc_order.module \uc_order_get_total()
- 6.2 uc_order/uc_order.module \uc_order_get_total()
Calculates an order's total.
6 calls to uc_order_get_total()
- UbercartCartCheckoutTestCase::createOrder in uc_cart/
tests/ uc_cart.test - Creates a new order.
- UbercartCreditCardTestCase::createOrder in payment/
uc_credit/ tests/ uc_credit.test - Helper function. Creates a new order.
- UcOrderController::attachLoad in uc_order/
uc_order.controller.inc - Attaches data to entities upon loading.
- uc_line_item_subtotal in uc_order/
uc_order.line_item.inc - Handles the subtotal line item.
- uc_line_item_total in uc_order/
uc_order.line_item.inc - Handles the total line item.
1 string reference to 'uc_order_get_total'
- uc_order_entity_property_info in uc_order/
uc_order.info.inc - Implements hook_entity_property_info().
File
- uc_order/
uc_order.module, line 1660
Code
function uc_order_get_total($order, $products_only = FALSE) {
$total = 0;
if ($order === FALSE) {
return $total;
}
if (is_array($order->products)) {
foreach ($order->products as $product) {
$qty = $product->qty ? $product->qty : 1;
$total += $product->price * $qty;
}
}
if ($products_only) {
return $total;
}
$total += uc_line_items_calculate($order);
foreach (module_implements('uc_order') as $module) {
$function = $module . '_uc_order';
// $order must be passed by reference.
if (function_exists($function) && ($value = $function('total', $order, NULL)) && is_numeric($value)) {
$total += $value;
}
}
return $total;
}