diff --git a/app/Models/ShopProduct.php b/app/Models/ShopProduct.php index 12b870a2..8e8a2260 100644 --- a/app/Models/ShopProduct.php +++ b/app/Models/ShopProduct.php @@ -80,7 +80,9 @@ class ShopProduct extends Model public function getPriceAfterDiscount() { - return number_format($this->price - ($this->price * PartnerDiscount::getDiscount() / 100), 2); + $discountRate = PartnerDiscount::getDiscount() / 100; + $discountedPrice = $this->price * (1 - $discountRate); + return round($discountedPrice, 2); } /** @@ -90,7 +92,8 @@ class ShopProduct extends Model */ public function getTaxValue() { - return number_format($this->getPriceAfterDiscount() * $this->getTaxPercent() / 100, 2); + $taxValue = $this->getPriceAfterDiscount() * $this->getTaxPercent() / 100; + return round($taxValue, 2); } /** @@ -100,6 +103,7 @@ class ShopProduct extends Model */ public function getTotalPrice() { - return number_format($this->getPriceAfterDiscount() + $this->getTaxValue(), 2); + $total = $this->getPriceAfterDiscount() + $this->getTaxValue(); + return round($total, 2); } } diff --git a/themes/default/views/store/checkout.blade.php b/themes/default/views/store/checkout.blade.php index b0f91f0d..6a0d28b2 100644 --- a/themes/default/views/store/checkout.blade.php +++ b/themes/default/views/store/checkout.blade.php @@ -237,7 +237,7 @@ payment_method: '', coupon_code: '', submitted: false, - totalPrice: {{ $discountedprice }}, + totalPrice: {{ $total }}, couponDiscountedValue: 0,