Describe the bug
When using the "Cancel product" functionality, if all products are canceled (in one or multiple times), there is an error showing, even if the cancellation is OK. The error prints "An error occurred while attempting to delete the product X".
This is present in Legacy 176, Legacy 177 and Migrated page 177.
To Reproduce
Steps to reproduce the behavior:
Screenshots
Additional information
PrestaShop version: 1.7.6, 1.7.7
PHP version: N/A
Hi @Robin-Fischer-PS, @matthieu-rolland,
The Message is not clear.
It should be like this for example
An error occurred while changing order status, or we were unable to send an email to the customer.
In the BO => Adanavced Parameters => Email => if you configure the Email section => it will be ok.
https://drive.google.com/file/d/1OCi5-ocPq87GFbaZhXdtM6uUlmb35mPA/view
Thanks!
Hi @khouloudbelguith ,
The main problem here is that this message should not appear at all : There should not be an error when doing a cancellation !
Here the issue appears when the email is not configured.
The problem comes from the legacy code, it calls several functions that return false if something goes wrong, but we don't know what went wrong.
It would need to be refactored, with proper exceptions, so that we can differentiate errors, but then we would have to take our modifications into account everywhere the involved methods are called, in order not to cause functional BC breaks.
What we could do:
or we were unable to send an email to the customer
@MatShir , @colinegin , what do you think ?
Yep @matthieu-rolland , that's right ! Having a message only saying "We were unable to send an email to the customer" instead of, for example, "Your shop has suffered a critical error and must be annihilated, or we were unable to send an email to the customer" would be really useful for our tests :smile:
haha yes... I was more thinking about the reverse situation, for example:
An error occurred while changing order status, or we were unable to send an email to the customer
Just by reading this you can't really be sure if it's really because you have no email configuration, or because there was actually an issue.
so as seen with @MatShir I'll change the error message.
Fixed by #17702
Most helpful comment
Yep @matthieu-rolland , that's right ! Having a message only saying "We were unable to send an email to the customer" instead of, for example, "Your shop has suffered a critical error and must be annihilated, or we were unable to send an email to the customer" would be really useful for our tests :smile: