Jump to content

sending a second email when an order is made to another email address


ather1

Recommended Posts

Afternoon everyone - first post :) . Just found prestashops new stock control to be a real benefit over another cart i was using- anyway.................

 

I'm trying to adapt the email notifications.

 

When an order is created in the back office (manually by the admin) an email confirmation is sent to the default store email, what i would like to do is also send a slightly edited version of that email to another set email address (the store room) that will hold just basic item and delivery address information.

 

any assistance would be greatly appreciated.

Link to comment
Share on other sites

ather,

is it REALLY necessary to change the Email? If not really a must, easiest is to just automatically forward the Email from the first receiving Email address to the store room, using a 'rule'.

 

If not, let us know, then we check the source code where to edit...

 

My "simplicity above all" 2 cents,

pascal

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

Hi PascalVG

 

We'd like the full email (with costs/invoice) to go to the shop contact - and an edited version of the email that just holds the products & product quantity information to go to a store man when an order is made.

 

just not sure which files i should edit, thanks,

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

Hi ather,

I expect you should edit the file: classes/Mail.php

 

 

here you find the function Send()

 

almost at the end, it really sends the email using this piece of code:

 

/* Send mail */

$send = $swift->send($message, $to, new Swift_Address($from, $from_name));

$swift->disconnect();

return $send;

 

just above this piece of code, the $message is assembled.

So you can add something like this:

 

if ($template ='order_conf')

{

assemble new message...

$storemansend= swift->send($modifiedmessage, $storemanEmail, new Swift_Address($from, $from_name))

}

 

(maybe put this storeman email just BEFORE the original send, so that the "return $send;" stays the same)

 

 

N.B. he Send function is called from classes/PaymentModule.php:

function validateOrder()

almost at the end you see this piece of code:

  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
   );

 

 

My 2 cents,

pascal

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