Adding fields to invoice in admin
23 posts
• Page 1 of 2 • 1, 2
Adding fields to invoice in admin
Hello,
I made a vqmod to add some extra fields in the registration form.
Now I want some of those fields to appear in the order invoice as well as in the printed invoice.
The fields are in the "customer" table in database, but I don't know how to call them in "order_info.tlp" for example.
Any hint is highly appreciated.
Thanks.
I made a vqmod to add some extra fields in the registration form.
Now I want some of those fields to appear in the order invoice as well as in the printed invoice.
The fields are in the "customer" table in database, but I don't know how to call them in "order_info.tlp" for example.
Any hint is highly appreciated.
Thanks.
- robinson
- Posts: 14
- Joined: Thu Jan 26, 2012 10:13 pm
Re: Adding fields to invoice in admin
The getOrder method under the info from the order controller already uses the customers table. You would need to make the additional calls of the customers table fields you want from the order controller.
Regards,
Straightlight
Straightlight
- straightlight
- Posts: 1932
- Joined: Mon Nov 14, 2011 3:38 pm
- Location: Canada, ON
Re: Adding fields to invoice in admin
Thanks for your answer, straightlight, sorry for the late reply.
I was able to figure that, I saw I need to modify order.php from controllers and order_info.php. Maybe also order.php from models. But with my limited php knowledge, what ever I tried, I cannot call the variable I need, so far.
If somebody can help any further... please.
I was able to figure that, I saw I need to modify order.php from controllers and order_info.php. Maybe also order.php from models. But with my limited php knowledge, what ever I tried, I cannot call the variable I need, so far.
If somebody can help any further... please.
- robinson
- Posts: 14
- Joined: Thu Jan 26, 2012 10:13 pm
Re: Adding fields to invoice in admin
I cannot call the variable I need, so far.
Would it be possible to send your XML file as an attachment ? I will take a look at it.
Regards,
Straightlight
Straightlight
- straightlight
- Posts: 1932
- Joined: Mon Nov 14, 2011 3:38 pm
- Location: Canada, ON
Re: Adding fields to invoice in admin
Hi straightlight,
I attached the xml with what I tried to do.
So, in the database, in the "customer" table, there are the fields 'cnp' and 'cui'. They are extra fields that I added to the registration form. I want those fields to appear in admin in the order info and in the invoice (when click on "print invoice").
Thanks a lot for your time and your kindness.
I attached the xml with what I tried to do.
So, in the database, in the "customer" table, there are the fields 'cnp' and 'cui'. They are extra fields that I added to the registration form. I want those fields to appear in admin in the order info and in the invoice (when click on "print invoice").
Thanks a lot for your time and your kindness.
- Attachments
-
acccount_custom_fields_to_invoice.xml- (1.98 KiB) Downloaded 62 times
- robinson
- Posts: 14
- Joined: Thu Jan 26, 2012 10:13 pm
Re: Adding fields to invoice in admin
Try this for the admin order invoice.
- Attachments
-
acccount_custom_fields_to_invoice.xml- (2.76 KiB) Downloaded 89 times
Last edited by straightlight on Mon May 07, 2012 12:12 am, edited 3 times in total.
Regards,
Straightlight
Straightlight
- straightlight
- Posts: 1932
- Joined: Mon Nov 14, 2011 3:38 pm
- Location: Canada, ON
Re: Adding fields to invoice in admin
Thanks, but unfortunately there's still nothing displayed (other than "Notice: Undefined index cnp" messages).
- robinson
- Posts: 14
- Joined: Thu Jan 26, 2012 10:13 pm
Re: Adding fields to invoice in admin
There are no index.cnp in OpenCart unless you're using a contribution. Would it be possible to elaborate that error message ?
Regards,
Straightlight
Straightlight
- straightlight
- Posts: 1932
- Joined: Mon Nov 14, 2011 3:38 pm
- Location: Canada, ON
Re: Adding fields to invoice in admin
No, no, it's not index.cnp. It's "Notice: Undefined index: cnp" in admin/model/sale/order.php.
Where 'cnp' is the field from database I want to display.
Where 'cnp' is the field from database I want to display.
- robinson
- Posts: 14
- Joined: Thu Jan 26, 2012 10:13 pm
Re: Adding fields to invoice in admin
Can you send the admin sale order from VQCache and the line number ? An error message from server always includes an error line.
Regards,
Straightlight
Straightlight
- straightlight
- Posts: 1932
- Joined: Mon Nov 14, 2011 3:38 pm
- Location: Canada, ON
Re: Adding fields to invoice in admin
The notice message is for the two lines added through xml:
- Code: Select all
, 'cnp' => $order_query->row['cnp'],
'cui' => $order_query->row['cui']
- robinson
- Posts: 14
- Joined: Thu Jan 26, 2012 10:13 pm
Re: Adding fields to invoice in admin
Same thing, not a change.
- robinson
- Posts: 14
- Joined: Thu Jan 26, 2012 10:13 pm
Re: Adding fields to invoice in admin
straightlight wrote:Can you send the admin sale order from VQCache and the line number ?
Regards,
Straightlight
Straightlight
- straightlight
- Posts: 1932
- Joined: Mon Nov 14, 2011 3:38 pm
- Location: Canada, ON
Re: Adding fields to invoice in admin
The lines giving the "notice: Undefined index: cnp" and "notice: Undefined index: cui" are line 299 and 300.
I attached the file.
I attached the file.
- Attachments
-
vq2-admin_model_sale_order.php- (30.21 KiB) Downloaded 54 times
- robinson
- Posts: 14
- Joined: Thu Jan 26, 2012 10:13 pm
Re: Adding fields to invoice in admin
Thanks, but $cnp in order_info.tpl still outputs nothing and the two "notice: undefined index..." messages are still there. 

- robinson
- Posts: 14
- Joined: Thu Jan 26, 2012 10:13 pm
Re: Adding fields to invoice in admin
$cnp ? It would probably be: $order['cnp'] from your template.
Regards,
Straightlight
Straightlight
- straightlight
- Posts: 1932
- Joined: Mon Nov 14, 2011 3:38 pm
- Location: Canada, ON
Re: Adding fields to invoice in admin
It doesn't work with $order['cnp'] either, doesn't output anything.
- robinson
- Posts: 14
- Joined: Thu Jan 26, 2012 10:13 pm
Re: Adding fields to invoice in admin
Did you checked in PHPMyAdmin if this field related with that order actually contains any values ?
Regards,
Straightlight
Straightlight
- straightlight
- Posts: 1932
- Joined: Mon Nov 14, 2011 3:38 pm
- Location: Canada, ON
23 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 12 guests













