Jump to content

mail send on current_status modification via sql query


info@babylinoshop.co

Recommended Posts

Hello everybody,

I'm facing an issue I cannot solve so i wonder if anyone else had same problem.

 

I'm using prestashop 1.6 for the e-shop, but once an order is registered data are being passed to an external system who grabs all needed info with an SQL query (mainly based on ps_orders but with several joins on other tables).

once the order is processed and sent, I'd like to update back the prestashop DB modyfing the current_status in ps_orders; of course this is simple to be realized, but the issue arise because no mail is sent to the customer, while if I manually modify the status order using BO a mail is sent as soon as the new status is clicked.

 

is it possible to make PS ready to send mails when the status is modified on the DB as well? the label is properly being modified in the BO, but once again no mail is sent (even if the option "send mail" is thicked)

 

thanks in advance to everyone!

 

Francesca

Link to comment
Share on other sites

Hi,

thanks for your answer!

I managed to find a solution writing a script with following code:

 

include(dirname(__FILE__).'/config/config.inc.php');
require(dirname(__FILE__).'/classes/order/Order.php');
require(dirname(__FILE__).'/classes/order/OrderHistory.php');
$objOrder = new Order(73); //for id_order 73 as example
$history = new OrderHistory();
$history->id_order = (int)$objOrder->id;
$history->changeIdOrderState(4, (int)($objOrder->id));
$history->addWithemail(true);
 
now the status is modified and the mail is properly sent.
 
of course parameters are caught by DB queryies and saved in arrays to be used for script cycling
 
I'm now trying to include tracking number in shipped email, nut I'll open a new post for this
 
regards,
Francesca
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...