diff --git a/lib/classes/shopOrder.class.php b/lib/classes/shopOrder.class.php index b87603111..6575f33e5 100644 --- a/lib/classes/shopOrder.class.php +++ b/lib/classes/shopOrder.class.php @@ -655,11 +655,22 @@ protected function getRate($currency = null) protected function getSubtotal() { $subtotal = 0.0; - foreach ($this->items as $i) { - $subtotal += floatval($i['price']) * intval($i['quantity']); + if(array_key_exists('type', $i)) { + switch ($i['type']) { + case 'product': + $this->formatValues($i, self::$product_fields); + break; + case 'service': + $this->formatValues($i, self::$service_fields); + break; + } + } else { + $i['price'] = $this->formatValue($i['price'], 'float'); + $i['quantity'] = $this->formatValue($i['quantity'], 'int'); + } + $subtotal += $i['price']*$i['quantity']; } - return $subtotal; }