goosedesign Posted May 17, 2011 Share Posted May 17, 2011 Does anyone know how to go about feeding the customer message text in to the customer email? It already goes to the store owner in the email generated by the mailalerts module, but would be good to reassure the customer by echoing it back to them. This is using 1.3.2.3 with Onepage Checkout module. Also conversely, the customized data information gets fed in to the customer email, but is not sent to the store owner. Anyone know where this data comes from and how to feed it in to the mailalerts email to the store owner? Link to comment Share on other sites More sharing options...
goosedesign Posted May 19, 2011 Author Share Posted May 19, 2011 (edited) If anyone else wants this, the following appears to work: 1. In classes/PaymentModule.php, add the following just before the $data array (around line 380): $customer_message = $order->getFirstMessage(); 2. Same file, add the following to the $data array: '{message}' => $customer_message 3. Place {message} wherever you want it in mails/en/order_conf.html and the .txt one too. Edited June 7, 2012 by goosedesign (see edit history) 4 1 Link to comment Share on other sites More sharing options...
domorodecmezilidmi Posted January 26, 2015 Share Posted January 26, 2015 FANTASTIC, thx. 1 Link to comment Share on other sites More sharing options...
MilkSheikh Posted July 28, 2015 Share Posted July 28, 2015 Excellent, thanks for posting the trick ! Link to comment Share on other sites More sharing options...
soonflex Posted June 8, 2016 Share Posted June 8, 2016 (edited) Hi, i still have problem with {message} template var in Prestashop 1.6. In classes/PaymentModule.php I added: $customer_message = $order->getFirstMessage(); '{message}' => $customer_message and in /themes/my_theme/mails/ i put {message} tag.And it still doesn't work. I am getting mails with not parsed {message} tag. Edited June 8, 2016 by soonflex (see edit history) Link to comment Share on other sites More sharing options...
graxu Posted May 10, 2017 Share Posted May 10, 2017 Works for me Thanks! Link to comment Share on other sites More sharing options...
editorstefan Posted August 8, 2017 Share Posted August 8, 2017 Hi, i still have problem with {message} template var in Prestashop 1.6. In classes/PaymentModule.php I added: $customer_message = $order->getFirstMessage(); '{message}' => $customer_message and in /themes/my_theme/mails/ i put {message} tag. And it still doesn't work. I am getting mails with not parsed {message} tag. This does not work for me neither. Also use Prestashop 1.6. Any idea? Link to comment Share on other sites More sharing options...
sooroos Posted October 5, 2017 Share Posted October 5, 2017 Hi, try the following: override the Paymentmodule.php as it follows: 1. add the following function: public function getAllMessages($id) { $messages = Db::getInstance()->executeS(' SELECT `message` FROM `'._DB_PREFIX_.'message` WHERE `id_order` = '.(int)$id.' ORDER BY `id_message` ASC'); $result = array(); foreach ($messages as $message) $result[] = $message['message']; return implode('<br/>', $result); } 2. copy the entire function "public function validateOrder" from the original file PaymentModule.php and paste it in the override file, then look for the part $data = array(... and add the following line: '{message}' => $this->getAllMessages($order->id), now you can use {message} variable in your email template 1 Link to comment Share on other sites More sharing options...
patuga Posted July 6, 2018 Share Posted July 6, 2018 how to make this work in Prestashop 1.7? Link to comment Share on other sites More sharing options...
rachel01 Posted November 18, 2020 Share Posted November 18, 2020 up PS 1.7 please Link to comment Share on other sites More sharing options...
rrataj Posted November 28, 2020 Share Posted November 28, 2020 To add customer message to order confirmation e-mail you need to add to "/classes/PaymentModule.php" file just above the line where email variables are being assigned (around line ~580) something like this: $mo = Message::getMessageByCartId((int) $this->context->cart->id); $m = ''; if( !empty($mo) ) { $m = $mo['message']; } And then add this variable to $data array like: $data = array( '{firstname}' => $this->context->customer->firstname, ..., '{message}' => $m ); Then you will be able to edit email translations in "International" -> "Translations" -> "Email translations" -> "Body" -> your theme -> your language -> Section "core emails" -> Type: "order_conf", and use {message} variable inside. Or you can edit email template in your files directly -> /themes/your_theme/mails/en/order_conf.html After all this the best would be to copy code (only the function which was changed) from PaymentModule class and put it into override folder, to prevent it from being deleted during PS core upgrade. 2 Link to comment Share on other sites More sharing options...
MarkoPP Posted December 17, 2020 Share Posted December 17, 2020 Hi, i have problem on this customer message at prestashop 1.7.5 and when customer sends message on order confirmation, all of these scandic mark ÖÄäö are gone to html marks like below on admin panel side when looking customers messages. &auml;&auml;kk&ouml;sten Any ideas where i can check this? all other message boxes works fine and are not breaking scandinavian characters. Only this order confirmation box (on srep 3 where select carrier) are breaking those special scandinavian characters. Link to comment Share on other sites More sharing options...
rrataj Posted December 17, 2020 Share Posted December 17, 2020 Hey, I've tried to reproduce the issue but it works fine for me in PS 1.7.6.9 Link to comment Share on other sites More sharing options...
Cierzo Posted April 15, 2021 Share Posted April 15, 2021 PERFECT, ty so much! Link to comment Share on other sites More sharing options...
***didi*** Posted July 7, 2023 Share Posted July 7, 2023 Am 28.11.2020 um 1:35 PM schrieb rrataj: To add customer message to order confirmation e-mail you need to add to "/classes/PaymentModule.php" file just above the line where email variables are being assigned (around line ~580) something like this: $mo = Message::getMessageByCartId((int) $this->context->cart->id); $m = ''; if( !empty($mo) ) { $m = $mo['message']; } And then add this variable to $data array like: $data = array( '{firstname}' => $this->context->customer->firstname, ..., '{message}' => $m ); Then you will be able to edit email translations in "International" -> "Translations" -> "Email translations" -> "Body" -> your theme -> your language -> Section "core emails" -> Type: "order_conf", and use {message} variable inside. Or you can edit email template in your files directly -> /themes/your_theme/mails/en/order_conf.html After all this the best would be to copy code (only the function which was changed) from PaymentModule class and put it into override folder, to prevent it from being deleted during PS core upgrade. Does not work for PS 1.7.6.9, I only get {message} in mail if message is empty. Is there any solution to get for example "No customer message" oder something like that? Link to comment Share on other sites More sharing options...
rrataj Posted July 7, 2023 Share Posted July 7, 2023 3 minutes ago, ***didi*** said: Does not work for PS 1.7.6.9, I only get {message} in mail if message is empty. Is there any solution to get for example "No customer message" oder something like that? What if message is filled in? Do you have this content inside emails or always you get {message}? 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