Page 1 of 1

Customer Phone number on printable invoice (OC 1.5.0)

Posted: Fri Oct 21, 2011 2:06 am
by mr-bm
Hello,

I am having trouble getting the customer's phone number on the printable invoice. I tried tweaking the code but all I am getting is the store phone number.

I am using OpenCart 1.5.0

I would greatly appreciate if anyone can help me with this :)

Re: Customer Phone number on printable invoice (OC 1.5.0)

Posted: Sat Oct 22, 2011 12:57 pm
by Jeremy Fisk
i don't have 1.5.0, but is this a custom module or is it a standard module...

but anyway... it should just be a simple php echo in the invoice

good luck

jem

Re: Customer Phone number on printable invoice (OC 1.5.0)

Posted: Wed Oct 26, 2011 6:04 am
by mr-bm
Thanks for the reply. I still haven't been able to figure this out. In the admin side, I see a customer's phone number listed on the order details. However, after clicking "print invoice" my store's phone number is listed under the billing information instead of the customer's phone number.

Image

The php echo statement for both is <?php echo $order['telephone']; ?> which I think was there by default.

Any help would be greatly appreciated!

Thanks
-Mike

Re: Customer Phone number on printable invoice (OC 1.5.0)

Posted: Wed Oct 26, 2011 9:44 am
by smifis
Update to the latest version would sole this as it is a bug.
I dont have 1.5.0 at hand but if you dont like the idea of updating, I'll have a look later and tell you what to change

Re: Customer Phone number on printable invoice (OC 1.5.0)

Posted: Fri Nov 11, 2011 1:59 pm
by geoff m
Hi Mike,
Have you been able to fix this problem yet?
I have been ignoring it for ages and decided to re-look again today. Same as you I have little knowledge, but I have added fields to the invoice area before but I have no idea why it picks up the store phone number (in my case it also prints my email address here as well!) and I don't really know what to look for either. Hopefully someone with some knowledge can assist us here. Also using OC1.5.0
Regards
Geoff

Re: Customer Phone number on printable invoice (OC 1.5.0)

Posted: Fri Nov 18, 2011 2:37 pm
by geoff m
I found where this problem is coming from.
Edit file admin/view/template/sale/order_invoice.tpl. This will solve your problem

Re: Customer Phone number on printable invoice (OC 1.5.0)

Posted: Sat Dec 17, 2011 11:36 am
by cclower
Go to /admin/controller/sale/order.php and look for the array on or around line 1912 that looks like this:

Code: Select all

$this->data['orders'][] = array(
	'order_id'	       => $order_id,
	'invoice_no'       => $invoice_no,
	'invoice_date'     => date($this->language->get('date_format_short'), strtotime('now')),
	'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,
	'product'          => $product_data,
	'total'            => $total_data,
	'comment'          => nl2br($order_info['comment'])
);
And change it to this:

Code: Select all

$this->data['orders'][] = array(
	'order_id'	       => $order_id,
	'invoice_no'       => $invoice_no,
	'invoice_date'     => date($this->language->get('date_format_short'), strtotime('now')),
	'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'),
	'customer_phone'   => $order_info['telephone'],
	'fax'              => $this->config->get('config_fax'),
	'email'            => $this->config->get('config_email'),
	'shipping_address' => $shipping_address,
	'payment_address'  => $payment_address,
	'product'          => $product_data,
	'total'            => $total_data,
	'comment'          => nl2br($order_info['comment'])
);
Note the addition of: 'customer_phone' => $order_info['telephone']

Now open /admin/view/template/sale/order_invoice.tpl

Leave the one at the top for the store info (line 18 or so) as

Code: Select all

<?php echo $order['telephone']; ?>
And under the ship_to section (around line 57), change:

Code: Select all

<?php echo $order['telephone']; ?>
To:

Code: Select all

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

Re: Customer Phone number on printable invoice (OC 1.5.0)

Posted: Thu Feb 16, 2012 11:15 am
by chi702
Thanks a lot . i got this problem too and it was fixed.