Post by jules2000 » Wed Mar 07, 2012 6:53 pm

Hi,

I run a project which currently runs on Open Cart 1.4.9 and I was wondering how I could get open cart to display the customer's number on the invoice. In the database there is a point called "customer_id" but so far my attempts to implement this number with the order_invoice.tpl have failed so far :( .
Does anyone of you folks out there any idea?

cheerio

New member

Posts

Joined
Tue Feb 21, 2012 9:34 pm

Post by straightlight » Thu Mar 08, 2012 6:53 am

The customer ID wouldn't be quite significant on an order since this particular row is auto incremented from the database so if a specific customer gets either disabled from profile or even deleted, this ID will no longer have its meaning while the email address already has its own identity and whether the account is disabled or deleted, it no longer matters since there are far better chances to rely on someone's information by email than by an ID. ;)

Additionally, if the customer is a guest and does not have a reliable account to which the merchant can refer to, it wouldn't quite be useful in this case.

AFAIK, the customer's email is already stored on the order's invoice.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jules2000 » Thu Mar 08, 2012 7:58 pm

Thanks for your replay straightlight. You are certainly right by saying that a customer's email address is a unique identification factor. However the customer for whom I build this project insists on putting the customer's id on the invoice. According for the customer this necessary is for some sort of bookkeeping reasons.

So it's greatly appreciated if you or anyone else has any idea on how to make this work :) .

cheerio

New member

Posts

Joined
Tue Feb 21, 2012 9:34 pm

Post by straightlight » Thu Mar 08, 2012 8:28 pm

In admin/controller/sale/order.php file, on line 2271, after this:

Code: Select all

$this->data['text_order_id'] = $this->language->get('text_order_id');
add:

Code: Select all

$this->data['text_customer_id'] = $this->language->get('text_customer_id');
In admin/language/english/sale/order.php file,

find:

Code: Select all

$_['text_order_id']
add next line:

Code: Select all

$_['text_customer_id'] = 'Customer ID:';
In admin/view/template/sale/order_invoice.tpl file,

find:

Code: Select all

<tr>
            <td><b><?php echo $text_order_id; ?></b></td>
            <td><?php echo $order['order_id']; ?></td>
          </tr>
add below:

Code: Select all

<tr>
            <td><b><?php echo $text_customer_id; ?></b></td>
            <td><?php echo (int)$order['customer_id']; ?></td>
          </tr>
This should provide what you need.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jules2000 » Sat Mar 10, 2012 1:19 am

Thanks very much straightlight for your fast reply and your help. Unfortunately .... it doesn't work :(. I did everything just like you told me.
Well the thing that works just fine is showing the words "Customer ID" on the invoice. However it fails to display the actual custumer ID eg. 123.

Open Cart gives the follwing error instead of the actual cumstomer ID:
Notice: Undefined index: customer_id in ..admin\view\template\sale\order_invoice.tpl

Do you have any futher ideas regarding this matter?

cheerio

New member

Posts

Joined
Tue Feb 21, 2012 9:34 pm

Post by straightlight » Sat Mar 10, 2012 1:42 am

My modifications above are for the store-end, not for the admin while the error message you specified occurs from the admin end.

In admin/controller/sale/order.php file,

find:

Code: Select all

foreach ($orders as $order_id) {
add above:

Code: Select all

$this->data['text_customer_id'] = $this->language->get('text_customer_id');
$this->data['text_guest'] = $this->language->get('text_guest');
Then, find:

Code: Select all

'order_id'	       => $order_id,
add after:

Code: Select all

'customer_id'       => $order_info['customer_id'],
And assure not to have it twice in the array to avoid confusion.

In admin/language/english/sale/order.php file,

find:

Code: Select all

$_['text_maxmind_id']
add after:

Code: Select all

$_['text_customer_id'] = 'Customer ID: ';
$_['text_guest'] = 'Guest';
In admin/view/template/sale/order_invoice.tpl file,

find:

Code: Select all

<tr>
            <td><b><?php echo $text_order_id; ?></b></td>
            <td><?php echo $order['order_id']; ?></td>
          </tr>
add after:

Code: Select all

<tr>
            <td><b><?php echo $text_customer_id; ?></b></td>
            <td><?php echo (!empty($order['customer_id'])) ? (int)$order['customer_id'] : $text_guest; ?></td>
          </tr>
And assure not to have the customer_id twice from that template file to avoid confusion.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jules2000 » Sat Mar 10, 2012 8:32 am

It works like a charm now :). Straightlight, I can't tell you how happy I am about the turn of events. Thank you sooo very much, you are my hero of the day. I didn't know what I would have done without you.

New member

Posts

Joined
Tue Feb 21, 2012 9:34 pm

Post by straightlight » Sat Mar 10, 2012 8:34 am

jules2000 wrote:It works like a charm now :). Straightlight, I can't tell you how happy I am about the turn of events. Thank you sooo very much, you are my hero of the day. I didn't know what I would have done without you.
Thanks for the feedback jules2000.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: Google [Bot] and 301 guests