Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding custom field to Ubercart Invoice

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.

like image 749
nocksock Avatar asked Jun 25 '10 12:06

nocksock


1 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.

like image 70
akarpovsky Avatar answered Oct 19 '22 20:10

akarpovsky