0
votes

I've search on some Prestashop forums and here on Stackoverflow but it seem that i can't find an answer for that question :

-Would it be possible to send a second email (based on a custom mail template), to the customer after the Order confirmation mail ?

The customer is buying a product, making payment, receive his order confirmation by email and then an other email would be sent to him saying a custom message.

I've looked into Email Alert Module but it doesn't look like it's meant to do that.

I'm on Prestashop v1.6

Thanks a lot for your help and time.

2
Do you have any programming skills? You will have to create a custom module for this. - Florian Lemaitre
I do but kinda new to prestashop! I'll give a try to Singh suggestion. :) - Diavlo

2 Answers

1
votes

You can achieve this by overriding the PaymentModule class.

The order confirmation mail is sent from the code inside validateOrder() function of PaymentModule class. You can simply add code to send the second email (custom email) after the order confirmation mail code.

The following code is responsible for sending Order Confirmation mail.

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

In addition to Raghubendra Singh answer. Not sure it is the best approach.

You can do it by overriding the PaymentModule class (see Mail::Send();)

To create a custom email subjet, you have to modify :

app/Resources/translations/fr-FR/EmailsSubject.fr-FR.xlf

add you subject :

<trans-unit id="fca7e8d1c86db11246e429e40aa10c82" approved="yes">
        <source>Your new subject</source>
        <target xml:lang="fr">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</target>
        <note>Context:
File: classes/PaymentModule.php:844</note>
 </trans-unit>

You can also create a new email template : add your file here : (you can copy paste one of the template and modify it to your needs)

mail/fr/new-template.html
mail/fr/new-template.txt