My client has an ubercart based shop which works fine. Due to some internal stuff he needs to manually add a field to each invoice. I wanted to know if or rather how i can add a custom field to orders that gets displayed on all the invoices.
2 Answers
It's an old question but this may help others; you can use the following code.
First checkout the customer.itpl.php
or customer.itpl.php
files located under ubercart/uc_order/templates
.
Then you can edit the foreach loop that echoes all the products and add your own fields this way:
<?php
foreach ($order->products as $product) {
$nid = ($product->nid);
$noderef = node_load($nid);
echo $product->title .' : '.$noderef->your_own_field[0]['value'];
echo "<br />";
?>
My Ubercart installation has the product fields can be edited from http://www.mysite.com/admin/content/node-type/product/fields
.
You can find more information on this issue.

- 316
- 2
- 8
I have not personally had to make this change, so I'm not speaking from experience, but looking at the documentation I would try the following: (you could cut corners and avoid some work by modifying the existing modules, but this is the cleanest way I can think of)
- create a module that stores your field and the the order number.
- using from_alter modify the invoice editing screen to give your users a way to edit the field.
- use the invoice template to pull in your field, based on the order number. invoice "system" documentation.
It's not a simple change, but using this pattern you'll get the modification you are looking for without having to worry about updates not working.

- 1,831
- 2
- 13
- 15
-
Thanks… that might be a way to get this done. Will try it out next week. – nocksock Jul 02 '10 at 09:03
-
did this answer work for you? totally forgot about following up, and sure could use the bounty :) – mirzu Oct 01 '10 at 01:32