From 0c291869eb96fc3d78914004aefcc67b563dc41e Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Tue, 1 Aug 2023 19:36:10 +0530 Subject: [PATCH] Fix PHP notice on Catalog Price Rules page --- .../admin/AdminSpecificPriceRuleController.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/controllers/admin/AdminSpecificPriceRuleController.php b/controllers/admin/AdminSpecificPriceRuleController.php index a1185a717..7edda5d93 100644 --- a/controllers/admin/AdminSpecificPriceRuleController.php +++ b/controllers/admin/AdminSpecificPriceRuleController.php @@ -286,16 +286,21 @@ class AdminSpecificPriceRuleControllerCore extends AdminController 'title' => $this->l('Save') ), ); - if (($value = $this->getFieldValue($this->object, 'price')) != -1) { - $price = number_format($value, 6); + + $price = $this->getFieldValue($this->object, 'price'); + if ($price != -1 && floatval($price) != 0) { + $price = number_format($price, 6); } else { $price = ''; } + $reduction = floatval($this->getFieldValue($this->object, 'reduction')); + $reduction = number_format($reduction, 6); + $this->fields_value = array( 'price' => $price, 'from_quantity' => (($value = $this->getFieldValue($this->object, 'from_quantity')) ? $value : 1), - 'reduction' => number_format((($value = $this->getFieldValue($this->object, 'reduction')) ? $value : 0), 6), + 'reduction' => $reduction, 'leave_bprice_on' => $price ? 0 : 1, 'shop_id' => (($value = $this->getFieldValue($this->object, 'id_shop')) ? $value : 1) );