Jump to content

Insert Customer Order Message/Note Into Invoice - 1.6.0.14


democolis

Recommended Posts

Hello,

 

I am trying to insert the Order Message/Note into invoice.pdf in prestashop 1.6.0.14.

 

i have make a function stored in override/classes/order/OrderInvoice.php

 

I try to get the order message from my database with this class:

 

public static function getMessages($id_order)
{
    $messages = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
        SELECT `message`
        FROM `'._DB_PREFIX_.'message`
        WHERE `id_order` = '.(int)$id_order.'
        ORDER BY `id_message`
    ');
 
    return nl2br(implode("\n", (array)$messages));
 
}
 
How can i make it appears in my invoice.tpl? i try with {$order_detail.messages} but this does not work. Can somebody help me?
 
Can someone describe me another way to appear the message in invoice.pdf?
 
Thanks!
 
Link to comment
Share on other sites

  • 1 year later...

Hi,

 

I just implemented this feature on PS 1.6.1.7

 

Just follow https://www.prestashop.com/forums/topic/145386-adding-customer-comment-message-to-delivery-invoice-pdf/?do=findComment&comment=1676592 with following modification due to PS 1.6.1:

 

Step 4: use /pdf/invoice.product-tab.tpl instead of /pdf/invoice.tpl.

 

In my case I just added the following at the end of the /pdf/invoice.product-tab.tpl to make it looks like a table:

<!-- Customer Order Message -->
<br/>

{if isset($order_detail.first_order_message) && $order_detail.first_order_message}

<table id="order_msg" class="product" width="100%">
    <tr>
        <td class="center grey bold" width="20%">{l s='Oder Comment' pdf='true'}</td>
        <td class="left white" width="80%">{$order_detail.first_order_message}</td>
    </tr>
</table>

{/if}

It is probably not the best solution, but it works fine for me :) If somebody has a better one, pls share!

 

Regards,

Sergey

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

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