From 061b111ad09aad4a8551a01628a2412bab3d9e37 Mon Sep 17 00:00:00 2001 From: Luke Policinski Date: Wed, 9 Dec 2015 13:30:44 -0500 Subject: [PATCH 1/3] Update LaraCart.php --- src/LaraCart.php | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/src/LaraCart.php b/src/LaraCart.php index b7f0027..1126d2b 100644 --- a/src/LaraCart.php +++ b/src/LaraCart.php @@ -95,7 +95,7 @@ public function formatMoney($number, $locale = null, $internationalFormat = null return money_format($internationalFormat ? '%i' : '%n', $number); } - return number_format($number, 2); + return number_format($number, 2, '.', ''); } /** @@ -461,11 +461,7 @@ public function feeTotals($format = true) } } - if ($format) { - return $this->formatMoney($feeTotal); - } - - return number_format($feeTotal, 2); + return $this->formatMoney($feeTotal, null, null, $format); } /** @@ -503,11 +499,8 @@ public function taxTotal($format = true) { $totalTax = $this->total(false, false) - $this->subTotal(false, false, false) - $this->feeTotals(false); - if ($format) { - return $this->formatMoney($totalTax); - } - return number_format($totalTax, 2); + return $this->formatMoney($totalTax, null, null, $format); } /** @@ -524,6 +517,7 @@ public function subTotal($tax = false, $format = true, $withDiscount = true) $total = 0; if ($this->count() != 0) { foreach ($this->getItems() as $item) { + dump($item->subTotal(false, false, $withDiscount)); $total += $item->subTotal($tax, false, $withDiscount); } } @@ -532,8 +526,7 @@ public function subTotal($tax = false, $format = true, $withDiscount = true) return $this->formatMoney($total); } - - return number_format($total, 2); + return $this->formatMoney($total, null, null, $format); } /** @@ -552,10 +545,6 @@ public function total($format = true, $withDiscount = true) $total -= $this->totalDiscount(false); } - if ($format) { - return $this->formatMoney($total); - } - - return number_format($total, 2); + return $this->formatMoney($total, null, null, $format); } } From 89d012b89fb4bd45453e07fe4e9e18d9858437b8 Mon Sep 17 00:00:00 2001 From: Luke Policinski Date: Wed, 9 Dec 2015 13:32:17 -0500 Subject: [PATCH 2/3] Update LaraCart.php --- src/LaraCart.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/LaraCart.php b/src/LaraCart.php index 1126d2b..fe3b512 100644 --- a/src/LaraCart.php +++ b/src/LaraCart.php @@ -517,7 +517,6 @@ public function subTotal($tax = false, $format = true, $withDiscount = true) $total = 0; if ($this->count() != 0) { foreach ($this->getItems() as $item) { - dump($item->subTotal(false, false, $withDiscount)); $total += $item->subTotal($tax, false, $withDiscount); } } From 30f712a94cef6c6f4e1613b1248cb819d7a1251f Mon Sep 17 00:00:00 2001 From: Luke Policinski Date: Wed, 9 Dec 2015 13:34:41 -0500 Subject: [PATCH 3/3] Update LaraCart.php --- src/LaraCart.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/LaraCart.php b/src/LaraCart.php index fe3b512..6d598bf 100644 --- a/src/LaraCart.php +++ b/src/LaraCart.php @@ -480,11 +480,7 @@ public function totalDiscount($format = true) } - if ($format) { - return $this->formatMoney($total); - } - - return $total; + return $this->formatMoney($total, null, null, $format); } @@ -521,10 +517,6 @@ public function subTotal($tax = false, $format = true, $withDiscount = true) } } - if ($format) { - return $this->formatMoney($total); - } - return $this->formatMoney($total, null, null, $format); }