Jump to content

auto send email with track after automatic update db, what kind of code to use the normal module?


deech123

Recommended Posts

Hi,

 

I have my own script that import the track & trace codes automatically.

I will program a page where in cronjob I update the orders where a track code is available in my extended csv file.

this is no problem at all, but I do want to know this :

 

what kind of code do I need to send the email automatically to the client with the code?

 

i use something simular to send an email when I automatically change status with an other script like this :

$order = new Order($Id_order);
$order->setCurrentState(3);  
 
any idea if there excist also something to use the normal classes to send the email matching the ordernumber?
 
thx for any tip or clue.
 
D.
Link to comment
Share on other sites

Hi,

 

that's just the question.

 

what I need is some code like this :

$order = new Order($Id_order);
$order->setCurrentState(3);  
 
 
I will have the ID_order, and then I will say :
update ps_order_carrier, set trackcode = a parameter I will give, where ordernumber= (then the custom ordernumber)
 
that's all no problem, but after updating the order_carrier table with track and trace code,
i want to automatically send the email to the client, without any manual handling.
 
like you see the code example hereabove is to update the currentstate of an order, what I need is something simular to email the client the data oftrack and trace.
 
;-)
Link to comment
Share on other sites

For the info, I need the piece of code that I can use in PHP after I do some stuff and then the update like : 

$sql2 = "UPDATE `ps_order_carrier` SET tracking_number=$tracknummer WHERE id_order=$id_order";

 

after this code I want to call a class to send the email with trackcode to the client.

this is not done on the backend administration, this is runned by special PHP page an cronjob.

 

hope somebody knows where I can look of give me the piece of code where you can just set the Id order or orderreference.

 

D

Link to comment
Share on other sites

update : 

 

this code works allready perfect : 

            $order_carrier = new OrderCarrier($id_order_carrier);
            $order_carrier->tracking_number = $shipping_number;
            $order_carrier->update();
 
where shipping_number is my tracking-number.
 
what is the exact extra code needed to send out the email automatically (when I do it manualy in the BO, then it works perfect :-) ) but I want to call it thru a PHP file.
 
hope somebody can tell me what I miss...I can not find.
 
D.
Link to comment
Share on other sites

  • 1 month later...

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