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

Product price 0,00 euro in FO and Invalid $number parameter: "" cannot be interpreted as a number in BO #24587

Open
Tracked by #9723 ...
202-ecommerce opened this issue May 20, 2021 · 7 comments
Labels
1.7.7.5 Affects versions BO Category: Back Office Bug Type: Bug Combinations Product type: issue about products with combinations Major Severity: major bug > https://build.prestashop.com/news/severity-classification Multistore Label: Which BO under menu is concerned Needs Specs Status: issue needs to be specified Old Products Page Concerns the old product page Verified The issue has been reproduced

Comments

@202-ecommerce
Copy link
Contributor

Describe the bug

Bug only in multishop. If product is "simple product" in one shop and "Product with combinations" in other shop, there are some bugs.

  1. In BO on Products page we have error "Invalid $number parameter: "" cannot be interpreted as a number ". I temporary fixed this error by modifying src/Adapter/Product/AdminProductDataProvider.php by adding verification if $product['price_final'] != null before this line :
    $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code);
    Then i can see the page normally, but in "All shops" price of this product in column "Price (tax incl.)" will be N/A.
  2. In FO on categroy page, the price of this product will be 0 in context of shop where it's simple product. In context of other product the price is showing correctly. The price is 0 because we try to find the price of default combination, but in some context this combination doesn't exist. If we click on product, the product link has default attribute Id, so we have redirection from this link to correct one without attribute Id.
    So product shown in front depends in what context the product was saved the last time.

Expected behavior

No fatal error on Product list page.
Correct product information in front.
Product information must not depends in what context the product was saved. For each shop context we expect the information that correspond to this shop.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Activate and configure multishop, ex. shop1 and shop2.
  2. In All shops context create new simple product with some price.
  3. Switch to shop2 and change to product with combinations and add few combinations. Save product. Less in shop1 the product as simple product.
  4. Go to All products page in context All shops and see error "Invalid $number parameter: "" cannot be interpreted as a number ".
  5. You can temporary fixed this error by modifying src/Adapter/Product/AdminProductDataProvider.php by adding verification if $product['price_final'] != null before this line :
    $product['price_final'] = $localeCldr->formatPrice($product['price_final'], $currency->iso_code);
  6. See that price in column "Price (tax incl.)" is N/A (still in context All shops, sometimes the same shop1 context, but on other prestashop versions).
  7. Go to front of shop1 on category page of this product. See price 0,00. And product link contain the default attribute id, but in this shop we doesn't have attributes.
  8. Go to front of shop2 on category page of this product. See correct price.
  9. Go back to BO to product page, re-save the product in context of shop1.
  10. Go to front of shop1 on category page of this product. See correct price and correct link without attribute id.
  11. In context "All shops" we can't save the product, there is error "unable to save product".

Screenshots

Screenshot from 2021-05-20 16-09-18
Screenshot from 2021-05-20 16-10-22
Screenshot from 2021-05-20 16-20-20

Additional information

  • PrestaShop version: 1.7.7.5 and previous versions
  • PHP version: 7.3
@florine2623
Copy link
Contributor

Hello @202-ecommerce ,

I was able to reproduce the issue with PrestaShop version 1.7.7.4 and develop, so I can confirm that this behavior is indeed a bug.

I just followed only your 4 first steps :

  • Activate and configure multishop, ex. shop1 and shop2.
  • In All shops context create new simple product with some price.
  • Switch to shop2 and change to product with combinations and add few combinations. Save product. Less in shop1 the product as simple product.
  • Go to All products page in context All shops and see error "Invalid $number parameter: "" cannot be interpreted as a number ".
    Capture d’écran 2021-05-21 à 11 01 45

Please be aware that due to the high number of reported issues, some bugs might take a very long time to be resolved. If this issue is important to you and you cannot wait for it to be fixed on the project’s own time, we strongly suggest you consider hiring a specialist to help you. If you manage to get the problem fixed, then please contribute the fix back to the project as a Pull Request. Remember that the more people contribute, the better PrestaShop becomes for everyone.

Thanks!

@florine2623 florine2623 added 1.7.7.x Branch BO Category: Back Office Bug Type: Bug Combinations Product type: issue about products with combinations Critical Severity: critical bug > https://build.prestashop.com/news/severity-classification develop Branch Multistore Label: Which BO under menu is concerned Old Products Page Concerns the old product page Ready Status: Issue is ready to be worked on labels May 21, 2021
@florine2623 florine2623 added this to Waiting for classification in Bug classification board May 21, 2021
@hibatallahAouadni hibatallahAouadni removed this from Waiting for classification in Bug classification board May 22, 2021
@hibatallahAouadni
Copy link
Contributor

