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

on 1.7.6 rounds errors in the FO and BO for some products #14640

Closed
maofree opened this issue Jul 14, 2019 · 8 comments

Comments

@maofree
Copy link

commented Jul 14, 2019

Hi
look in the product list from the back-end, you can see many decimals
the same problem happen in the from office when some product are added to the cart
I show you this problem on 3 sites, one is on the clean site with classic theme

I think the problem is not in the theme but in the php files,
{$product.price} gives in some cases too much decimals

in the backoffice I cannot set 279€ (with 22% of tax) I get always 279.000001 after saved

setting 2 like Number of decimals this problem should not be present in the front-office, instead in some php file this number is not taken into account and shows all the decimal numbers

from the module ps_shoppingcart it is possible to know something about this problem

` public function renderModal(Cart $cart, $id_product, $id_product_attribute)
{
$data = (new CartPresenter)->present($cart);
$product = null;
foreach ($data['products'] as $p) {
if ($p['id_product'] == $id_product && $p['id_product_attribute'] == $id_product_attribute) {
$product = $p;
break;
}
}

    $this->smarty->assign(array(
        'product' => $product,
        'cart' => $data,
        'cart_url' => $this->getCartSummaryURL(),
    ));

    return $this->fetch('module:ps_shoppingcart/modal.tpl');
}`

I think the problem come from this like
$data = (new CartPresenter)->present($cart);

bye

Screenshots
1
2
3
4
5
6
7
8
9
1

Additional information
PrestaShop version: 1.7.6
PHP version: 7.2

@maofree

This comment has been minimized.

Copy link
Author

commented Jul 14, 2019

the problem come out from this function that you have changed

Tools::displayPrice()

the problem is from this
return $locale->formatPrice($price, $currencyCode);

I think the problem come from here
Number/Formatter.php

1
2
3

@matks

This comment has been minimized.

Copy link
Contributor

commented Jul 14, 2019

Thank you for the very accurate report @maofree ! 👍 We're going to investigate this issue.

Can you tell us which countries, currencies and languages you use for these sites ? It would be a great help

@maofree

This comment has been minimized.

Copy link
Author

commented Jul 14, 2019

Hi
it is not important those selections, it happens for all currencies, languages ..
look at this image (with english and dollar)

1

the number of decimals should follow the value of price_display_precision

bye

@sdwebdesign

This comment has been minimized.

Copy link

commented Jul 15, 2019

Related to #14630

@Shad-Shinoda

This comment has been minimized.

Copy link

commented Jul 16, 2019

I have the same issue with german language and euro currency.
For me, it appears in the cart and product discount table. Didn´t checked the mails yet.
cart

@Slews

This comment has been minimized.

Copy link

commented Jul 16, 2019

The issue occures because the data used to set the maxFractionDigits of the priceSpecification is the precision field of the currency from the database.

@colinegin colinegin moved this from In progress to To be reviewed in PrestaShop 1.7.6 Jul 17, 2019

@marionf marionf moved this from To be reviewed to To be tested in PrestaShop 1.7.6 Jul 17, 2019

@khouloudbelguith khouloudbelguith added this to the 1.7.6.1 milestone Jul 18, 2019

@khouloudbelguith khouloudbelguith added Fixed and removed To Do labels Jul 18, 2019

@khouloudbelguith khouloudbelguith moved this from To be tested to To be merged in PrestaShop 1.7.6 Jul 18, 2019

@simplix-fr

This comment has been minimized.

Copy link

commented Jul 18, 2019

UPDATE ps_currency SET numeric_iso_code = '978', precision = '2' WHERE ps_currency.id_currency = 2;

@sdwebdesign

This comment has been minimized.

Copy link

commented Jul 19, 2019

GREAT WORK! Works for me changed in ps_currency (EURO) the column numeric_iso_code (was empty) to 978 and precision to 2. now the prices are fine in front and back. But done this by hand in database table. Adding new currency has the same issue.

@marionf marionf closed this Jul 26, 2019

PrestaShop 1.7.6 automation moved this from To be merged to Done Jul 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.