thank you for this module. It's working well during the checkout.

But the extra fields are not showing up in the first mail the customer gets after the order. How can I get the extra fields to appear within this mail? I'm using the standard customer invoice template

Comments

megachriz’s picture

Assigned: Unassigned » megachriz
Status: Active » Fixed
Issue tags: +invoice template

Hi snicers,

To let values of extra fields show up in the customer invoice mail, you need to edit the customer invoice template and add the extra fields variables in there. You can find the available variable names of Extra Fields at /admin/store/help/tokens, but instead of using the square brackets [], you need to start the variable name with a dollar sign. Also, you should replace the '-' with underscores. For example, if you have field called 'gender' in the delivery pane, the field will be listed as [extra-extra_delivery-gender] on the tokens page, but you will need to use $extra_extra_delivery_gender in your invoice template.

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

A part of your template could then look like this:

<table width="100%" cellspacing="0" cellpadding="0" style="font-family: verdana, arial, helvetica; font-size: small;">
  <tr>
    <td valign="top" width="50%">
      <b><?php echo t('Billing Address:'); ?></b><br />
      <?php echo $order_billing_address; ?><br />
      <br />
      <b><?php echo t('Billing Phone:'); ?></b><br />
      <?php echo $order_billing_phone; ?><br />
      <b><?php echo t('Gender:'); ?></b><br />
      <?php echo $extra_extra_billing_gender; ?><br />
    </td>
    <?php if (uc_order_is_shippable($order)) { ?>
    <td valign="top" width="50%">
      <b><?php echo t('Shipping Address:'); ?></b><br />
      <?php echo $order_shipping_address; ?><br />
      <br />
      <b><?php echo t('Shipping Phone:'); ?></b><br />
      <?php echo $order_shipping_phone; ?><br />
      <b><?php echo t('Gender:'); ?></b><br />
      <?php echo $extra_extra_delivery_gender; ?><br />
    </td>
    <?php } ?>
  </tr>
</table>

Hope that this solved the problem for you. If not, feel free to set the status back to 'active'.

nchase’s picture

thank you very much! very helpful!!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

RCarloss’s picture

I have made a uc_order_customer.tpl.php page.
I got a variable name and tried: echo $extra_extra_information_fieldname; But nothing seems to display.

It echo $extra_extra_delivery_fieldname; and echo $extra_extra_billing_fieldname; display.

megachriz’s picture

@RCarloss
See #1376430: Displaying custom-field information in uc_order-customer.tpl.php. This bug has been fixed in 6.x-2.x-dev.

megachriz’s picture

I have added a documentation page about this on drupal.org:
Displaying extra fields in invoice template