Hello @202-ecommerce

Could you please check this issue #9664 it seems related to yours.
Please check and feedback.

Thanks!

@hibatallahAouadni hibatallahAouadni added NMI Status: issue needs more information and removed Critical Severity: critical bug > https://build.prestashop.com/news/severity-classification Ready Status: Issue is ready to be worked on labels May 22, 2021
@202-ecommerce
Copy link
Contributor Author

202-ecommerce commented May 24, 2021

Hello @202-ecommerce

Could you please check this issue #9664 it seems related to yours.
Please check and feedback.

Thanks!

Hello @hibatallahAouadni ,
Thank you, i checked the issue.
The issue is not really the same, I can add/remove combinations in different strores and save. But there i found this PR #20964 and it solve my probleme with price 0 on category page and in BO the Price (tax incl.) shown correctly now.
But if i remove my fix $product['price_final'] != null" from src/Adapter/Product/AdminProductDataProvider.php still have the 500 error in BO :

Invalid $number parameter: "" cannot be interpreted as a number
[PrestaShop\PrestaShop\Core\Localization\Exception\LocalizationException 0]

@hibatallahAouadni
Copy link
Contributor

Hello @202-ecommerce

Thanks for your feedback!
So, your issue is a duplicate of #20975 as this PR fixed this issue with PS1.7.8.0
As we are aware of this issue and it is already in our debug backlog. This issue is a duplicate of #20975.
To be informed when it's fixed, please subscribe to the issue mentioned above.

But if i remove my fix "$product['price_final'] != null" from src/Adapter/Product/AdminProductDataProvider.php still have the 500 error in BO

Please use this fix till we release the 1.7.8.0 🙏 and thanks for your patience.

Thanks!

@hibatallahAouadni hibatallahAouadni added Duplicate Resolution: issue closed because already reported and removed NMI Status: issue needs more information develop Branch labels May 25, 2021
@hibatallahAouadni
Copy link
Contributor

Duplicate of #20975

@hibatallahAouadni hibatallahAouadni marked this as a duplicate of #20975 May 25, 2021
@202-ecommerce
Copy link
Contributor Author

202-ecommerce commented May 25, 2021

Hello @202-ecommerce

Thanks for your feedback!
So, your issue is a duplicate of #20975 as this PR fixed this issue with PS1.7.8.0
As we are aware of this issue and it is already in our debug backlog. This issue is a duplicate of #20975.
To be informed when it's fixed, please subscribe to the issue mentioned above.

But if i remove my fix "$product['price_final'] != null" from src/Adapter/Product/AdminProductDataProvider.php still have the 500 error in BO

Please use this fix till we release the 1.7.8.0 and thanks for your patience.

Thanks!

This PR fix only part of the problem.
I still have the error:

Invalid $number parameter: "" cannot be interpreted as a number
[PrestaShop\PrestaShop\Core\Localization\Exception\LocalizationException 0]
$product['price_final'] != null" from src/Adapter/Product/AdminProductDataProvider.php

it was my solution to fix this error.
I didn't find PR that will fix this error. This error can still be reproduced at develop branch.

@khouloudbelguith
Copy link
Contributor

Hi All,

I still reproduced issue 8.0.x branch.
image

I will re-open the issue.

Thanks!

@khouloudbelguith khouloudbelguith added Verified The issue has been reproduced Needs Specs Status: issue needs to be specified and removed Duplicate Resolution: issue closed because already reported labels Jul 8, 2022
@khouloudbelguith khouloudbelguith added the Major Severity: major bug > https://build.prestashop.com/news/severity-classification label Jul 8, 2022
@hibatallahAouadni hibatallahAouadni added 1.7.7.5 Affects versions and removed 1.7.7.x Branch labels Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.7.7.5 Affects versions BO Category: Back Office Bug Type: Bug Combinations Product type: issue about products with combinations Major Severity: major bug > https://build.prestashop.com/news/severity-classification Multistore Label: Which BO under menu is concerned Needs Specs Status: issue needs to be specified Old Products Page Concerns the old product page Verified The issue has been reproduced
Projects
None yet
Development

No branches or pull requests

4 participants