function uc_order_get_total in Ubercart 5
Same name and namespace in other branches
- 6.2 uc_order/uc_order.module \uc_order_get_total()
- 7.3 uc_order/uc_order.module \uc_order_get_total()
Calculate up an order's total!
6 calls to uc_order_get_total()
- uc_cart_checkout_form_validate in uc_cart/
uc_cart.module - uc_line_item_subtotal in uc_order/
uc_order_line_item.inc - Handle the subtotal line item.
- uc_line_item_total in uc_order/
uc_order_line_item.inc - Handle the total line item.
- uc_order_load in uc_order/
uc_order.module - Load an order from the database.
- uc_order_save in uc_order/
uc_order.module - Save an order to the database.
File
- uc_order/
uc_order.module, line 2833
Code
function uc_order_get_total($order, $products_only = FALSE) {
$total = 0;
if (is_array($order->products)) {
foreach ($order->products as $product) {
$total += $product->price * $product->qty;
}
}
if ($products_only) {
return $total;
}
$total += uc_line_items_calculate($order);
$result = module_invoke_all('order', 'total', $order, NULL);
foreach ($result as $key => $value) {
$total += $value;
}
return $total;
}