vnovak Posted October 2, 2017 Share Posted October 2, 2017 Hello! 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 More sharing options...
Scully Posted October 2, 2017 Share Posted October 2, 2017 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 More sharing options...
vnovak Posted October 2, 2017 Author Share Posted October 2, 2017 The version is 1.6. Not sure that get you comment right. If it is doable, can you please explain how? Thank you a lot! Link to comment Share on other sites More sharing options...
Scully Posted October 2, 2017 Share Posted October 2, 2017 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 More sharing options...
vnovak Posted October 2, 2017 Author Share Posted October 2, 2017 Scully, thank you a lot! It is really useful for me. Will share my results when will do this task. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now