Adding a custom field to Ubercart Invoice

My client has an ubercart based store that works great. Due to some internal things, he needs to manually add a field to each invoice. I would like to know how much I can add a custom field for orders that appear on all accounts.

+6
drupal ubercart
source share
2 answers

This is an old question, but it may help others; you can use the following code.

First check the customer.itpl.php or customer.itpl.php files located in ubercart/uc_order/templates .

Then you can edit the foreach loop, which resonates with all products and adds your own fields in 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 product fields that can be edited from http://www.mysite.com/admin/content/node-type/product/fields .

You can find additional information about this issue .

+4
source share

I personally did not have to make this change, so I do not speak from experience, but looking at the documentation, I would try the following: (you could cut off the corners and avoid some work by changing existing modules, but this is the cleanest way about which I can think)

  • create a module in which your field and order number are stored.
  • Using from_alter, change the account editing screen to allow users to edit the field.
  • use the invoice template to pull it into the field, based on the order number. documentation "invoice system .

This is not a simple change, but using this template you will receive the required modification without worrying that the updates do not work.

0
source share

All Articles