Bug: Product cards have prices rounded to full numbers and not 2 decimals.
Issue is for all products in webshop.
First occurrence: after update from 1.7.6.9 using 1-click update
/**
/**
* {@inheritdoc}
*/
public function getPrecision(int $displayPrecision)
{
// the MULTIPLIER attribute is set to 1 for now, so that it matches display precision
$computingPrecision = $displayPrecision * self::MULTIPLIER;
return ($computingPrecision < self::MINIMAL_VALUE) ? self::MINIMAL_VALUE : $computingPrecision;
}
}`
Q1: Shouldn't the 'const MINIMAL_VALUE = 0;' be set to 2?
Prestashop: 1.7.7
PHP: 7.3
@michael2278 Hi Michael, the MINIMAL_VALUE value is correct. It works fine in clean 1.7.7 install. I think that something went wrong in the upgrade process, or there is something influencing the way the price on your product page displays.
See here:
Thanks for a quick reply.
Any hints what to look for?
For me this is a major issue because Google Merchant Center is rejecting my products. The reason is that one of my modules creates a feed for GMC and uses real prices while in webshop Google sees a different price (rounded). My ads are not showing...
I would really appreciate any hints/directions/ideas what could be done to fix this :)
@michael2278
Go to your PS install, controllers/front, open any controller, for example Product Controller, put this right to beginning of initContent:
echo Context::getContext()->getComputingPrecision();
echo Context::getContext()->currency->precision;
Then go to product page and there should be two numbers on the top of the page, are they 22?
Hi - yes, 22 is there at the top left corner.
Hello @michael2278
I didn't manage to reproduce your issue with my shop PS1.7.6.9 upgraded to PS1.7.7.0, see the attached screen record below:
https://drive.google.com/file/d/1vtat2tP0iIcfWII2rVNwg3I5WmBTPaCN/view
Please check and feedback.
Thanks!
Hi @hibatallahAouadni
OK. But we did not do anything else with the shop...
You can try to disable all your non-PrestaShop modules and reactivate them one by one to check if you can reproduce the problem.
Also, are you using the Classic Theme in FO ? It could be from the theme if it's a third-party. Try with Classic to check if the issue is still there.
Thank you
Checked with classic theme and problem is still there. I will continue with the modules this evening because of traffic.
Thanks everyone. All replies and ideas are really appreciated 馃憤
Hello @michael2278
By the way, have you changed any Core code? or override it?
If so, please redo what you changed and check if the problem persists.
Thanks!
Hello everyone.
I found the problem. It was one of the modules which was working fine with previous version of PS and now it does not. The module was showing related products at product pages,categories & cart.
Anyway thanks @Hlavtox @hibatallahAouadni @SimonGrn for the guide and support!
Without you I would be looking in the wrong place!
I wish you all the best, happy, great and excellent Christmas and a happy new year! :):):)
@michael2278 Glad that you found the problem :tada:
Merry Christmas and happy new year :slightly_smiling_face:
@michael2278 Awesome! :-) Merry christmas for you too!
Maybe the module is not hard to fix, search the code for some rounding and investigate why there is 0 for decimal places, or just hardcode 2 there... 馃馃槃
Most helpful comment
Hello everyone.
I found the problem. It was one of the modules which was working fine with previous version of PS and now it does not. The module was showing related products at product pages,categories & cart.
Anyway thanks @Hlavtox @hibatallahAouadni @SimonGrn for the guide and support!
Without you I would be looking in the wrong place!
I wish you all the best, happy, great and excellent Christmas and a happy new year! :):):)