Jump to content

Mess with names in email notifications


Recommended Posts



We have gift service and constantly facing with the same issue: in most cases our buyers are buying products not for themselves, but for friends.


Case #1: During checkout a buyer enters own email address and Delivery Address (and, sure, name of recipient). In this case recepients's name is only one name we have and all email notifications use it. In this case I don't see possibilities to fix it. Maybe you have advices.


Case #2: During checkout a buyer enters additional Billing Address which, actually, have name of the buyer. And we want to include name/surename from billing address to the email. Can you please advice how to do this? {firstname} and {lastname} reffers to the Delivery address.


Looking forward to hear from you!

Link to comment
Share on other sites

You haven't posted your prestashop version in use.... up to V 1.6. all emails sent are using ./classes/Mail.php. There you could try to enhance for other names.

In terms of data schema prestashop uses the CUSTOMER names. Hence it does not make a difference if the address names changes. Or in other words: it uses only one name from the customer table.

Link to comment
Share on other sites

Everything is doable. It is only a matter of time. I can't just spend some hours on that but instead can only give you some hints.
The first hin is: Your inital statement is wrong. The firstnames and lastnames are taken from the customer account and not from the addresses.
The second one: there is class named Mail.php. This class is used for all mail sending.
The other option would be to use PaymentModule.php instead. But this class is only used for the order confirmation mail.
Refering to the latter file, this is the code where the names are filled with values:

$data = array(
                        '{firstname}' => $this->context->customer->firstname,
                        '{lastname}' => $this->context->customer->lastname,

As you can see, there is no address object used here. You code shoud then rather look like this:

$data = array(
                    '{firstname}' => $delivery->firstname,
                    '{lastname}' => $delivery->lastname,

of course with some checking for correct data or different delivery and billing address ids etc. All above relateds to PaymentModule.php which ONLY acts when sending initial order confirmation. If you wan't to have a global solution, you needed to use Mail.php instead.

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