Jump to content

Add order message to confirmation email PS 1.6


Recommended Posts

Hi

 

in PS1.6.0.14 i try to add order message to email config.

 

made change in classes/paymentModule.php

 

add in 692

$order_message = Message::getMessagesByOrderId($order->id, false);

add in 747

'{order_message}' => $order_message[0]['message']

This worked fine in PS 1.4 but in PS 1.6 the BO orders does not load anymore .

 

Any clues?

 

 

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...
  • 4 weeks later...

I cant get it to work :-(

Running PrestaShop version: 1.6.0.14 with default-bootstrap Theme

 

Below a small piece of PaymentModule.php where i have added the lines in Bold

I have also added {message} in the order_conf.html - but i still only get the text: {message} in the email :-(

 

// Send an e-mail to customer (one order = one email)

if ($id_order_state != Configuration::get('PS_OS_ERROR') && $id_order_state != Configuration::get('PS_OS_CANCELED') && $this->context->customer->id)
{
$invoice = new Address($order->id_address_invoice);
$delivery = new Address($order->id_address_delivery);
$delivery_state = $delivery->id_state ? new State($delivery->id_state) : false;
$invoice_state = $invoice->id_state ? new State($invoice->id_state) : false;
$customer_message = $order->getFirstMessage();
 
$data = array(
'{message}' => $customer_message,
'{firstname}' => $this->context->customer->firstname,
'{lastname}' => $this->context->customer->lastname,
'{email}' => $this->context->customer->email,
Link to comment
Share on other sites

Hi Stofferdreng,

 

This is how the codes is on my file (below) and it seems that it matches yours so it seems that the mistake comes from your email template modification rather.

 

Can you show how you have modified the email template? Did you do html and txt versions?

if ($id_order_state != Configuration::get('PS_OS_ERROR') && $id_order_state != Configuration::get('PS_OS_CANCELED') && $this->context->customer->id)
					{
						$invoice = new Address($order->id_address_invoice);
						$delivery = new Address($order->id_address_delivery);
						$delivery_state = $delivery->id_state ? new State($delivery->id_state) : false;
						$invoice_state = $invoice->id_state ? new State($invoice->id_state) : false;
                                                $customer_message = $order->getFirstMessage();

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

						....
Link to comment
Share on other sites

I have only modified the html template.... please see code below, "message" area marked with Bold

 

<table class="table table-mail" style="width: 100%; margin-top: 10px; -webkit-box-shadow: #afafaf 0px 0px 5px; box-shadow: #afafaf 0px 0px 5px;">

<tbody>
<tr>
<td class="space" style="width: 20px; border: none; padding: 7px 0;"> </td>
<td style="border: none; padding: 7px 0;" align="center">
<table class="table" style="width: 100%; background-color: #fff;">
<tbody>
<tr>
<td class="logo" style="border-bottom: 4px solid #333!important; border: none; padding: 7px 0;" align="center"><a style="color: #337ff1;" title="{shop_name}" href="{shop_url}"> <img src="{shop_logo}" alt="{shop_name}" /> </a></td>
</tr>
<tr>
<td class="titleblock" style="border: none; padding: 7px 0;" align="center">
<p><span class="title" style="font-weight: 500; font-size: 28px; text-transform: uppercase; line-height: 33px;">HEJ {firstname}</span><br /> <span class="subtitle" style="font-weight: 500; font-size: 16px; text-transform: uppercase; line-height: 25px;">DETTE ER EN AUTOMATISK BESTILLINGS BEKRÆFTELSE.</span></p>
<p><strong>DU VIL MODTAGE EN ORDREBEKRÆFTELSE NÅR VORES KUNDESERVICE HAR VIDEREBEHANDLET DIN BESTILLING</strong></p>
</td>
</tr>
<tr>
<td class="space_footer" style="padding: 0!important; border: none;"> </td>
</tr>
<tr>
<td class="box" style="background-color: #fbfbfb; border: 1px solid #d6d4d4!important; padding: 10px!important;" colspan="3">
<p style="margin: 3px 0 7px; text-transform: uppercase; font-weight: 500; font-size: 18px; border-bottom: 1px solid #d6d4d4!important; padding-bottom: 10px;">Bestillings detaljer</p>
<p><span style="color: #777;"><span style="color: #333;"><strong>ID:</strong></span> {order_name} afgivet {date}</span><span style="color: #777;"><br /><span style="color: #333;"><strong>Betaling:</strong></span> {payment}<br /><span style="color: #333;"><strong>Rekv. nr. / besked:</strong></span> {message}</span></p>
</td>
</tr>
<tr>
<td style="border: none; padding: 7px 0;">
<table class="table table-recap" style="width: 100%; background-color: #fff;" bgcolor="#ffffff"><!-- Title -->
<thead>
<tr>
<th style="background-color: #fbfbfb; font-family: Arial; color: #333333; font-size: 13px; padding: 10px; border: 1px solid #dddddd !important; text-align: left;">Varenummer</th>
<th style="background-color: #fbfbfb; font-family: Arial; color: #333333; font-size: 13px; padding: 10px; border: 1px solid #dddddd !important; text-align: left;">Vare</th>
<th style="background-color: #fbfbfb; font-family: Arial; color: #333333; font-size: 13px; padding: 10px; border: 1px solid #dddddd !important; text-align: left;">Pris</th>
<th style="background-color: #fbfbfb; font-family: Arial; color: #333333; font-size: 13px; padding: 10px; border: 1px solid #dddddd !important; text-align: left;">Antal</th>
<th style="background-color: #fbfbfb; font-family: Arial; color: #333333; font-size: 13px; padding: 10px; border: 1px solid #dddddd !important; text-align: left;">Pris i alt</th>
</tr>
</thead>
<tbody>
<tr>
<td style="color: #777; padding: 10px!important; border: 1px solid #DDD!important;" colspan="5">{products}</td>
</tr>
<tr>
<td style="color: #777; padding: 10px!important; border: 1px solid #DDD!important;" colspan="5">{discounts}</td>
</tr>
<tr class="conf_body">
<td style="color: #333; padding: 10px!important; border: 1px solid #DDD!important;" colspan="4" align="right" bgcolor="#fbfbfb"><strong>Varer</strong></td>
<td style="color: #333; padding: 10px!important; border: 1px solid #DDD!important;" align="right" bgcolor="#fbfbfb">{total_products}</td>
</tr>
<tr class="conf_body">
<td style="color: #333; padding: 10px!important; border: 1px solid #DDD!important;" colspan="4" align="right" bgcolor="#fbfbfb"> </td>
<td style="color: #333; padding: 10px!important; border: 1px solid #DDD!important;" align="right" bgcolor="#fbfbfb"> </td>
</tr>
<tr class="conf_body">
<td style="color: #333; padding: 10px!important; border: 1px solid #DDD!important;" colspan="4" align="right" bgcolor="#fbfbfb"> </td>
<td style="color: #333; padding: 10px!important; border: 1px solid #DDD!important;" align="right" bgcolor="#fbfbfb"> </td>
</tr>
<tr class="conf_body">
<td style="color: #333; padding: 10px!important; border: 1px solid #DDD!important;" colspan="4" align="right" bgcolor="#fbfbfb">
<p><font size="2" color="#555454" face="Open-sans, sans-serif"><strong>Forsendelse inkl. miljøafgift (inkl. moms)</strong></font></p>
<p><font size="2" color="#555454" face="Open-sans, sans-serif"><strong> samt administrationsgebyr på order under 2.500</strong></font></p>
</td>
<td style="color: #333; padding: 10px!important; border: 1px solid #DDD!important;" align="right" bgcolor="#fbfbfb">{total_shipping}</td>
</tr>
<tr class="conf_body">
<td style="color: #333; padding: 10px!important; border: 1px solid #DDD!important;" colspan="4" align="right" bgcolor="#fbfbfb"><strong>Moms i alt</strong></td>
<td style="color: #333; padding: 10px!important; border: 1px solid #DDD!important;" align="right" bgcolor="#fbfbfb">{total_tax_paid}</td>
</tr>
<tr class="conf_body">
<td class="total" style="color: #555454; padding: 10px!important; border: 1px solid #DDD!important; font-size: 18px; font-weight: 500; font-family: Open-sans, sans-serif;" colspan="4" align="right" bgcolor="#fbfbfb"><strong>Fakturabeløb i alt  (inkl. moms)</strong></td>
<td class="total_amount" style="color: #333; padding: 10px!important; border: 1px solid #DDD!important; font-size: 21px; font-weight: 500; font-family: Open-sans, sans-serif;" align="right" bgcolor="#fbfbfb">{total_paid}</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="box" style="background-color: #fbfbfb; border: 1px solid #d6d4d4!important; padding: 10px!important;" colspan="3">
<p style="margin: 3px 0 7px; text-transform: uppercase; font-weight: 500; font-size: 18px; border-bottom: 1px solid #d6d4d4!important; padding-bottom: 10px;">Forsendelse</p>
<span style="color: #777;"><span style="color: #333;"><strong>Forsendelsesfirma:</strong></span> {carrier}<br /></span></td>
</tr>
<tr>
<td class="space_footer" style="padding: 0!important; border: none;"> </td>
</tr>
<tr>
<td style="border: none; padding: 7px 0;">
<table class="table" style="width: 100%; background-color: #fff;">
<tbody>
<tr>
<td class="box address" style="background-color: #fbfbfb; border: 1px solid #d6d4d4!important; padding: 10px!important;" width="310">
<p style="margin: 3px 0 7px; text-transform: uppercase; font-weight: 500; font-size: 18px; border-bottom: 1px solid #d6d4d4!important; padding-bottom: 10px;">Leveringsadresse</p>
<span style="color: #777;"> {delivery_block_html} </span></td>
<td class="space_address" style="border: none; padding: 7px 0;" width="20"> </td>
<td class="box address" style="background-color: #fbfbfb; border: 1px solid #d6d4d4!important; padding: 10px!important;" width="310">
<p style="margin: 3px 0 7px; text-transform: uppercase; font-weight: 500; font-size: 18px; border-bottom: 1px solid #d6d4d4!important; padding-bottom: 10px;">Faktura adresse</p>
<span style="color: #777;"> {invoice_block_html} </span></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="space_footer" style="padding: 0!important; border: none;"> </td>
</tr>
<tr>
<td class="linkbelow" style="border: none; padding: 7px 0;">Du kan følge denne og dine tidligere bestillinger ved at klikke her: <a style="color: #337ff1;" href="{my_account_url}">"Min konto"</a></td>
</tr>
<tr>
<td class="footer" style="border-top: 4px solid #333!important; border: none; padding: 7px 0;"><a href="http://www.roxtec.com/dk/newsletter-signup/signature"><img src="http://www.roxtec-order.dk/img/cms/Roxtecnews.png" alt="" width="567" height="74" /> </a></td>
</tr>
</tbody>
</table>
</td>
<td class="space" style="width: 20px; border: none; padding: 7px 0;"> </td>
</tr>
</tbody>
</table>
Link to comment
Share on other sites

Allright, I see. It is better that you do this modification through your email templates in the PS back-office (in email translations) rather than through the files on the server, to avoid any mistakes.

 

Just go in the emails translation section of the BO:  core emails / order_conf    and add the text as below:

 

- In htlml version, wherever you want the message to appear in the template: YOUR MESSAGE: '{message}' 

- In text version: same

 

YOUR MESSAGE: {message} 

 

This is just raw editing. Then you can do any visual modifications/customization also if you like.

 

Don't forget to undo the modifications you did on the server to avoid overlaping 

Edited by MilkSheikh (see edit history)
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...