Prestashop: Error when canceling last product of an order

Created on 12 Feb 2020  路  7Comments  路  Source: PrestaShop/PrestaShop

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:

  1. Activate merchandise return
  2. Go to an unpaid order
  3. Cancel all products of the order (using the "Cancel products" button)
  4. An error is displayed

Screenshots
pr17149 cancel all legacy

Additional information
PrestaShop version: 1.7.6, 1.7.7
PHP version: N/A

1.7.5.2 1.7.6.3 1.7.7.x BO Bug Fixed Order Trivial

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:

All 7 comments

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.
image

In the BO => Adanavced Parameters => Email => if you configure the Email section => it will be ok.
image

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:

  • For now: I can change the error message, adding or we were unable to send an email to the customer
  • Later: I can create an issue regarding those error messages that appear when there is no email configuration (they are annoying for the QA team because they never know wether the error is coming from the lack of email configuration or if it's because the feature is actually going wrong. (if I understood you well @Robin-Fischer-PS )

@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

Was this page helpful?
0 / 5 - 0 ratings