PrestaShop / PrestaShop

PrestaShop is the universal open-source software platform to build your e-commerce solution.
https://www.prestashop-project.org/
Other
8.16k stars 4.81k forks source link

PaymentModule: confusing e-mails order for a new order #17346

Open rmilecki opened 4 years ago

rmilecki commented 4 years ago

Describe the bug When placing an order most users (customers) expect to receive order confirmation e-mail followed by status update e-mails. PresaShop first sends e-mail about order state and then e-mail confirming is has been placed.

To Reproduce Steps to reproduce the behavior:

  1. Place an order in FO
  2. Check received e-mails

First expected e-mail: order_conf First received e-mail: preparation

Additional information PrestaShop version: 1.7.6.2 PHP version: 7.1.33

rmilecki commented 4 years ago

Code responsible for sending e-mails for a new order can be found in PaymentModule.php in the validateOrder(). First it sends e-mail related to the order state:

// Set the order status
$new_history = new OrderHistory();
$new_history->id_order = (int) $order->id;
$new_history->changeIdOrderState((int) $id_order_state, $order, true);
$new_history->addWithemail(true, $extra_vars);

and later it sends e-mail confirming an order:

// Send an e-mail to customer (one order = one email)
if ($id_order_state != Configuration::get('PS_OS_ERROR') && $id_order_state != Configuration::get('PS_OS_CANCELED') && $this->context->customer->id) {
    (...)
}

Unfortunately I'm not experienced enough with PrestaShop code to fix it on my own.

rmilecki commented 4 years ago

I think it's not a duplicate of #17332 (unless I'm wrong) but they may be related. It may be worth to consider both issues while fixing any of them.

khouloudbelguith commented 4 years ago

Hi @rmilecki,

Thanks for your report. I think it could be an improvement more than a bug. I have the same behavior as PS1.7.6.3 & PS1.7.5.2 image The order_conf email is received after the preparation email.

First expected e-mail: order_conf First received e-mail: preparation

Ping @PrestaShop/prestashop-product-team what do you think of this improvement?

Thanks!

khouloudbelguith commented 4 years ago

@rmilecki, If you have already fixed it on your end or if you think you can do it, please do send us a pull request!

Thanks!

colinegin commented 4 years ago

@LouiseBonnard it seems like it is a comment we have already had in the past about the confusing content used in the order conf email. Do you remember if we already have such issue in the backlog ?