diff --git a/src/models/ShopOrder.php b/src/models/ShopOrder.php index 24252ee..ac177e8 100644 --- a/src/models/ShopOrder.php +++ b/src/models/ShopOrder.php @@ -1771,7 +1771,7 @@ public function getDiscount_percent() { $percent = 0; - if ($this->discount_amount) { + if ($this->discount_amount && $this->moneyItems->amount) { $percent = $this->discount_amount * 100 / (float)$this->moneyItems->amount; } diff --git a/src/models/ShopOrderItem.php b/src/models/ShopOrderItem.php index 413af67..ab4d961 100644 --- a/src/models/ShopOrderItem.php +++ b/src/models/ShopOrderItem.php @@ -562,7 +562,7 @@ public function getDiscount_percent() { $percent = 0; - if ($this->discount_amount) { + if ($this->discount_amount && $this->amount) { $percent = $this->discount_amount * 100 / $this->amount; }