Post by fume711 » Sun Feb 07, 2010 4:11 pm

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)?

New member

Posts

Joined
Tue Oct 06, 2009 2:15 pm

Post by sunburn1979 » Wed Apr 14, 2010 6:43 pm

Has this question been answered?

I would like to be able to pull in order comments into the generated invoice also!

New member

Posts

Joined
Thu Aug 13, 2009 4:36 pm

Post by matthew@wormsetc.com » Sun Apr 18, 2010 12:24 pm

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

Code: Select all

<?php echo $order['comment']; ?>


Posts

Joined
Sun Jan 24, 2010 1:21 am

Post by Qphoria » Mon Apr 19, 2010 12:03 am

1. EDIT: admin/controller/sale/order.php

2. FIND:

Code: Select all

'invoice_id'       => $invoice_id,
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>

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by matthew@wormsetc.com » Fri Apr 23, 2010 11:37 am

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']);


Posts

Joined
Sun Jan 24, 2010 1:21 am

Post by squarederick » Sun May 09, 2010 5:30 am

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?

Newbie

Posts

Joined
Mon May 03, 2010 11:11 pm

Post by neilscott » Wed May 19, 2010 12:41 am

This still doesn't work for me. Does anybody know what sections it needs to be added in to work properly?

Thanks!

Newbie

Posts

Joined
Wed May 19, 2010 12:36 am

Post by Qphoria » Wed May 19, 2010 2:58 am

FYI this has been added to 1.4.8

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by tilesupply » Mon Jul 05, 2010 4:56 pm

How can i get this to work as i am also getting an error in V1.4.7

Many Thanks

Active Member

Posts

Joined
Wed Aug 26, 2009 7:48 am


Post by ifyouseek » Wed Jul 21, 2010 12:33 am

anyone what to conjure up the fix for this. Im running 1.4.7 and although all I want to do is upgrade my shop is running fully now with 20 orders a day so i cannot afford downtime if i hit problems.

Has anyone got the above fix by Q working, it doesn't look like it.

Thanks for the help in advance, David O0 O0 :laugh: :laugh: :laugh: :clown: :crazy: :crazy: :crazy: O0 O0

Active Member

Posts

Joined
Thu May 06, 2010 4:40 pm

Post by ifyouseek » Wed Sep 08, 2010 9:14 am

Q's solution above works!!!! the only problem with it is the word 'comments' needs replaced with 'comment'. Thanks

Active Member

Posts

Joined
Thu May 06, 2010 4:40 pm

Post by hamasaki » Mon Sep 27, 2010 6:11 pm

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.

Newbie

Posts

Joined
Mon Sep 27, 2010 6:10 pm

Post by gozzilionare » Tue Feb 15, 2011 12:31 pm

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?

"I know that you cannot live on hope alone, but without it, life is not worth living." — Harvey Milk

Tikus Farm - Tikus Putih


New member

Posts

Joined
Wed Jul 14, 2010 5:06 pm

Post by Jeremy54 » Wed Mar 09, 2011 8:20 am

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:

Code: Select all

$_['column_comment']        = 'Comment';
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.

Newbie

Posts

Joined
Sat Sep 19, 2009 3:45 am

Post by lloydmedley » Thu Mar 29, 2012 10:36 pm

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

If I forgot to mention: it's OpenCart Vv1.5.6


New member

Posts

Joined
Tue Mar 29, 2011 11:18 pm

Post by lloydmedley » Tue Jul 23, 2013 8:31 pm

Anyone know how to get ths working with 1.5.x?

If I forgot to mention: it's OpenCart Vv1.5.6


New member

Posts

Joined
Tue Mar 29, 2011 11:18 pm

Post by picklepops » Thu Sep 04, 2014 6:45 pm

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']; ?>

Newbie

Posts

Joined
Thu Sep 04, 2014 6:39 pm

Post by stonerisefarm » Fri Nov 14, 2014 11:53 am

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

Newbie

Posts

Joined
Tue Nov 16, 2010 10:44 am
Who is online

Users browsing this forum: Amazon [Bot] and 52 guests