alj Posted January 19, 2021 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) Share this post Link to post Share on other sites More sharing options...
alj Posted January 19, 2021 Posted January 19, 2021 Share this post Link to post Share on other sites More sharing options...
diloycom Posted January 24, 2021 Posted January 24, 2021 I have exactly the same problem Share this post Link to post Share on other sites More sharing options...
musicmaster Posted January 25, 2021 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. Share this post Link to post Share on other sites More sharing options...
joseantgv Posted February 24, 2021 Posted February 24, 2021 @alj @diloycom Do you have a multistore? Share this post Link to post Share on other sites More sharing options...
diloycom Posted February 24, 2021 Posted February 24, 2021 34 minutes ago, joseantgv said: @alj @diloycom Do you have a multistore? Yes, it's a multistore Share this post Link to post Share on other sites More sharing options...
joseantgv Posted February 25, 2021 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. Share this post Link to post Share on other sites More sharing options...
Asger22 Posted February 26, 2021 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); } 6 2 Share this post Link to post Share on other sites More sharing options...
walter19711971 Posted June 7, 2021 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 Share this post Link to post Share on other sites More sharing options...
Prestafan1234 Posted June 9, 2021 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? Share this post Link to post Share on other sites More sharing options...
lototo Posted June 10, 2021 Posted June 10, 2021 Switch to older PHP version 7.1 or 7.2 Share this post Link to post Share on other sites More sharing options...
joseantgv Posted June 10, 2021 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. Share this post Link to post Share on other sites More sharing options...
Prestafan1234 Posted June 10, 2021 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 Share this post Link to post Share on other sites More sharing options...
lototo Posted June 14, 2021 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 Share this post Link to post Share on other sites More sharing options...
Prestafan1234 Posted June 14, 2021 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) Share this post Link to post Share on other sites More sharing options...
shikotak Posted July 17, 2021 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 Share this post Link to post Share on other sites More sharing options...
bcpivetta Posted October 5, 2021 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); } Share this post Link to post Share on other sites More sharing options...
joseantgv Posted October 6, 2021 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? Share this post Link to post Share on other sites More sharing options...
freelex Posted October 13, 2021 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 Share this post Link to post Share on other sites More sharing options...
passio Posted November 9, 2021 Posted November 9, 2021 Merci pour la solution ❤️ Share this post Link to post Share on other sites More sharing options...
Prestan0ob Posted November 16, 2021 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! Share this post Link to post Share on other sites More sharing options...
WartoWiedziec Posted November 21, 2021 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 by WartoWiedziec Updated (see edit history) Share this post Link to post Share on other sites More sharing options...
anitanails Posted January 27 Posted January 27 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 ? Share this post Link to post Share on other sites More sharing options...
idnovate.com Posted January 27 Posted January 27 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. Share this post Link to post Share on other sites More sharing options...
Esh-Network Posted February 24 Posted February 24 (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 by Esh-Network (see edit history) Share this post Link to post Share on other sites More sharing options...
joseantgv Posted March 10 Posted March 10 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 Share this post Link to post Share on other sites More sharing options...
Esh-Network Posted March 10 Posted March 10 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 Share this post Link to post Share on other sites More sharing options...
Yulia Vitun Posted Wednesday at 12:06 PM Posted Wednesday at 12:06 PM 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) ); } Share this post Link to post 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