From f756f830f8ca6b4f3abc7b6078b59b6a063cec3f Mon Sep 17 00:00:00 2001 From: A1Gard Date: Tue, 13 Jun 2023 05:38:03 +0330 Subject: [PATCH] fix bug for discount --- app/Models/Product.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Models/Product.php b/app/Models/Product.php index 09542ee..768bee6 100755 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -270,6 +270,13 @@ class Product extends Model implements HasMedia return $def; } + public function getOldPrice() + { + if ($this->getPurePrice() == 0) { + return __('Call us!'); + } + return number_format($this->price) . ' ' . config('app.currency_type'); + } public function getPrice() { if ($this->getPurePrice() == 0) { @@ -290,7 +297,7 @@ class Product extends Model implements HasMedia function hasDiscount() { - return $this->discounts()->where('expire', '>', \DB::raw('NOW()'))->count() > 1; + return $this->discounts()->where('expire', '>', \DB::raw('NOW()'))->count() > 0; } public function isFav()