Page 1 of 1
order comments also displayed in invoice
Posted: Sun Feb 07, 2010 4:11 pm
by fume711
is there a mod for this? I tried to add in file cart\admin\controller\customer\order.php
Code: Select all
$this->data['order_comment'] = nl2br($order_info['comment']);
into the section
Code: Select all
public function invoice() {
$this->load->language('customer/order');
but it's not able to pull up the data. Is the code even correct to pull up the order comments (not the order history comments)?
Re: order comments also displayed in invoice
Posted: Wed Apr 14, 2010 6:43 pm
by sunburn1979
Has this question been answered?
I would like to be able to pull in order comments into the generated invoice also!
Re: order comments also displayed in invoice
Posted: Sun Apr 18, 2010 12:24 pm
by matthew@wormsetc.com
Yes it would be great if someone would look at this it would be a huge help.
I tried to add something like the following into the order_invoices.tpl but it did not work. I think it has something to do with variables but I don't know anything about programing so...
Re: order comments also displayed in invoice
Posted: Mon Apr 19, 2010 12:03 am
by Qphoria
1. EDIT: admin/controller/sale/order.php
2. FIND:
3. AFTER, ADD:
Code: Select all
'comments' => $order_info['comments'],
4. EDIT: admin/view/template/sale/order_invoice.tpl
5. FIND (at the bottom):
Code: Select all
</table>
</div>
<?php } ?>
</body>
</html>
6: BEFORE, ADD:
Code: Select all
<tr>
<td>Comments:</td>
<td><?php echo $order['comments']; ?></td>
</tr>
Re: order comments also displayed in invoice
Posted: Fri Apr 23, 2010 11:37 am
by matthew@wormsetc.com
That was close, but I could not get it to work. It gave an undefined index error.
However in my stubborn persistence I figured that you also needed to add the following on admin/controller/sale/order.php in the invoices.tpl section.
Code: Select all
$this->data['order_comment'] = nl2br($order_info['comment']);
Re: order comments also displayed in invoice
Posted: Sun May 09, 2010 5:30 am
by squarederick
matthew@wormsetc.com wrote:That was close, but I could not get it to work. It gave an undefined index error.
However in my stubborn persistence I figured that you also needed to add the following on admin/controller/sale/order.php in the invoices.tpl section.
Code: Select all
$this->data['order_comment'] = nl2br($order_info['comment']);
I'm also getting an Undefined Index error. Where in admin/controller/sale/order.php does one place the above line?
Re: order comments also displayed in invoice
Posted: Wed May 19, 2010 12:41 am
by neilscott
This still doesn't work for me. Does anybody know what sections it needs to be added in to work properly?
Thanks!
Re: order comments also displayed in invoice
Posted: Wed May 19, 2010 2:58 am
by Qphoria
FYI this has been added to 1.4.8
Re: order comments also displayed in invoice
Posted: Mon Jul 05, 2010 4:56 pm
by tilesupply
How can i get this to work as i am also getting an error in V1.4.7
Many Thanks
Re: order comments also displayed in invoice
Posted: Wed Jul 21, 2010 12:33 am
by ifyouseek
Re: order comments also displayed in invoice
Posted: Wed Sep 08, 2010 9:14 am
by ifyouseek
Q's solution above works!!!! the only problem with it is the word 'comments' needs replaced with 'comment'. Thanks
Re: order comments also displayed in invoice
Posted: Mon Sep 27, 2010 6:11 pm
by hamasaki
Qphoria wrote:FYI this has been added to 1.4.8
I`ve just downloaded the latest version and comments are not shown on the order.
Re: order comments also displayed in invoice
Posted: Tue Feb 15, 2011 12:31 pm
by gozzilionare
hamasaki wrote:Qphoria wrote:FYI this has been added to 1.4.8
I`ve just downloaded the latest version and comments are not shown on the order.
That's right. Any solution for this?
Re: order comments also displayed in invoice
Posted: Wed Mar 09, 2011 8:20 am
by Jeremy54
This will show the last comment in your order history on the invoice - good for notifying customer of any issues with their order on the invoice page. Tested and working for 1.4.8
In admin/language/english/sale/order.php
Find:
Change to:
Code: Select all
$_['column_comment'] = 'Customer Comments';
$_['column_order_comment'] = 'Order Comments';
In admin/controller/sale/order.php
Find:
Code: Select all
$this->data['column_comment'] = $this->language->get('column_comment');
$this->data['logo'] = DIR_IMAGE . $this->config->get('config_logo');
Replace with:
Code: Select all
$this->data['column_comment'] = $this->language->get('column_comment');
$this->data['column_order_comment'] = $this->language->get('column_order_comment');
$this->data['logo'] = DIR_IMAGE . $this->config->get('config_logo');
In the same file, admin/controller/sale/order.php
Find:
Code: Select all
$total_data = $this->model_sale_order->getOrderTotals($order_id);
$this->data['orders'][] = array(
'order_id' => $order_id,
'invoice_id' => $invoice_id,
'date_added' => date($this->language->get('date_format_short'), strtotime($order_info['date_added'])),
'store_name' => $order_info['store_name'],
'store_url' => rtrim($order_info['store_url'], '/'),
'address' => nl2br($this->config->get('config_address')),
'telephone' => $this->config->get('config_telephone'),
'fax' => $this->config->get('config_fax'),
'email' => $this->config->get('config_email'),
'shipping_address' => $shipping_address,
'payment_address' => $payment_address,
'customer_email' => $order_info['email'],
'ip' => $order_info['ip'],
'customer_telephone'=> $order_info['telephone'],
'comment' => $order_info['comment'],
'product' => $product_data,
'total' => $total_data
);
Replace with:
Code: Select all
$total_data = $this->model_sale_order->getOrderTotals($order_id);
$order_comment = '';
$order_history = $this->model_sale_order->getOrderHistory($order_id);
$last_history_item = $order_history[sizeof($order_history)-1];
if(strpos($last_history_item['comment'], 'AVSCODE') === false) {
$order_comment = nl2br($last_history_item['comment']);
}
$this->data['orders'][] = array(
'order_id' => $order_id,
'invoice_id' => $invoice_id,
'date_added' => date($this->language->get('date_format_short'), strtotime($order_info['date_added'])),
'store_name' => $order_info['store_name'],
'store_url' => rtrim($order_info['store_url'], '/'),
'address' => nl2br($this->config->get('config_address')),
'telephone' => $this->config->get('config_telephone'),
'fax' => $this->config->get('config_fax'),
'email' => $this->config->get('config_email'),
'shipping_address' => $shipping_address,
'payment_address' => $payment_address,
'customer_email' => $order_info['email'],
'ip' => $order_info['ip'],
'customer_telephone'=> $order_info['telephone'],
'comment' => $order_info['comment'],
'order_comment' => $order_comment,
'product' => $product_data,
'total' => $total_data
);
In regards to the if statement above
if(strpos($last_history_item['comment'], 'AVSCODE') === false) {
This is a little hack keep from displaying the comment that the paypal module makes when the sale is complete.
And then in admin/view/template/sale/order_invoice.tpl
Find:
Code: Select all
<table class="product">
<tr class="heading">
<td><b><?php echo $column_comment; ?></b></td>
</tr>
<tr>
<td><?php echo $order['comment']; ?></td>
</tr>
</table>
Replace with:
Code: Select all
<?php if(strlen($order['order_comment'])>0) { ?>
<table class="product">
<tr class="heading">
<td><b><?php echo $column_order_comment; ?></b></td>
</tr>
<tr>
<td><?php echo $order['order_comment']; ?></td>
</tr>
</table>
<?php } ?>
<?php if(strlen($order['comment'])>0) { ?>
<table class="product">
<tr class="heading">
<td><b><?php echo $column_comment; ?></b></td>
</tr>
<tr>
<td><?php echo $order['comment']; ?></td>
</tr>
</table>
<?php } ?>
It would be ideal to add a checkbox in the order history comments to 'Add to invoice', however this was a quick fix. If you don't want an order comment to display on the invoice you can just add a blank comment to the order history.
Re: order comments also displayed in invoice
Posted: Thu Mar 29, 2012 10:36 pm
by lloydmedley
Jeremy54 wrote:This will show the last comment in your order history on the invoice - good for notifying customer of any issues with their order on the invoice page. Tested and working for 1.4.8
I know this is just over a year old now(!) but just did this on 1.4.9.4 with slight modification it worked

thanks
Really handy for orders where you have one or two items out of stock, you can easily add a comment to say x and y will be shipped seperately then add another note to say here x and y, a and b were sent earlier
Re: order comments also displayed in invoice
Posted: Tue Jul 23, 2013 8:31 pm
by lloydmedley
Anyone know how to get ths working with 1.5.x?
Re: order comments also displayed in invoice
Posted: Thu Sep 04, 2014 6:45 pm
by picklepops
I did this for version 1.5.6
edit admin/view/template/sale/order_invoice.tpl
Edit the table at line 14 and use this...
<table border="0" style="padding-top:40px;" width=100%>
<tr>
<td width="75%" height="190" valign="top" style="font-size:18px; font-family: arial;"><?php echo $order['shipping_address']; ?>
</td>
<!-- add comment to invoice address -->
<?php if ($order['comment']) { ?>
<td valign="top">
<table class="comment" border=0 align="left" width=100%>
<tr class="heading">
<td><b><?php echo $column_comment; ?></b></td>
</tr>
<tr align=left>
<td><?php echo $order['comment']; ?></td>
</tr>
</table>
</td>
<?php } ?>
</tr>
</table>
I wanted the comment on the address label, but this is what you need to insert if you want it somewhere else..
<?php echo $order['comment']; ?>
Re: order comments also displayed in invoice
Posted: Fri Nov 14, 2014 11:53 am
by stonerisefarm
lloydmedley wrote:Anyone know how to get ths working with 1.5.x?
lloydmedley, the only things that need to be changed for 1.5.6.4 in Jeremy54's ABSOLUTELY FANTASTIC code (tks heaps btw) is below:
where he says:
Jeremy54 wrote:
$order_history = $this->model_sale_order->getOrderHistory($order_id);
replace with:
Code: Select all
$order_history = $this->model_sale_order->getOrderHistories($order_id);
In the same block of code, but in the original 1.5.6.4 product file (which is different from the 1.4x file), find:
Code: Select all
$this->data['orders'][] = array(
'order_id' => $order_id,
'invoice_no' => $invoice_no,
'date_added' => date($this->language->get('date_format_short'), strtotime($order_info['date_added'])),
'store_name' => $order_info['store_name'],
'store_url' => rtrim($order_info['store_url'], '/'),
'store_address' => nl2br($store_address),
'store_email' => $store_email,
'store_telephone' => $store_telephone,
'store_fax' => $store_fax,
'email' => $order_info['email'],
'telephone' => $order_info['telephone'],
'shipping_address' => $shipping_address,
'shipping_method' => $order_info['shipping_method'],
'payment_address' => $payment_address,
'payment_company_id' => $order_info['payment_company_id'],
'payment_tax_id' => $order_info['payment_tax_id'],
'payment_method' => $order_info['payment_method'],
'product' => $product_data,
'voucher' => $voucher_data,
'total' => $total_data,
'comment' => nl2br($order_info['comment'])
);
and replace with:
Code: Select all
$this->data['orders'][] = array(
'order_id' => $order_id,
'invoice_no' => $invoice_no,
'date_added' => date($this->language->get('date_format_short'), strtotime($order_info['date_added'])),
'store_name' => $order_info['store_name'],
'store_url' => rtrim($order_info['store_url'], '/'),
'store_address' => nl2br($store_address),
'store_email' => $store_email,
'store_telephone' => $store_telephone,
'store_fax' => $store_fax,
'email' => $order_info['email'],
'telephone' => $order_info['telephone'],
'shipping_address' => $shipping_address,
'shipping_method' => $order_info['shipping_method'],
'payment_address' => $payment_address,
'payment_company_id' => $order_info['payment_company_id'],
'payment_tax_id' => $order_info['payment_tax_id'],
'payment_method' => $order_info['payment_method'],
'product' => $product_data,
'voucher' => $voucher_data,
'total' => $total_data,
'order_comment' => $order_comment,
'comment' => nl2br($order_info['comment'])
);
Using Jeremy54's addition to this block means that the "'order_comment'" line now MUST be above the line starting with "'comment'".