Jump to content

How to send bank wire email as the second?


Recommended Posts

Hi guys, I would like to ask you one thing.

 

How to make, that customer will receive as the first email confirmation of order, and THEN instructions for bank wire? Now it works that he receives firstly bank wire email and then just in few milliseconds later order confirmation.

 

Thank you for this easy help

 

Edited by domorodecmezilidmi (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...
  • 2 years later...

Just a hint, look at classes/PaymentModule.php
 
Search for these lines.... appx. around line 770. This is the part where the new order status (awaiting bankwire payment) is set and this part also sends the bank wire confirmation on the last line.
 

$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 move them down below these following lines:
This is where the actual order confirmation is sent.
 

if (Validate::isEmail($this->context->customer->email)) {
                            Mail::Send(
                                (int)$order->id_lang,
                                'order_conf',
                                Mail::l('Order confirmation', (int)$order->id_lang),
                                $data,
                                $this->context->customer->email,
                                $this->context->customer->firstname.' '.$this->context->customer->lastname,
                                null,
                                null,
                                $file_attachement,
                                null, _PS_MAIL_DIR_, false, (int)$order->id_shop
                            );
                        }


If it still does not work, try with additional line sleep(1);
This delays the process of sending the bankwire email by 1 second. Why? It is possible that the second mail might overtake the frist one.

By delaying a bit, we can get rid of this behavior in most of the cases.
 

$new_history = new OrderHistory();
$new_history->id_order = (int)$order->id;
$new_history->changeIdOrderState((int)$id_order_state, $order, true);
sleep(1);
$new_history->addWithemail(true, $extra_vars);

 

Edited by Scully (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...