Post by mr-bm » Fri Oct 21, 2011 2:06 am

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

Newbie

Posts

Joined
Thu May 12, 2011 9:56 pm

User avatar
Active Member

Posts

Joined
Thu Nov 11, 2010 6:11 pm
Location - New Zealand (Tokomaru, Palmerston North)

Post by mr-bm » Wed Oct 26, 2011 6:04 am

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

Newbie

Posts

Joined
Thu May 12, 2011 9:56 pm

Post by smifis » Wed Oct 26, 2011 9:44 am

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

Active Member

Posts

Joined
Sat Jan 15, 2011 10:37 pm


Post by geoff m » Fri Nov 11, 2011 1:59 pm

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

Newbie

Posts

Joined
Fri Jul 29, 2011 5:13 am
Location - Townsville, Qld Australia

Post by geoff m » Fri Nov 18, 2011 2:37 pm

I found where this problem is coming from.
Edit file admin/view/template/sale/order_invoice.tpl. This will solve your problem

Newbie

Posts

Joined
Fri Jul 29, 2011 5:13 am
Location - Townsville, Qld Australia

Post by cclower » Sat Dec 17, 2011 11:36 am

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

Newbie

Posts

Joined
Sat Dec 17, 2011 11:21 am

Post by chi702 » Thu Feb 16, 2012 11:15 am

Thanks a lot . i got this problem too and it was fixed.

Newbie

Posts

Joined
Thu Feb 16, 2012 11:14 am
Who is online

Users browsing this forum: Baidu [Spider] and 90 guests