Prestashop: Rounding not applied to product.regular_price variable

Created on 12 Jul 2019  路  15Comments  路  Source: PrestaShop/PrestaShop

Describe the bug
When discount is applied to a price with a number far behind the decimal range, the shop front shows the regular price as the un-rounded number

To Reproduce
Steps to reproduce the behavior:

  1. Create a product with a price with taxes set to 59.000001
  2. Add a 6 eur discount
  3. See the product.regular_price variable in the product page. (I assume this should be used to show the price before the discount, if not can you pleases correct me, since all other variables seem to show 59.000001 as well).

Screenshots
Price: https://paste.pics/ad7a7c864fcefd2e22f621b64d42345c
Discount: https://paste.pics/09ceba18e45eafadcd61022546c0b34d
Rounding: https://paste.pics/b0bd5e066b8136c02b77787ffb7e319b
ISSUE: https://paste.pics/520cfb15968e44b6c2f3cbb7327c6ce8

Additional information
PrestaShop version: 1.7.6
PHP version: 7.1

1.7.6.0 Discounts Duplicate FO Products Taxes and Prices

Most helpful comment

@JustasBelevicius, @kpodemski, The original issue may be related to #14608.

When we upgrade to 1.7.6.0, prices are displayed with 6 decimals, which could explain this display after an upgrade.
Could you please try to edit the precision from 6 to 2, check & feedback.

Thanks!

All 15 comments

Hi @JustasBelevicius,

I did not manage to reproduce the issue with PS1.7.6.0.
I attached a screen record
https://drive.google.com/file/d/1mIAD3YHTgpG3qrvXI7tN2uPSmhdzqwrP/view

Thanks to check & feedback

It seems to be a problem with my setup. I will try to check the integrity of my files, maybe some of them are overridden.

Thanks for help!

Could it be that my core files are modified? I am getting this in 1-Click upgrade module:

admin/autoupgrade/index.php
admin/autoupgrade/backup/index.php
img/cms/cms-img.jpg
img/s/2.jpg
img/favicon.ico
img/logo.jpg
img/404.gif
modules/ps_facetedsearch/src/Filters/Converter.php
modules/ps_facetedsearch/src/Hook/Feature.php
modules/ps_facetedsearch/src/Hook/FeatureValue.php
modules/ps_facetedsearch/src/Hook/Attribute.php
modules/ps_facetedsearch/src/Hook/AttributeGroup.php
modules/ps_facetedsearch/src/Product/SearchProvider.php
modules/ps_facetedsearch/views/dist/front.js
modules/ps_facetedsearch/views/dist/back.js
modules/ps_facetedsearch/views/templates/admin/add.tpl
modules/ps_facetedsearch/views/templates/admin/view.tpl
modules/ps_facetedsearch/ps_facetedsearch.php
modules/ps_facetedsearch/ps_facetedsearch.tpl
modules/ps_facetedsearch/webpack.config.js
modules/ps_facetedsearch/config.xml
modules/ps_linklist/views/templates/admin/link_block/form.html.twig
modules/ps_linklist/composer.lock
modules/ps_linklist/ps_linklist.php
modules/ps_linklist/config.xml
override/index.php
override/classes/cache/index.php
override/classes/controller/index.php
override/classes/db/index.php
override/classes/exception/index.php
override/classes/helper/index.php
override/classes/module/index.php
override/classes/pdf/index.php
override/classes/shop/index.php
override/classes/tax/index.php
override/classes/tree/index.php
override/classes/webservice/index.php
override/classes/index.php
override/classes/log/index.php
override/classes/order/index.php
override/classes/range/index.php
override/classes/stock/index.php
override/controllers/index.php
override/controllers/admin/index.php
override/controllers/admin/templates/index.php
override/controllers/front/index.php
override/modules/index.php
vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php
vendor/composer/installers/src/Composer/Installers/CraftInstaller.php
vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php
vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php
vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php
vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php
vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php
vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php
vendor/composer/installers/src/Composer/Installers/BaseInstaller.php
vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php
vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php
vendor/composer/installers/src/Composer/Installers/OxidInstaller.php
vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php
vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php
vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php
vendor/composer/installers/src/Composer/Installers/Installer.php
vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php

If that's the case, should I reinstall the CMS or can I just grab these files from one of the branches (which one?) and replace them?

@JustasBelevicius, you can check the Override folder in a fresh install PS1.7.6.0.
https://github.com/PrestaShop/PrestaShop/tree/1.7.6.0/override

Thanks!

Hi, I have the same issue with prices,

In 1-click update I have this:
Original version of PrestaAhop:
40 file modifications have been detected, including 39 from core and native modules:

SOURCE FILES (39)
admin/autoupgrade/index.php
admin/autoupgrade/backup/index.php
classes/PaymentModule.php
img/cms/cms-img.jpg
img/favicon.ico
img/logo.jpg
img/404.gif
override/index.php
override/classes/Smarty/index.php
override/classes/assets/index.php
override/classes/cache/index.php
override/classes/checkout/index.php
override/classes/container/index.php
override/classes/controller/index.php
override/classes/db/index.php
override/classes/exception/index.php
override/classes/form/index.php
override/classes/helper/index.php
override/classes/lang/index.php
override/classes/module/index.php
override/classes/pdf/index.php
override/classes/shop/index.php
override/classes/tax/index.php
override/classes/tree/index.php
override/classes/webservice/index.php
override/classes/index.php
override/classes/log/index.php
override/classes/order/index.php
override/classes/range/index.php
override/classes/stock/index.php
override/controllers/index.php
override/controllers/admin/index.php
override/controllers/admin/templates/index.php
override/controllers/front/index.php
override/modules/index.php
vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php
vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php
vendor/composer/installers/src/Composer/Installers/Installer.php
vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php

how I should proceed?

Similar issue for me after an upgrade from 1.7.5.2 to 1.7.6.0, here's screenshot:
image

@JustasBelevicius, @kpodemski, The original issue may be related to #14608.

When we upgrade to 1.7.6.0, prices are displayed with 6 decimals, which could explain this display after an upgrade.
Could you please try to edit the precision from 6 to 2, check & feedback.

Thanks!

Where can I change that? In general settings is 2 but again showing 4.

@MikiMix, in your database, table ps_currency.

Thanks!

Now is OK :) THANKS

@JustasBelevicius, any news about your issue?

Thanks!

@khouloudbelguith

sorry, i forgot to write that indeed changing number of decimals in ps_currency solved this issue :)

Hi @JustasBelevicius,

Heres' the PR: https://github.com/PrestaShop/PrestaShop/pull/14664 to fix the issue.
Your ticket is a duplicate of #14640
So, I close it.
Thanks!

Duplicate of #14640

When we upgrade to 1.7.6.0, prices are displayed with 6 decimals, which could explain this display after an upgrade.
Could you please try to edit the precision from 6 to 2, check & feedback.

Same problem, this worked for me.
Thank you 馃憤馃徑

Was this page helpful?
0 / 5 - 0 ratings