Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hook for Specifc Prices and move price min and max from rounded integer to decimal #130

Merged
merged 4 commits into from Sep 12, 2019

Conversation

@PierreRambaud
Copy link
Contributor

commented Sep 2, 2019

Fixes PrestaShop/PrestaShop#15223


This change is Reviewable

@PierreRambaud PierreRambaud changed the base branch from master to dev Sep 2, 2019
@@ -543,24 +550,24 @@ public function indexProductPrices($idProduct, $smart = true)
$minPriceValue = array_key_exists($idCountry, $minPrice) ? $minPrice[$idCountry][$currency['id_currency']] : 0;
$maxPriceValue = array_key_exists($idCountry, $maxPrice) ? $maxPrice[$idCountry][$currency['id_currency']] : 0;
if (!in_array($taxRateByCountry['iso_code'], self::ISO_CODE_TAX_FREE)) {
$minPriceValue = Tools::ps_round($minPriceValue * (100 + $taxRate) / 100, 0);
$maxPriceValue = Tools::ps_round($maxPriceValue * (100 + $taxRate) / 100, 0);
$minPriceValue = Tools::ps_round($minPriceValue * (100 + $taxRate) / 100, self::DECIMAL_DIGITS);

This comment has been minimized.

Copy link
@matks

matks Sep 9, 2019

Contributor

So you go for 5 digits instead of 0 ?

This comment has been minimized.

Copy link
@PierreRambaud

PierreRambaud Sep 9, 2019

Author Contributor

Yep because of rounding.
Example:

  • Red scarf 10.60€
  • Blue scarf 10.80€
  • Yellow scarf 10.70€

The previous behaviour was saving 11€ for each products, which means you're not able to properly request and check the price order :/
I use 5 because digits will be configurable in the BO, and can be higher than 2.

@matks
matks approved these changes Sep 9, 2019
@PierreRambaud PierreRambaud changed the title Add hook for Specifc Prices and move price min and max to decimal Add hook for Specifc Prices and move price min and max from rounded integer to decimal Sep 9, 2019
@PierreRambaud PierreRambaud added this to the 3.3.0 milestone Sep 12, 2019
@sarahdib sarahdib added QA approved and removed Waiting for QA labels Sep 12, 2019
@PierreRambaud PierreRambaud merged commit d54d8cd into PrestaShop:dev Sep 12, 2019
1 check passed
1 check passed
Travis CI - Pull Request Build Passed
Details
@PierreRambaud PierreRambaud deleted the PierreRambaud:fix/15223 branch Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.