From e9bdcb715d5f6775145d6959130e280bdd7cba79 Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Mon, 1 Feb 2016 21:48:39 +0100 Subject: [PATCH] fix discount , using floor method, change version to 0.0.30 --- changelog.txt | 2 ++ common/config/params.php | 2 +- common/models/Discount.php | 2 +- frontend/web/js/product.sell.js | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 6e7231e..66c3a21 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,5 @@ +-0.0.30 + - fix discount to integer ( using floor ) -0.0.29 - change daily listings to use paid_by instead id_user - add customer cart details diff --git a/common/config/params.php b/common/config/params.php index e125ea1..302adb7 100644 --- a/common/config/params.php +++ b/common/config/params.php @@ -4,7 +4,7 @@ return [ 'supportEmail' => 'rocho02@gmail.com', 'infoEmail' => 'info@rocho-net.hu', 'user.passwordResetTokenExpire' => 3600, - 'version' => 'v0.0.29', + 'version' => 'v0.0.30', 'company' => 'movar',//gyor 'company_name' => "Freimann Kft.", 'product_visiblity' => 'account',// on reception which products to display. account or global diff --git a/common/models/Discount.php b/common/models/Discount.php index 6aad798..4aeea95 100644 --- a/common/models/Discount.php +++ b/common/models/Discount.php @@ -114,7 +114,7 @@ class Discount extends \yii\db\ActiveRecord * */ public static function applyDiscount($money,$discount){ $result = $money; - $valueOfDiscount = $money * $discount->value / 100; + $valueOfDiscount = floor( $money * $discount->value / 100 ); $result = $money - $valueOfDiscount; return $result; } diff --git a/frontend/web/js/product.sell.js b/frontend/web/js/product.sell.js index ab66928..f45c06a 100644 --- a/frontend/web/js/product.sell.js +++ b/frontend/web/js/product.sell.js @@ -527,6 +527,7 @@ function ProductSell(o){ if ( discount ){ result = price * ( discount.value / 100 ); + result = Math.floor( result ); } return result;