Community Forums

Adding fields to invoice in admin

Coding & concept discussion for OpenCart v1.x development

Adding fields to invoice in admin

Postby robinson » Thu Apr 26, 2012 6:24 pm

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.
robinson
 
Posts: 14
Joined: Thu Jan 26, 2012 10:13 pm

Re: Adding fields to invoice in admin

Postby straightlight » Fri Apr 27, 2012 3:12 am

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
 
Posts: 1911
Joined: Mon Nov 14, 2011 3:38 pm
Location: Canada, ON

Re: Adding fields to invoice in admin

Postby robinson » Wed May 02, 2012 7:11 am

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.
robinson
 
Posts: 14
Joined: Thu Jan 26, 2012 10:13 pm

Re: Adding fields to invoice in admin

Postby straightlight » Wed May 02, 2012 2:37 pm

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
 
Posts: 1911
Joined: Mon Nov 14, 2011 3:38 pm
Location: Canada, ON

Re: Adding fields to invoice in admin

Postby robinson » Fri May 04, 2012 4:13 pm

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.
Attachments
acccount_custom_fields_to_invoice.xml
(1.98 KiB) Downloaded 61 times
robinson
 
Posts: 14
Joined: Thu Jan 26, 2012 10:13 pm

Re: Adding fields to invoice in admin

Postby straightlight » Fri May 04, 2012 7:36 pm

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
 
Posts: 1911
Joined: Mon Nov 14, 2011 3:38 pm
Location: Canada, ON

Re: Adding fields to invoice in admin

Postby robinson » Fri May 04, 2012 8:14 pm

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

Postby straightlight » Fri May 04, 2012 8:37 pm

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
 
Posts: 1911
Joined: Mon Nov 14, 2011 3:38 pm
Location: Canada, ON

Re: Adding fields to invoice in admin

Postby robinson » Fri May 04, 2012 9:30 pm

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.
robinson
 
Posts: 14
Joined: Thu Jan 26, 2012 10:13 pm

Re: Adding fields to invoice in admin

Postby straightlight » Fri May 04, 2012 10:25 pm

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
 
Posts: 1911
Joined: Mon Nov 14, 2011 3:38 pm
Location: Canada, ON

Re: Adding fields to invoice in admin

Postby robinson » Sat May 05, 2012 7:20 pm

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

Postby straightlight » Sat May 05, 2012 8:17 pm

XML file corrected above.
Regards,
Straightlight
straightlight
 
Posts: 1911
Joined: Mon Nov 14, 2011 3:38 pm
Location: Canada, ON

Re: Adding fields to invoice in admin

Postby robinson » Sat May 05, 2012 8:54 pm

Same thing, not a change.
robinson
 
Posts: 14
Joined: Thu Jan 26, 2012 10:13 pm

Re: Adding fields to invoice in admin

Postby straightlight » Sat May 05, 2012 11:51 pm

straightlight wrote:Can you send the admin sale order from VQCache and the line number ?
Regards,
Straightlight
straightlight
 
Posts: 1911
Joined: Mon Nov 14, 2011 3:38 pm
Location: Canada, ON

Re: Adding fields to invoice in admin

Postby robinson » Sun May 06, 2012 5:38 am

The lines giving the "notice: Undefined index: cnp" and "notice: Undefined index: cui" are line 299 and 300.
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

Postby straightlight » Mon May 07, 2012 12:12 am

Fixed.
Regards,
Straightlight
straightlight
 
Posts: 1911
Joined: Mon Nov 14, 2011 3:38 pm
Location: Canada, ON

Re: Adding fields to invoice in admin

Postby robinson » Mon May 07, 2012 6:35 am

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

Postby straightlight » Mon May 07, 2012 12:08 pm

$cnp ? It would probably be: $order['cnp'] from your template.
Regards,
Straightlight
straightlight
 
Posts: 1911
Joined: Mon Nov 14, 2011 3:38 pm
Location: Canada, ON

Re: Adding fields to invoice in admin

Postby robinson » Mon May 07, 2012 3:03 pm

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

Postby straightlight » Mon May 07, 2012 4:38 pm

Did you checked in PHPMyAdmin if this field related with that order actually contains any values ?
Regards,
Straightlight
straightlight
 
Posts: 1911
Joined: Mon Nov 14, 2011 3:38 pm
Location: Canada, ON

Next

Return to Concepts

Who is online

Users browsing this forum: Peter_Gould and 11 guests

Hosted by Arvixe Web Hosting