alj Posted January 19, 2021 Share Posted January 19, 2021 (edited) Hi On a Prestashop 1.7.7.1 i'm getting this error when going to the product overview in back office. it is a new fresh install, and before I imported products I could fine access the product overview , but now after importing products, i get this error. Have tried changing decimals under currencies, deleting cache and changing currency, nothing helped. Has anyone experienced this error and may have a solution. Thanks! Edited January 19, 2021 by alj (see edit history) Link to comment Share on other sites More sharing options...
alj Posted January 19, 2021 Author Share Posted January 19, 2021 Link to comment Share on other sites More sharing options...
diloycom Posted January 24, 2021 Share Posted January 24, 2021 I have exactly the same problem Link to comment Share on other sites More sharing options...
musicmaster Posted January 25, 2021 Share Posted January 25, 2021 It looks like it has a NULL or "" value for price. So you will need to have look at the price field the ps_product_shop in the database and see if there are null values there. Link to comment Share on other sites More sharing options...
joseantgv Posted February 24, 2021 Share Posted February 24, 2021 @alj @diloycom Do you have a multistore? Link to comment Share on other sites More sharing options...
diloycom Posted February 24, 2021 Share Posted February 24, 2021 34 minutes ago, joseantgv said: @alj @diloycom Do you have a multistore? Yes, it's a multistore Link to comment Share on other sites More sharing options...
joseantgv Posted February 25, 2021 Share Posted February 25, 2021 https://github.com/PrestaShop/PrestaShop/issues/23376 As a temporary solution, add an IF in these lines: https://github.com/PrestaShop/PrestaShop/blob/6cc8f20c2a5675d754c5566adf76ec6ac25ef901/controllers/admin/AdminCartRulesController.php#L573 https://github.com/PrestaShop/PrestaShop/blob/6cc8f20c2a5675d754c5566adf76ec6ac25ef901/controllers/admin/AdminCartRulesController.php#L584 to check if $product['price_tax_incl'] or $price_tax_incl is not null. 1 Link to comment Share on other sites More sharing options...
Asger22 Posted February 26, 2021 Share Posted February 26, 2021 I had what appears to be the same problem. This solved it. Add this logic to the if on line 390 in src/Adapter/Product/AdminProductDataProvider.php if ($formatCldr && $product['price'] != null && $product['price_final'] != null) { $product['price'] = $localeCldr->formatPrice($product['price'], $currency->iso_code); $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code); } 8 4 Link to comment Share on other sites More sharing options...
walter19711971 Posted June 7, 2021 Share Posted June 7, 2021 On 2/26/2021 at 4:29 PM, Asger22 said: I had what appears to be the same problem. This solved it. Add this logic to the if on line 390 in src/Adapter/Product/AdminProductDataProvider.php if ($formatCldr && $product['price'] != null && $product['price_final'] != null) { $product['price'] = $localeCldr->formatPrice($product['price'], $currency->iso_code); $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code); } Thank you, works properly on PS 1.7.7.1 1 Link to comment Share on other sites More sharing options...
Prestafan1234 Posted June 9, 2021 Share Posted June 9, 2021 On 2/26/2021 at 4:29 PM, Asger22 said: I had what appears to be the same problem. This solved it. Add this logic to the if on line 390 in src/Adapter/Product/AdminProductDataProvider.php if ($formatCldr && $product['price'] != null && $product['price_final'] != null) { $product['price'] = $localeCldr->formatPrice($product['price'], $currency->iso_code); $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code); } The above worked for me. However, this bug still exists in P.S. 1.7.7.4 has it been reported to PrestaShop? Link to comment Share on other sites More sharing options...
lototo Posted June 10, 2021 Share Posted June 10, 2021 Switch to older PHP version 7.1 or 7.2 Link to comment Share on other sites More sharing options...
joseantgv Posted June 10, 2021 Share Posted June 10, 2021 hace 1 hora, lototo dijo: Switch to older PHP version 7.1 or 7.2 It's not related with PHP version. Link to comment Share on other sites More sharing options...
Prestafan1234 Posted June 10, 2021 Share Posted June 10, 2021 7 hours ago, lototo said: Switch to older PHP version 7.1 or 7.2 Who are you replying to? It makes no sense to change to an older version of PHP when PrestaShop 1.7.7.x supports 7.3 Link to comment Share on other sites More sharing options...
lototo Posted June 14, 2021 Share Posted June 14, 2021 On 6/10/2021 at 11:34 PM, Prestafan1234 said: Who are you replying to? It makes no sense to change to an older version of PHP when PrestaShop 1.7.7.x supports 7.3 I got similar problem with the module and was resolved when I switch to older PHP Link to comment Share on other sites More sharing options...
Prestafan1234 Posted June 14, 2021 Share Posted June 14, 2021 17 hours ago, lototo said: I got similar problem with the module and was resolved when I switch to older PHP This is not a module. It is core PrestaShop. The shop I work on already uses PHP 7.2 so it did not work for me before changes were made (upgraded shop from 1.6 to 1.7) Link to comment Share on other sites More sharing options...
shikotak Posted July 17, 2021 Share Posted July 17, 2021 On 2/26/2021 at 6:59 PM, Asger22 said: I had what appears to be the same problem. This solved it. Add this logic to the if on line 390 in src/Adapter/Product/AdminProductDataProvider.php if ($formatCldr && $product['price'] != null && $product['price_final'] != null) { $product['price'] = $localeCldr->formatPrice($product['price'], $currency->iso_code); $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code); } I copy this code exactly and it works on Prestashop 1.7.7.5. IF add to this line in this version but this part has changed product['price'] != null && $product['price_final'] != null) { 1 Link to comment Share on other sites More sharing options...
bcpivetta Posted October 5, 2021 Share Posted October 5, 2021 Not work for me! =l if ($formatCldr && $product['price'] != null && $product['price_final'] != null) { $product['price'] = $localeCldr->formatPrice($product['price'], $currency->iso_code); $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code); } Link to comment Share on other sites More sharing options...
joseantgv Posted October 6, 2021 Share Posted October 6, 2021 hace 12 horas, bcpivetta dijo: Not work for me! =l if ($formatCldr && $product['price'] != null && $product['price_final'] != null) { $product['price'] = $localeCldr->formatPrice($product['price'], $currency->iso_code); $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code); } Because your problem is in another function. First of all, which PHP version are you using? Link to comment Share on other sites More sharing options...
freelex Posted October 13, 2021 Share Posted October 13, 2021 On 2/26/2021 at 4:29 PM, Asger22 said: I had what appears to be the same problem. This solved it. Add this logic to the if on line 390 in src/Adapter/Product/AdminProductDataProvider.php if ($formatCldr && $product['price'] != null && $product['price_final'] != null) { $product['price'] = $localeCldr->formatPrice($product['price'], $currency->iso_code); $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code); } Works... thank you so much Link to comment Share on other sites More sharing options...
passio Posted November 9, 2021 Share Posted November 9, 2021 Merci pour la solution ❤️ Link to comment Share on other sites More sharing options...
Prestag0od Posted November 16, 2021 Share Posted November 16, 2021 On 2/26/2021 at 5:29 PM, Asger22 said: I had what appears to be the same problem. This solved it. Add this logic to the if on line 390 in src/Adapter/Product/AdminProductDataProvider.php if ($formatCldr && $product['price'] != null && $product['price_final'] != null) { $product['price'] = $localeCldr->formatPrice($product['price'], $currency->iso_code); $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code); } Worked for me too on upgraded prestashop 1.7.7.5. Thank you! Link to comment Share on other sites More sharing options...
WartoWiedziec Posted November 21, 2021 Share Posted November 21, 2021 (edited) Dnia 26.02.2021 o 4:29 PM, Asger22 napisał: I had what appears to be the same problem. This solved it. Add this logic to the if on line 390 in src/Adapter/Product/AdminProductDataProvider.php if ($formatCldr && $product['price'] != null && $product['price_final'] != null) { $product['price'] = $localeCldr->formatPrice($product['price'], $currency->iso_code); $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code); } It helped me in version 1.7.8.1 with PHP 7.4 =============================== @Asger22 15-02-2022 Unfortunately, the problem reappears in version 1.7.8.3 - after updating the above code in the AdminProductDataProvider.php file, I can now access the product catalog. I must point out that for the last 15 days after updating the store from version 1.7.8.2 it worked without corrections, but today something crashed and I had to go back to modifying the file. Fortunately, the patch works. 🙂 Edited February 15, 2022 by WartoWiedziec Updated (see edit history) Link to comment Share on other sites More sharing options...
anitanails Posted January 27, 2022 Share Posted January 27, 2022 On 2/26/2021 at 4:29 PM, Asger22 said: I had what appears to be the same problem. This solved it. Add this logic to the if on line 390 in src/Adapter/Product/AdminProductDataProvider.php if ($formatCldr && $product['price'] != null && $product['price_final'] != null) { $product['price'] = $localeCldr->formatPrice($product['price'], $currency->iso_code); $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code); } I have exactly the same problem in version 1.7.8.2 multistore with PHP 7.4. Change of code not solved error. Can someone help me to solve the problem ? Link to comment Share on other sites More sharing options...
idnovate.com Posted January 27, 2022 Share Posted January 27, 2022 3 hours ago, anitanails said: I have exactly the same problem in version 1.7.8.2 multistore with PHP 7.4. Change of code not solved error. Can someone help me to solve the problem ? Probably you have the same error but in another part of code. Please upload a screenshot. Link to comment Share on other sites More sharing options...
Webmain Posted February 24, 2022 Share Posted February 24, 2022 (edited) EDIT SOLVED!! Well then the problem is super simple in the end but however you need to put the code as given above see below: Add this logic to the if on line 390 in src/Adapter/Product/AdminProductDataProvider.php if ($formatCldr) { $product['price'] = $localeCldr->formatPrice($product['price'], $currency->iso_code); $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code); } PAR if ($formatCldr && $product['price'] != null && $product['price_final'] != null) { $product['price'] = $localeCldr->formatPrice($product['price'], $currency->iso_code); $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code); } Then when you have all the products displayed, search in the page or pages for the mention N/D of the column Amount including tax Edit the product and delete all the combinations (shops only) Then save then put all the shops and recreate the combinations! Then modify the variations for each shop and save for each of the shops then go back to all the shops then save until you have the updated product message!! Do this for all products with N/D then once finished you can remove the piece of code :). Problem solved !! In the future create your variations before on all the shops then configure each shop their price etc .. Edited February 24, 2022 by Esh-Network (see edit history) Link to comment Share on other sites More sharing options...
joseantgv Posted March 10, 2022 Share Posted March 10, 2022 En 24/2/2022 a las 8:45 PM, Esh-Network dijo: EDIT SOLVED!! Well then the problem is super simple in the end but however you need to put the code as given above see below: Add this logic to the if on line 390 in src/Adapter/Product/AdminProductDataProvider.php if ($formatCldr) { $product['price'] = $localeCldr->formatPrice($product['price'], $currency->iso_code); $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code); } PAR if ($formatCldr && $product['price'] != null && $product['price_final'] != null) { $product['price'] = $localeCldr->formatPrice($product['price'], $currency->iso_code); $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code); } Then when you have all the products displayed, search in the page or pages for the mention N/D of the column Amount including tax Edit the product and delete all the combinations (shops only) Then save then put all the shops and recreate the combinations! Then modify the variations for each shop and save for each of the shops then go back to all the shops then save until you have the updated product message!! Do this for all products with N/D then once finished you can remove the piece of code :). Problem solved !! In the future create your variations before on all the shops then configure each shop their price etc .. Yes, this is the solution given in a previous answer Link to comment Share on other sites More sharing options...
Webmain Posted March 10, 2022 Share Posted March 10, 2022 not quite that just unblocks the situation. read the rest of my post to solve the problem, because in case of updating the prestashop the code will be replaced again Link to comment Share on other sites More sharing options...
Yulia Vitun Posted June 29, 2022 Share Posted June 29, 2022 In my case this error appears after upgrade from PS 1.7.6.5 to PS 1.7.8.6, and only when I click on Stats Dashboard link in back office. Solution: as per this fix in src/Core/Localization/Locale.php, to add just one line 152: if ( $number === null ) return null; The final view: public function formatPrice($number, $currencyCode) { if ( $number === null ) return null; return $this->numberFormatter->format( $number, $this->getPriceSpecification($currencyCode) ); } 1 Link to comment Share on other sites More sharing options...
rDuque Posted July 21, 2022 Share Posted July 21, 2022 On 6/29/2022 at 2:06 PM, Yulia Vitun said: In my case this error appears after upgrade from PS 1.7.6.5 to PS 1.7.8.6, and only when I click on Stats Dashboard link in back office. Solution: as per this fix in src/Core/Localization/Locale.php, to add just one line 152: if ( $number === null ) return null; The final view: public function formatPrice($number, $currencyCode) { if ( $number === null ) return null; return $this->numberFormatter->format( $number, $this->getPriceSpecification($currencyCode) ); } This work for me. In my case, I cant enter to backoffice cart list. 1 Link to comment Share on other sites More sharing options...
Yulia Vitun Posted September 2, 2022 Share Posted September 2, 2022 (edited) ....also I found this solution: to add this if logic to the line 390 in src/Adapter/Product/AdminProductDataProvider.php if ($formatCldr && $product['price'] != null && $product['price_final'] != null) { $product['price'] = $localeCldr->formatPrice($product['price'], $currency->iso_code); $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code); } I add two solutions mentioned, lets see )) Edited September 2, 2022 by Yulia Vitun (see edit history) 1 Link to comment Share on other sites More sharing options...
910168_1508423795 Posted October 21, 2022 Share Posted October 21, 2022 De mon coté j'ai résolu me problème de la manière suivante Dans /src/core/Localization/Number/formatter.php j'ai ajouté ligne 105 if (empty($number)){$number='0.000000';} Pas top mais bon ça corrige le problème patrice ubimedia.fr Link to comment Share on other sites More sharing options...
nancyfs Posted February 7, 2023 Share Posted February 7, 2023 On 2/26/2021 at 4:29 PM, Asger22 said: I had what appears to be the same problem. This solved it. Add this logic to the if on line 390 in src/Adapter/Product/AdminProductDataProvider.php if ($formatCldr && $product['price'] != null && $product['price_final'] != null) { $product['price'] = $localeCldr->formatPrice($product['price'], $currency->iso_code); $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code); } Thanks so much for your solution. It works to me Prestashop version 1.7.8.8 Link to comment Share on other sites More sharing options...
hruharhwa Posted April 3, 2023 Share Posted April 3, 2023 I am having similar error, non of the fixes mentioned did the trick.. Invalid $number parameter: "3,89 €" cannot be interpreted as a number [PrestaShop\PrestaShop\Core\Localization\Exception\LocalizationException 0] Link to comment Share on other sites More sharing options...
lordshop Posted April 12, 2023 Share Posted April 12, 2023 On 2/26/2021 at 5:29 PM, Asger22 said: I had what appears to be the same problem. This solved it. Add this logic to the if on line 390 in src/Adapter/Product/AdminProductDataProvider.php if ($formatCldr && $product['price'] != null && $product['price_final'] != null) { $product['price'] = $localeCldr->formatPrice($product['price'], $currency->iso_code); $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code); } thanks, same problem multistore 1.7.7.7 Link to comment Share on other sites More sharing options...
Yohannn Posted May 15, 2023 Share Posted May 15, 2023 Hello, I have this issue too and I don't found a good solution. Your solution can maybe work but it is not recommended to override the src folder. So I don't really understand how I can solve the problem. Link to comment Share on other sites More sharing options...
Prestag0od Posted May 15, 2023 Share Posted May 15, 2023 2 hours ago, Yohannn said: Hello, I have this issue too and I don't found a good solution. Your solution can maybe work but it is not recommended to override the src folder. So I don't really understand how I can solve the problem. there is not other solution in this topic except this one: Add this logic to the if on line 390 in src/Adapter/Product/AdminProductDataProvider.php if ($formatCldr && $product['price'] != null && $product['price_final'] != null) { $product['price'] = $localeCldr->formatPrice($product['price'], $currency->iso_code); $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code); } It's safe to change this line. Link to comment Share on other sites More sharing options...
Yohannn Posted May 16, 2023 Share Posted May 16, 2023 (edited) 14 hours ago, Prestan0ob said: there is not other solution in this topic except this one: Add this logic to the if on line 390 in src/Adapter/Product/AdminProductDataProvider.php if ($formatCldr && $product['price'] != null && $product['price_final'] != null) { $product['price'] = $localeCldr->formatPrice($product['price'], $currency->iso_code); $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code); } It's safe to change this line. Yes I understand this but if in the next time I want to upgrade my prestashop version, the line added will be disappear Edited May 16, 2023 by Yohannn (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now