|
@@ -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);
|
|
|
}
|
|
|
}
|