Community Documentation

Displaying extra fields in invoice template

Last updated March 11, 2013. Created by MegaChriz on December 8, 2012.
Edited by Morage. Log in to edit this page.

By default, Extra Fields Pane field's values are not displayed in the invoice that get's send by Ubercart. To let values of extra fields show up in the customer invoice mail, you need to copy the customer invoice template to your theme and then edit it to add the extra fields variables in there.

This document describes how a field variable is called for Extra Fields Pane versions 7.x-1.x and 6.x-2.x. The 7.x-1.x version uses an other pattern than the 6.x-2.x version.

For more information about custom invoice templates, read How to customize the order invoice customer e-mail.

Extra Fields Pane 7.x-1.x

For the 7.x-1.x version of Extra Fields Pane, each field variable uses the following pattern:

$uc_addresses_(address type)_(field name)
  • '(address_type)' can be 'delivery' or 'billing'.
  • '(field name)' is the machine name of your field, for example 'ucxf_gender'.

So, if for example your extra field is called 'gender', then these variables will be available for the Ubercart invoice template:

  • $uc_addresses_delivery_ucxf_gender;
  • $uc_addresses_billing_ucxf_gender;

Steps:

  1. Copy the template 'uc-order--customer.tpl.php' to your theme (the template can be found in ubercart/uc_order/templates).
  2. Edit the template uc-order--customer.tpl.php, add variables of extra fields to it (i.e. $uc_addresses_delivery_ucxf_gender).

Extra Fields Pane 6.x-2.x

For the 6.x-2.x version of Extra Fields Pane, each field variable uses the following pattern:

$extra_(pane_type)_(field name)
  • '(pane_type)' can be 'extra_delivery', 'extra_billing' or 'extra_information'.
  • '(field name)' is the machine name of your field without the 'ucxf_' prefix, for example 'gender'.

So, if you have an address field that's called 'gender', then these variables will be available for the Ubercart invoice template:

  • $extra_extra_delivery_gender;
  • $extra_extra_billing_gender;

And if you have a custom field that's called 'your_reference', then this variable will be available for the Ubercart invoice template:

  • $extra_extra_information_your_reference;

Steps:

  1. Copy templates uc_order-customer.tpl.php and uc_order.tpl.php to your theme (the templates can be found in ubercart/uc_order/templates).
  2. Edit the template uc_order-customer.tpl.php, add variables of extra fields to it (i.e. $extra_extra_delivery_gender).

Page status

No known problems

Log in to edit this page

About this page

Drupal version
Drupal 6.x, Drupal 7.x
Level
Beginner, Intermediate
Audience
Designers/themers, Site administrators, Site builders
Keywords
Extra Fields Pane, ubercart

Site Building Guide

Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.