Status:Active» Needs review
new980 bytes

Many thanks. I've had making this patch on the backburner for some time now... this is great. : ) There are a few settings forms, though, in the order settings and notification settings, where you can specify an .itpl.php from the templates directory for e-mailed vs. on-site invoices. I think for D5, I should maybe just search both the templates and the theme templates directories for these... but maybe change it in D6.

I don't suppose you also know what it would take for D6? My thought was we should get rid of the templates directory altogether, use a module based .tpl.php, and let Drupal override that in the theme. Sound about right?

Yes, for D6 I'd switch if possible to a tpl.php to take advantage of the theme system, though probably in that case you'd need to populate all the token things as variables, rather than having them as you do now.

Title:alow alternate tempate in uc_orderMove invoice templates to module based .tpl.php files
Version:5.x-1.3-rc1» 6.x-2.x-dev
Category:feature» task
Status:Needs review» Needs work

So, I was reviewing this issue and the patch, and I decided that at this time it's not necessary in its current form. The solution for Ubercart 1.x is to simply copy/modify the core invoice templates based on this documentation page (although looking it up now I realize it's quite hidden :( ). I don't think the patch would appropriately handle the way the settings forms work that let you select an invoice template at various places in the source.

So... moving onto Drupal 6 development, I'm moving this to patch needs work and "reconsigning" this issue to be one that moves invoice template more toward the theme layer. I think it would be good for the modules to ship w/ module based .tpl.php files and let user's override them at the theme layer. However, people should also maintain the ability to have multiple invoice templates. Some people send one invoice as a standard invoice but then a different one altogether if the order contained a certain product (like a file download or gift certificate). The solution here must allow for or rule out the use of module based .tpl.php files for the default customer/admin invoices and allow for the use of multiple invoices found in the theme layer.

I'd love to see this happen too, and would be happy to contribute code to make it so.

rszrama, it sounds like your proposed implementation will require a significant rework of the templating code, while patches like the one above could be integrated into current 1.x series without too much grief.

Do you think there's room for us to pursue both approaches, if further code along the lines of pwolanin's was contributed, and the contributions were careful to move towards (rather than in the way of) your intended result?

Issue tags:+theme layer

A couple of related posts (one by me) on the UC forums:


And a related issue here, allowing for symlink workarounds so we don't need to keep files for several customers in a single shared templates directory:

* (link fixed)

I have been thinking of a few ideas for this:

1) you could use the theme template suggestions approach, so there is a default template provided by uc_order:

Any theme can overrider that base template or provide other specific templates.

If there is only one product there could be something like:

For multiple products, the only way this would work with the current theming system is if the nid where required to be in some specific order, so the nid would have to be in say ascending order.

You could also do other things like have an invoice for an order that includes a product.

2) A simpler solution to the above problem of different invoice content based on the products purchased is to have a field associated with each product so you can add a message that gets included in an invoice

3) Another way would be to put the invoices into the database or files directory (it actually makes a lot of sense to have them there as an invoice is usually tied to a site not a theme or a module), you can then setup the ability to create rules to decide what invoices to send on what orders.

This is just some ideas....

However, people should also maintain the ability to have multiple invoice templates. Some people send one invoice as a standard invoice but then a different one altogether if the order contained a certain product (like a file download or gift certificate)

This is exactly what I'm trying to achieve in Drupal 5.16 + Ubercart 5.17. I'm basically looking to send a standard invoice template for all products, except one (a free/trial product), for which I want to send a different invoice template.
Does the patch at the top of the page allow this? Any suggested reading/help on how to achieve?

Any help is greatly appreciated,



No, if you have a look at that patch, all it does is check a different (per-theme) directory for the theme template. Which is still a huge improvement over having to keep all your per-site templates in a (multisite, shared) single module directory.

But your use case is a really good one, and it's exciting to imagine that being available.

Status:Needs work» Needs review
new7.66 KB

The attached patch implements a hook_uc_invoice_template_list hook. This allows modules to provide template files freely to uc_order.
It also implements pwolanin's patch allowing themes to override the templates provided by the modules.

Suggestions are welcomed.

Cheers !

PS: One little question: in uc_order_template_options function I didn't really understand why we have the $custom parameter: it is not used anywhere in the code.

md2 regarding #9: you should now be able to do that with CA, the patch at #11 and by implementing a hook_uc_invoice_template_list in your custom module to provide other templates.

If this patch gets accepted we need to provide a hook_update_N to update the uc_cust_order_invoice_template variable.

new7.95 KB

Bleah... New patch attached. In the previous one I omitted to replace $file with $template_file...

Edit: both patches are against the latest UC 2.x snapshot dev (2009-Jun-16)

Ultimately I'm thinking that it would be really really useful it we would allow our clients to change their templates from the UI admin interface. It would make sense to have a {uc_invoice_templates} table where we would store the templates.
This way we could use filters like pathologic, Internal path filter, etc on the text area where the templates are submitted. It really sucks to have to edit your tpl files whenever you change an url on the website or you want to add/substract some content from the template.
Also, building your invoice template into a WYSIWYG editor it is a lot better than builfing it into an IDE in my opinion.

Of course there are some problems doing this, for example how would we do the products listing in a user friendly manner ? Tokens for product title, description, etc ?

Any thoughts about this ?

I unintentionally created duplicate issue #520478: Allow themes to override order invoice templates.. If I read the patch from #14 correctly, in order to provide a new template you must create a module. With the patch from the other issue, one may simply add an additional itpl.php file in the theme's directory. Is the custom module really necessary, and what does it buy you?

As for the theme version of an existing template overriding the core one, our patches are nearly identical, so I have no issues with that part.

(BTW, my patch was written to address an urgent need for a new site going live, so that's probably why I missed this issue...)


Will test when I get a chance.

For a module I've created I have a form_alter for the list of templates which submits the whole path of the templates (it looks in the uc_order template dir, my_module template dir and a theme dir that is specified in the settings).

Then I've patched uc_order_load_invoice to take the whole path.

But I agree that a hook is easier and the theme layer is available for some reasons


new16.86 KB

I feel like these patches are trying to do things that the theme system already does, like figuring out where the overrides are and loading the template files. Of course, that's what the code was doing in the first place, but I think to really knock this issue out, we've got to fully embrace the way Drupal expects template files to work.

Enter theme_uc_order(). This takes the place of uc_order_load_invoice() and it even takes the exact same arguments: the order, the "op" or "view", and the specific template. I think there needs to be a hook to provide the list of available templates, but I ended up calling it hook_uc_invoice_templates(). If it wasn't for the fact that the user needs to choose which template to use in the emails and such, I wouldn't have bothered. But as it is, there isn't any other place for that data to live.

The biggest win for doing it this way, though, is that we get a preprocess hook! hook_preprocess_uc_order() lets you add anything as a variable to the invoice template. The default template_preprocess_uc_order() already adds all of the order tokens, though, so I don't know what else might be needed. However, you if don't like the way the tokens are generated, then you have the opportunity to completely change them. Drupal's theme system provides supreme flexibility.

It should be noted that the patch adds a basically empty uc_order.tpl.php. Technically, it's not needed, but I put it there as a reminder that it must exist in the theme folder if you want to override the other templates. Since the $template variable must be given to theme_uc_order(), or it defaults to "customer", that file shouldn't ever be loaded. However, if it's not there, Drupal won't load any of the theme's other invoice templates.

Hey Lyle,
I don't have time to try out this patch right now, but I fully support the concept. The theme layer is the right place for this. Reading through the patch, everything looks good to me. Just clean up the commented //function uc_order_load_invoice... line.

Now I'll just have to redo the templates on our production site... again.. :)

I'm not convinced the theme layer is actually the right place for this, although its better then in ubercart where it can't be overridden.

The problem is you can have different themes for admin/site/users and there are also contrib modules to allow to have multiple themes running at the same time for different purposes. So unless there is a way for ubercart to specify what theme it should be using when generating the invoices its possible it could end up looking in the wrong place.

I think the ideal solution would be a UI in ubercart for creating invoices which are saved to the database or filesystem.

@univate - Good points. However, Drupal's theme system allows both modules and themes to provide theme hints, so presumably by implementing hook_uc_invoice_template_list() Ubercart could scan a custom dir per-site (eg sites/ as well as theme and module directories (incl. core Ubercart for the default templates).

If Ubercart gets hints from the current theme when selecting an invoice template, then the available templates might be affected by the use of an administration theme.

I would suggest that the default implementation of hook_uc_invoice_template_list() as implemented in UC (optionally) check the site default theme and the folder sites/[sitename]/uc_order_templates. That way we have simple defaults which suit the common use cases, and people can implement their own hook_uc_invoice_template_list() if they want to go further or have special cases.

Btw, I believe there already is a UI for storing invoices in the DB, by choosing "custom" and adding it to the invoice template field. For me, that's not an appealing option, because Ubercart's site templates are stored in the DB, while Drupal's templates are stored in the filesystem. (Sure, we could copy template code from the filesystem to the DB on each update, but this would not be good practice IMO.)



Subscribing. I was getting ready to submit a patch a lot like #1, so I'm glad there's movement on this.




Why not integrate these into Contemplate :) I am with #22

new17.14 KB


At ActiveState we're using a modified version of Lyle's patch in #20 ( attached ). The big difference in the patch is that it relies now completely on the template for the content in the invoice. We're doing this because we needed to be able to apply custom css etc to the invoice, which was difficult previously because the invoice output was not a full html page, and also added markup to the page directly before printing to the browser and calling exit. We now print out a full html page and in particular are adding in a print.css style sheet.

The big difference is in uc_order_view, starting on line 1073, where we removed the addition of the button markup at this stage ( we instead include it in our template ). The buttons are instead added in out template file, and the whole invoice is now output as a full html page. I believe this patch also addresses the concerns raised in issue 565340:

We need this because the 'Print Invoice' and 'Close Window' buttons would show up when customers printed out the printable invoice, being able to add our print.css solved this.



Is there a possibility for this to be committed to Ubercart module after testing?

new5.47 KB

Here is another patch that simply scans both the uc_order/templates folder and the active theme folder for itpl.php files. Instead of simply storing the filename the entire file path is stored. I have tested this for viewing the invoice as well as sending the customer and admin invoices.

I think #31 is the right way to go, but we need a few things before this can be committed:

1) We need people to TEST and REVIEW this patch
2) We need a hook_update_N() function to migrate sites to the new system. If we put this patch into Ubercart right now, every store using a custom template will break. Not good...

Status:Needs review» Needs work

Reviewing #31. It looks like this patch allows two things.

  1. Themes may now override template files in the usual manner.
  2. Modules may declare new "types" of invoice templates (other than 'admin' and 'customer') using the new hook_uc_invoice_templates().

hook_uc_invoice_templates() needs to be documented.

I don't see the 'Print Invoice' and 'Close Window' buttons added to the template file. Also the .itpl.php files need to be renamed. Lyle's patch included that:

=== renamed file 'uc_order/templates/admin.itpl.php' => 'uc_order/templates/uc_order-admin.tpl.php'
=== renamed file 'uc_order/templates/customer.itpl.php' => 'uc_order/templates/uc_order-customer.tpl.php'

If hook_uc_invoice_templates() is implemented by a module, I assume that module would provide the default template file. How does the theme layer find it? It looks like

+      'path' => drupal_get_path('module', 'uc_order') .'/templates',

in uc_order_theme() tries to solve this, but I'm not sure it will work. This may just be my ignorance of how the theme layer works however. Needs to be tested.

I'm not sure how hook_update_N() is relevant. Are there any database changes to be made? I agree that stores using a custom template will break, but the only solution is for them to update their template and rename it to uc_order-*.tpl.php. Am I missing something?

@cedarm: Thanks for the review. Those are good points.

What I was specifically thinking about when I said "We need a hook_update_N() function to migrate sites to the new system" was that the update function should look at the variable that holds the user-defined template, and if that's set provide at least an informational message to tell the user what to do to change his template to the new format and where to put the new template. And, although the recommendation when upgrading is to wipe your file system rather than extract the new Ubercart version on top of the old one, in practice everyone just over-writes the old code because they don't want to destroy their .itpl.php files, among other things. So it would be a nice feature if the update function renamed those user-defined .itpl.php files automatically - this could be done for all .itpl.php files found in the templates directory, whether those template files were in use or not at the time of the upgrade.

In short, since this change will break existing sites if they are using custom templates, I want the transition to be as easy as possible. I don't want a repeat of last fall, when a minor change was made to the default templates to accommodate a change in the attribute data type from a scalar to an array. Nothing was done in the update to detect or correct non-default templates, so we're still getting support requests from people whose invoices are showing "Array" instead of the attribute value. I don't think it's enough to mention these things in the release notes, since most people aren't going to read those.

@TR I agree with your statements. We should handle this carefully. I do however disagree about an update function modifying code files. Our standard practice is to make all code files (including .itpl.php) not writable by the web server, so in our case it would fail anyway. We can however read stuff and issue notices, perhaps in the form of an error from hook_update_N(). People tend to pay attention to those (I think). So hook_update_N() in this case wouldn't even be updating anything, just checking that the user did the right thing.

So I'm thinking simply the presence of .itpl.php files indicates the user didn't "follow instructions". Thoughts?

Start thinking about how to word the notice...

The error message could be like the one that says your modules are out of date and a security update is required. By that I mean they should keep coming up until it's fixed, so it's not ignored. You could store a variable to say its been fixed, so you don't have to keep checking the file system.

@mstrelan Simply using a hook_update_N() will cause the Drupal status report to say the database schema is out of date, but obviously once update.php is run this will go away. Personally I think this one time check and notification is enough.

If we do want some sort of persistent check, another option would be to display an error on the main Ubercart store admin page, like when credit card encryption is not yet configured. But remember what we're dealing with here, a one time upgrade issue. The encryption config is an ongoing issue that may become an issue if, for example, someone changes filesystem permissions. It's unlikely that someone is going to un-upgrade their Ubercart templates and try to use an old .itpl.php file, so I think this would be overkill.

For the message I was thinking something like "Old Ubercart .itpl.php invoice templates were found! These must be manually upgraded to use the Drupal theme layer. See [page] for details." The sites that don't have custom templates and upgrade properly will never see this message. And yes, someone will have to write [page].

Personally I think this one time check and notification is enough.

I agree.

And yes, someone will have to write [page].

So the to-do list is now:

1) Add a hook_update_N() to make the one-time check and print the message as in #41.
2) Write the documentation [page] on so we have a link to use in the message.
3) Address the points raised in #37.
4) Re-roll the patch.
5) TEST and REVIEW the patch.

line 73 of the patch in #35:

+    $template = drupal_get_path('module', 'uc_order') .'/templates/customer.itl.php';

looks like it should be "itpl" instead of "itl" :

+    $template = drupal_get_path('module', 'uc_order') .'/templates/customer.itpl.php';

Status:Needs work» Needs review
new18.58 KB

Here's an update to Lyle's patch in #20 addressing the points in #37 and #42


  1. Adds a hook_update_N to check for custom (or any old left over) .itpl.php files by returning an error pointing out that the old template files will need upgrading.
  2. Adds to the hook_uc_invoice_templates() documentation.
  3. Corrects the $op switch in uc_order_load_invoice.
  4. Adds back uc_order.tpl.php (which was missed in #31).

New custom template types work well as does providing module/theme tpl.php overrides. hook_preprocess_uc_order is a great bonus (no more custom templates just to tweak a variable!).

I haven't included the Print/Close button changes from #31, run out of time for now. It'd be a nice feature - maybe canuckistani could add it in?

So as per #42 still todo:

  1. Write the documentation [page] on so we have a link to use in the message
  2. TEST and REVIEW the patch.


+1 subscribing

Is there any instructions or tips on how to test/what to look for?
I am about to use Ubercart and this seems like it will improve the usability in the near future.
Thank you

@robby.smith Good idea, this issue is getting pretty old so here's a summary of what the patch in #44 does:

Issue summary

The system for customising or overriding invoices in Ubercart is inflexible. uc_order hardcodes a single template directory to scan for possible templates (uc_order/templates). Additional templates may be created but must live in that directory. Amongst other things this then makes Ubercart upgrades tricky. Additionally, templates are in a non standard .itpl.php format and are not overridable at the theme layer.

The solution to overcome these limitations is to convert the invoice system to use the Drupal theme layer. This patch does this by adding theme_uc_order() which takes the place of uc_order_load_invoice(). Invoice templates are converted from .itpl.php to .tpl.php, e.g. customer.itpl.php becomes uc_order-customer.tpl.php. Importantly, token values are changed from the format [token-name] to standard template variables $token_name.

Themes can now override invoice templates as per normal Drupal theming practices, e.g. copy uc_order-customer.tpl.php into your theme dir for customisation. Note that due to the way Drupal's theme layer works the dummy uc_order.tpl.php must be copied as well.

The biggest win for the new template and token handling is the preprocess hook. hook_preprocess_uc_order() lets you add anything as a variable to the invoice template. The default template_preprocess_uc_order() already adds all of the order tokens, though other modules could define new tokens. The main benefit is that if you don't like the way the tokens are generated, then you have the opportunity to completely change them in the preprocess function, no need to override an entire template just to change a few template values.

Also introduced is hook_uc_invoice_templates() which allows modules to declare new "types" of invoice templates (other than 'admin' and 'customer'). This replaces the old behaviour of invoice types being declared directly in the invoice file name, e.g. customer.itpl.php

An update path is also provided. Discussed above in #38 through #42 it was decided that a simple one time check and warning for old .itpl.php files in a hook_update_N was sufficient.


I think the above would at least make a start to the upgrade [page] that needs to go onto (needed so it can be pointed to in any upgrade message if old .itpl.php files are found). @TR, or someone with credentials, care to create the page?

Version 2.3 of Ubercart is surely well due, it'd be great to get this substantial but important change into it.

All the work was done by Lyle in #20. The code has been well tested. We're using this in production and have been for a while. It's a good improvement to Ubercart and brings invoice's into line with the Drupal theming system. It'd be great to drive this home.

Status:Needs review» Reviewed & tested by the community

Great summary! I tested the patch and it worked as per your explanation.
Setting the status to RTBC but I'm sure we need more testers =)
It would be really nice to have this committed as I'm hesitant to use this on my production site if it's not going to be permanent.
Thanks for the GREAT work!

We'll be reviewing and testing in the next couple of days..

Status:Reviewed & tested by the community» Needs review

I was gearing up to make a new release, but then I saw this issue again. I'll hold off on that until we get a review back from cedarm. In the meantime, I'll see about making a documentation page on explaining this change.

Feel free to speak up if you're using this patch, too. :)

new17.53 KB

Why do I get the feeling that there will be a lot of confused people who don't realize they will need a module to declare their custom invoice types? I'm not sure that it's reasonable to expect them to create a module to implement this hook, just to keep their site working.

At the very least, template_preprocess_uc_order() ought to make uc_order-customer.tpl.php the default template file to use, rather than uc_order.tpl.php.

Maybe having the variable set to use the custom template is enough, though.

And last, but not least, the page on

Status:Needs review» Needs work

Patch from #44 works as advertised. We ported our itpl customer template. Not a big deal. Preprocess function in the theme works with and without overriding the template file, as one would expect.

I did not exercise the new hook_uc_invoice_templates().

hook_update_N still needs [page] to be put in. Add that URL and I'll call it RTBC, but we need to create the page first. #47 is a good start indeed, but I imagine there will be some people who aren't developers that will need to port their .tpl.php files. We should include a simple example:

Change tokens like [order-email]

                <td width="98%">

to a php print statement like

                <td width="98%">
                  <?php echo $order_email; ?>

Status:Needs work» Needs review
new18.81 KB

Ok, here's the patch from #44 with the following changes:

  • Added the link to the upgrade page on in uc_order_update_6015() - thanks Lyle.
  • Added Lyle's changes from #51 to make template_preprocess_uc_order() default to uc_order-customer.tpl.php
  • Removed the NULL global token value in template_preprocess_uc_order() as it's been commented out since the first iteration of this patch in #20 (couldn't see any use for it?):
    $types = array(
    //'global' => NULL,
    +    'order' => $variables['order'],
    +  );

Based on cedarm's review from #53 this should be RTBC.

subscribing. thanks

Umm.... I feel really stupid but how does one "subscribe" to this thread?

Status:Needs review» Fixed

Thanks, everyone, for working on this! Committed, and I've tweaked the upgrade page a bit to show just how the template files should be changed. If it needs more, I think anyone can change it, but if not, leave a post here on this issue.

currently updating uc_bank_transfer to use the new template format...

1) where can I find documentation about hook_uc_invoice_templates() ?
[it's probably not written yet..]
We currently have it like this:

* Implementation of hook_uc_invoice_templates().
function uc_bank_transfer_uc_invoice_templates() {
  return array('customer-bank_transfer');

2) The only location the .tpl files seem to be found is ubercart/uc_order/templates.
(we are having both: uc_order.tpl.php and uc_order-customer-bank_transfer.tpl.php in the theme folder)

The Theme Developer module tells me that the templates in the theme's folder are getting picked up. They should behave like every other tpl.php file. Make sure you clear the theme registry after the files are put there.

The hook documentation is found in docs/hooks.php.

I too am having problems getting the new theming to work, though I have stumbled upon something that seems to get it going.

I updated my custom .itpl files and moved them into my custom theme (ie: in filenames like uc_order-customer-AnimEigo.tpl.php), along with uc_order.tpl.php. The custom .tpls are ignored.

I renamed them to (for example) uc_order-customer.tpl.php after reading the note about needing a custom hook for custom templates (since there is no documentation on how to implement this hook [bitch-moan]).

They were still not used.

I wandered around the UC configuration pages and finally stumbled upon a mention of conditional actions, which reminded me that that is where the checkout email settings are done (and where in the past you would set what itpl to use IIRC).

I went in there, reset and resaved the send email actions so that they used admin and customer respectively, and after that, my theme uc_order tpls were being accessed.

The documentation needs to be updated to clearly explain the full update process.

Along the way, by the way, I ran into these error messages on a ubercart admin page, though I didn't note which one, and I can't repeat the issue. Note that my site only uses a custom theme (except for update.php of course).

user warning: Duplicate entry 'sites/all/themes/contrib/zen/zen/' for key 1 query: INSERT INTO system (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('zen', 'themes/engines/phptemplate/phptemplate.engine', 'a:14:{s:4:\"name\";s:3:\"Zen\";s:11:\"description\";s:41:\"The ultimate starting theme for Drupal 6.\";s:10:\"screenshot\";s:47:\"sites/all/themes/contrib/zen/zen/screenshot.png\";s:4:\"core\";s:3:\"6.x\";s:6:\"engine\";s:11:\"phptemplate\";s:11:\"stylesheets\";a:2:{s:3:\"all\";a:3:{s:17:\"html-elements.css\";s:50:\"sites/all/themes/contrib/zen/zen/html-elements.css\";s:8:\"tabs.css\";s:41:\"sites/all/themes/contrib/zen/zen/tabs.css\";s:7:\"zen.css\";s:40:\"sites/all/themes/contrib/zen/zen/zen.css\";}s:5:\"print\";a:1:{s:9:\"print.css\";s:42:\"sites/all/themes/contrib/zen/zen/print.css\";}}s:7:\"regions\";a:8:{s:4:\"left\";s:12:\"left sidebar\";s:5:\"right\";s:13:\"right sidebar\";s:6:\"navbar\";s:14:\"navigation bar\";s:11:\"content_top\";s:11:\"content top\";s:14:\"content_bottom\";s:14:\"content bottom\";s:6:\"header\";s:6:\"header\";s:6:\"footer\";s:6:\"footer\";s:14:\"closure_region\";s:7:\"closure\";}s:8:\"features\";a:10:{i:0;s:4:\"logo\";i:1;s:4:\"name\";i:2;s:6:\"slogan\";i:3;s:7:\"mission\";i:4;s:17:\"node_user_picture\";i:5;s:20:\"comment_user_picture\";i:6;s:6:\"search\";i:7;s:7:\"favicon\";i:8;s:13:\"primary_links\";i:9;s:15:\"secondary_links\";}s:8:\"settings\";a:8:{s:17:\"zen_block_editing\";s:1:\"1\";s:14:\"zen_breadcrumb\";s:3:\"yes\";s:24:\"zen_breadcrumb_separator\";s:5:\" › \";s:19:\"zen_breadcrumb_home\";s:1:\"1\";s:23:\"zen_breadcrumb_trailing\";s:1:\"1\";s:20:\"zen_breadcrumb_title\";s:1:\"0\";s:10:\"zen_layout\";s:22:\"border-politics-liquid\";s:14:\"zen_wireframes\";s:1:\"0\";}s:7:\"version\";s:13:\"6.x-1.0-beta2\";s:7:\"project\";s:3:\"zen\";s:9:\"datestamp\";s:10:\"1211289617\";s:7:\"scripts\";a:1:{s:9:\"script.js\";s:42:\"sites/all/themes/contrib/zen/zen/script.js\";}s:3:\"php\";s:5:\"4.3.5\";}', 'theme', 'sites/all/themes/contrib/zen/zen/', 0, 0, 0) in /Applications/MAMP/htdocs/modules/system/system.module on line 822.
user warning: Duplicate entry 'sites/all/themes/contrib/zen/STARTERKIT/' for key 1 query: INSERT INTO system (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('STARTERKIT', 'themes/engines/phptemplate/phptemplate.engine', 'a:15:{s:4:\"name\";s:26:\"Zen Themer’s Starter Kit\";s:11:\"description\";s:94:\"Read the online docs on how to create a sub-theme.\";s:10:\"screenshot\";s:54:\"sites/all/themes/contrib/zen/STARTERKIT/screenshot.png\";s:4:\"core\";s:3:\"6.x\";s:10:\"base theme\";s:3:\"zen\";s:11:\"stylesheets\";a:2:{s:3:\"all\";a:3:{s:10:\"layout.css\";s:50:\"sites/all/themes/contrib/zen/STARTERKIT/layout.css\";s:14:\"STARTERKIT.css\";s:54:\"sites/all/themes/contrib/zen/STARTERKIT/STARTERKIT.css\";s:7:\"zen.css\";s:47:\"sites/all/themes/contrib/zen/STARTERKIT/zen.css\";}s:5:\"print\";a:1:{s:9:\"print.css\";s:49:\"sites/all/themes/contrib/zen/STARTERKIT/print.css\";}}s:7:\"regions\";a:8:{s:4:\"left\";s:12:\"left sidebar\";s:5:\"right\";s:13:\"right sidebar\";s:6:\"navbar\";s:14:\"navigation bar\";s:11:\"content_top\";s:11:\"content top\";s:14:\"content_bottom\";s:14:\"content bottom\";s:6:\"header\";s:6:\"header\";s:6:\"footer\";s:6:\"footer\";s:14:\"closure_region\";s:7:\"closure\";}s:8:\"features\";a:10:{i:0;s:4:\"logo\";i:1;s:4:\"name\";i:2;s:6:\"slogan\";i:3;s:7:\"mission\";i:4;s:17:\"node_user_picture\";i:5;s:20:\"comment_user_picture\";i:6;s:6:\"search\";i:7;s:7:\"favicon\";i:8;s:13:\"primary_links\";i:9;s:15:\"secondary_links\";}s:8:\"settings\";a:7:{s:17:\"zen_block_editing\";s:1:\"1\";s:14:\"zen_breadcrumb\";s:3:\"yes\";s:24:\"zen_breadcrumb_separator\";s:5:\" › \";s:19:\"zen_breadcrumb_home\";s:1:\"1\";s:23:\"zen_breadcrumb_trailing\";s:1:\"1\";s:20:\"zen_breadcrumb_title\";s:1:\"0\";s:14:\"zen_wireframes\";s:1:\"0\";}s:7:\"version\";s:13:\"6.x-1.0-beta2\";s:7:\"project\";s:3:\"zen\";s:9:\"datestamp\";s:10:\"1211289617\";s:7:\"scripts\";a:1:{s:9:\"script.js\";s:49:\"sites/all/themes/contrib/zen/STARTERKIT/script.js\";}s:3:\"php\";s:5:\"4.3.5\";s:6:\"engine\";s:11:\"phptemplate\";}', 'theme', 'sites/all/themes/contrib/zen/STARTERKIT/', 0, 0, 0) in /Applications/MAMP/htdocs/modules/system/system.module on line 822.
user warning: Duplicate entry 'sites/all/themes/contrib/wabi/' for key 1 query: INSERT INTO system (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('wabi', 'themes/engines/phptemplate/phptemplate.engine', 'a:13:{s:4:\"name\";s:4:\"Wabi\";s:11:\"description\";s:90:\"Table based recolorable multi-column liquid/fixed layout theme, designed by Pixture Studio\";s:7:\"version\";s:7:\"6.x-1.1\";s:4:\"core\";s:3:\"6.x\";s:6:\"engine\";s:11:\"phptemplate\";s:11:\"stylesheets\";a:1:{s:3:\"all\";a:1:{s:9:\"style.css\";s:39:\"sites/all/themes/contrib/wabi/style.css\";}}s:7:\"project\";s:4:\"wabi\";s:9:\"datestamp\";s:10:\"1209129624\";s:7:\"regions\";a:5:{s:4:\"left\";s:12:\"Left sidebar\";s:5:\"right\";s:13:\"Right sidebar\";s:7:\"content\";s:7:\"Content\";s:6:\"header\";s:6:\"Header\";s:6:\"footer\";s:6:\"Footer\";}s:8:\"features\";a:10:{i:0;s:20:\"comment_user_picture\";i:1;s:7:\"favicon\";i:2;s:7:\"mission\";i:3;s:4:\"logo\";i:4;s:4:\"name\";i:5;s:17:\"node_user_picture\";i:6;s:6:\"search\";i:7;s:6:\"slogan\";i:8;s:13:\"primary_links\";i:9;s:15:\"secondary_links\";}s:7:\"scripts\";a:1:{s:9:\"script.js\";s:39:\"sites/all/themes/contrib/wabi/script.js\";}s:10:\"screenshot\";s:44:\"sites/all/themes/contrib/wabi/screenshot.png\";s:3:\"php\";s:5:\"4.3.5\";}', 'theme', 'sites/all/themes/contrib/wabi/', 0, 0, 0) in /Applications/MAMP/htdocs/modules/system/system.module on line 822.
user warning: Duplicate entry 'sites/all/themes/contrib/ubiquity/' for key 1 query: INSERT INTO system (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('ubiquity', 'themes/engines/phptemplate/phptemplate.engine', 'a:13:{s:4:\"name\";s:8:\"Ubiquity\";s:11:\"description\";s:146:\"Generic yet stylish theme. It\'s tableless and has \'anyorder columns\'. Get graphic source from m42|templates\";s:10:\"screenshot\";s:48:\"sites/all/themes/contrib/ubiquity/screenshot.png\";s:4:\"core\";s:3:\"6.x\";s:6:\"engine\";s:11:\"phptemplate\";s:7:\"regions\";a:6:{s:4:\"left\";s:12:\"Left sidebar\";s:5:\"right\";s:13:\"Right sidebar\";s:11:\"content_top\";s:11:\"Content top\";s:14:\"content_bottom\";s:14:\"Content bottom\";s:6:\"header\";s:6:\"Header\";s:6:\"footer\";s:6:\"Footer\";}s:8:\"features\";a:10:{i:0;s:4:\"logo\";i:1;s:4:\"name\";i:2;s:6:\"slogan\";i:3;s:7:\"mission\";i:4;s:17:\"node_user_picture\";i:5;s:20:\"comment_user_picture\";i:6;s:6:\"search\";i:7;s:7:\"favicon\";i:8;s:13:\"primary_links\";i:9;s:15:\"secondary_links\";}s:11:\"stylesheets\";a:1:{s:16:\"screen,projector\";a:1:{s:9:\"style.css\";s:43:\"sites/all/themes/contrib/ubiquity/style.css\";}}s:7:\"version\";s:11:\"6.x-1.x-dev\";s:7:\"project\";s:8:\"ubiquity\";s:9:\"datestamp\";s:10:\"1212236042\";s:7:\"scripts\";a:1:{s:9:\"script.js\";s:43:\"sites/all/themes/contrib/ubiquity/script.js\";}s:3:\"php\";s:5:\"4.3.5\";}', 'theme', 'sites/all/themes/contrib/ubiquity/', 0, 0, 0) in /Applications/MAMP/htdocs/modules/system/system.module on line 822.
user warning: Duplicate entry 'sites/all/themes/contrib/skyliner/' for key 1 query: INSERT INTO system (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('skyliner', 'themes/engines/phptemplate/phptemplate.engine', 'a:13:{s:4:\"name\";s:8:\"Skyliner\";s:11:\"description\";s:37:\"Pure css theme, single column layout.\";s:7:\"version\";s:11:\"6.x-1.x-dev\";s:4:\"core\";s:3:\"6.x\";s:6:\"engine\";s:11:\"phptemplate\";s:10:\"screenshot\";s:55:\"sites/all/themes/contrib/skyliner/images/screenshot.png\";s:8:\"features\";a:7:{i:0;s:4:\"name\";i:1;s:6:\"slogan\";i:2;s:7:\"mission\";i:3;s:6:\"search\";i:4;s:7:\"favicon\";i:5;s:13:\"primary_links\";i:6;s:15:\"secondary_links\";}s:7:\"regions\";a:2:{s:5:\"right\";s:12:\"Slide Blocks\";s:6:\"footer\";s:6:\"Footer\";}s:7:\"scripts\";a:1:{s:11:\"skyliner.js\";s:45:\"sites/all/themes/contrib/skyliner/skyliner.js\";}s:11:\"stylesheets\";a:1:{s:3:\"all\";a:4:{s:16:\"styles/reset.css\";s:50:\"sites/all/themes/contrib/skyliner/styles/reset.css\";s:21:\"styles/typography.css\";s:55:\"sites/all/themes/contrib/skyliner/styles/typography.css\";s:16:\"styles/forms.css\";s:50:\"sites/all/themes/contrib/skyliner/styles/forms.css\";s:16:\"styles/style.css\";s:50:\"sites/all/themes/contrib/skyliner/styles/style.css\";}}s:7:\"project\";s:8:\"skyliner\";s:9:\"datestamp\";s:10:\"1192752371\";s:3:\"php\";s:5:\"4.3.5\";}', 'theme', 'sites/all/themes/contrib/skyliner/', 0, 0, 0) in /Applications/MAMP/htdocs/modules/system/system.module on line 822.
user warning: Duplicate entry 'sites/all/themes/contrib/pixture/' for key 1 query: INSERT INTO system (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('pixture', 'themes/engines/phptemplate/phptemplate.engine', 'a:13:{s:4:\"name\";s:7:\"Pixture\";s:11:\"description\";s:90:\"Table based recolorable multi-column liquid/fixed layout theme, designed by Pixture Studio\";s:7:\"version\";s:7:\"6.x-1.1\";s:4:\"core\";s:3:\"6.x\";s:6:\"engine\";s:11:\"phptemplate\";s:11:\"stylesheets\";a:1:{s:3:\"all\";a:1:{s:9:\"style.css\";s:42:\"sites/all/themes/contrib/pixture/style.css\";}}s:7:\"project\";s:7:\"pixture\";s:9:\"datestamp\";s:10:\"1209129615\";s:7:\"regions\";a:5:{s:4:\"left\";s:12:\"Left sidebar\";s:5:\"right\";s:13:\"Right sidebar\";s:7:\"content\";s:7:\"Content\";s:6:\"header\";s:6:\"Header\";s:6:\"footer\";s:6:\"Footer\";}s:8:\"features\";a:10:{i:0;s:20:\"comment_user_picture\";i:1;s:7:\"favicon\";i:2;s:7:\"mission\";i:3;s:4:\"logo\";i:4;s:4:\"name\";i:5;s:17:\"node_user_picture\";i:6;s:6:\"search\";i:7;s:6:\"slogan\";i:8;s:13:\"primary_links\";i:9;s:15:\"secondary_links\";}s:7:\"scripts\";a:1:{s:9:\"script.js\";s:42:\"sites/all/themes/contrib/pixture/script.js\";}s:10:\"screenshot\";s:47:\"sites/all/themes/contrib/pixture/screenshot.png\";s:3:\"php\";s:5:\"4.3.5\";}', 'theme', 'sites/all/themes/contrib/pixture/', 0, 0, 0) in /Applications/MAMP/htdocs/modules/system/system.module on line 822.
user warning: Duplicate entry 'sites/all/themes/contrib/nitobe/' for key 1 query: INSERT INTO system (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('nitobe', 'themes/engines/phptemplate/phptemplate.engine', 'a:13:{s:4:\"name\";s:6:\"Nitobe\";s:11:\"description\";s:118:\"Fixed width (960 pixels) theme with a right side bar region and a bottom region. Designed as a single-user blog theme.\";s:10:\"screenshot\";s:46:\"sites/all/themes/contrib/nitobe/screenshot.png\";s:4:\"core\";s:3:\"6.x\";s:6:\"engine\";s:11:\"phptemplate\";s:7:\"regions\";a:7:{s:12:\"admin_header\";s:12:\"Admin Header\";s:6:\"header\";s:6:\"Header\";s:7:\"content\";s:7:\"Content\";s:4:\"left\";s:13:\"Upper Sidebar\";s:5:\"right\";s:13:\"Lower Sidebar\";s:6:\"bottom\";s:16:\"Bottom Block Bar\";s:6:\"footer\";s:6:\"Footer\";}s:8:\"features\";a:6:{i:0;s:4:\"name\";i:1;s:6:\"slogan\";i:2;s:6:\"search\";i:3;s:7:\"favicon\";i:4;s:13:\"primary_links\";i:5;s:15:\"secondary_links\";}s:11:\"stylesheets\";a:3:{s:3:\"all\";a:2:{s:9:\"reset.css\";s:41:\"sites/all/themes/contrib/nitobe/reset.css\";s:8:\"text.css\";s:40:\"sites/all/themes/contrib/nitobe/text.css\";}s:6:\"screen\";a:3:{s:10:\"layout.css\";s:42:\"sites/all/themes/contrib/nitobe/layout.css\";s:9:\"style.css\";s:41:\"sites/all/themes/contrib/nitobe/style.css\";s:8:\"core.css\";s:40:\"sites/all/themes/contrib/nitobe/core.css\";}s:5:\"print\";a:1:{s:9:\"print.css\";s:41:\"sites/all/themes/contrib/nitobe/print.css\";}}s:7:\"version\";s:7:\"6.x-1.6\";s:7:\"project\";s:6:\"nitobe\";s:9:\"datestamp\";s:10:\"1217950243\";s:7:\"scripts\";a:1:{s:9:\"script.js\";s:41:\"sites/all/themes/contrib/nitobe/script.js\";}s:3:\"php\";s:5:\"4.3.5\";}', 'theme', 'sites/all/themes/contrib/nitobe/', 0, 0, 0) in /Applications/MAMP/htdocs/modules/system/system.module on line 822.
user warning: Duplicate entry 'sites/all/themes/contrib/lightfantastic/' for key 1 query: INSERT INTO system (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('lightfantastic', 'themes/engines/phptemplate/phptemplate.engine', 'a:13:{s:4:\"name\";s:15:\"Light Fantastic\";s:11:\"description\";s:41:\"A highly customizable theme for Drupal 6.\";s:7:\"version\";s:7:\"6.x-1.0\";s:4:\"core\";s:3:\"6.x\";s:6:\"engine\";s:11:\"phptemplate\";s:7:\"regions\";a:11:{s:15:\"navigation_left\";s:15:\"Left navigation\";s:16:\"navigation_right\";s:16:\"Right navigation\";s:12:\"sidebar_left\";s:12:\"Left sidebar\";s:13:\"sidebar_right\";s:13:\"Right sidebar\";s:3:\"top\";s:3:\"Top\";s:6:\"header\";s:6:\"Header\";s:6:\"banner\";s:6:\"Banner\";s:11:\"pre_content\";s:14:\"Before content\";s:7:\"content\";s:7:\"Content\";s:10:\"additional\";s:10:\"Additional\";s:6:\"bottom\";s:6:\"Bottom\";}s:11:\"stylesheets\";a:2:{s:3:\"all\";a:1:{s:9:\"style.css\";s:49:\"sites/all/themes/contrib/lightfantastic/style.css\";}s:5:\"print\";a:1:{s:22:\"assets/style/print.css\";s:62:\"sites/all/themes/contrib/lightfantastic/assets/style/print.css\";}}s:8:\"features\";a:9:{i:0;s:4:\"logo\";i:1;s:4:\"name\";i:2;s:6:\"slogan\";i:3;s:17:\"node_user_picture\";i:4;s:20:\"comment_user_picture\";i:5;s:6:\"search\";i:6;s:7:\"favicon\";i:7;s:13:\"primary_links\";i:8;s:15:\"secondary_links\";}s:7:\"project\";s:14:\"lightfantastic\";s:9:\"datestamp\";s:10:\"1217312714\";s:7:\"scripts\";a:1:{s:9:\"script.js\";s:49:\"sites/all/themes/contrib/lightfantastic/script.js\";}s:10:\"screenshot\";s:54:\"sites/all/themes/contrib/lightfantastic/screenshot.png\";s:3:\"php\";s:5:\"4.3.5\";}', 'theme', 'sites/all/themes/contrib/lightfantastic/', 0, 0, 0) in /Applications/MAMP/htdocs/modules/system/system.module on line 822.
user warning: Duplicate entry 'sites/all/themes/contrib/dreamy/' for key 1 query: INSERT INTO system (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('dreamy', 'themes/engines/phptemplate/phptemplate.engine', 'a:13:{s:4:\"name\";s:6:\"dreamy\";s:11:\"description\";s:53:\"A clean blog theme from the now defunct Ginger Ninja.\";s:4:\"core\";s:3:\"6.x\";s:6:\"engine\";s:11:\"phptemplate\";s:7:\"version\";s:7:\"6.x-1.4\";s:7:\"project\";s:6:\"dreamy\";s:9:\"datestamp\";s:10:\"1216303507\";s:7:\"regions\";a:5:{s:4:\"left\";s:12:\"Left sidebar\";s:5:\"right\";s:13:\"Right sidebar\";s:7:\"content\";s:7:\"Content\";s:6:\"header\";s:6:\"Header\";s:6:\"footer\";s:6:\"Footer\";}s:8:\"features\";a:10:{i:0;s:20:\"comment_user_picture\";i:1;s:7:\"favicon\";i:2;s:7:\"mission\";i:3;s:4:\"logo\";i:4;s:4:\"name\";i:5;s:17:\"node_user_picture\";i:6;s:6:\"search\";i:7;s:6:\"slogan\";i:8;s:13:\"primary_links\";i:9;s:15:\"secondary_links\";}s:11:\"stylesheets\";a:1:{s:3:\"all\";a:1:{s:9:\"style.css\";s:41:\"sites/all/themes/contrib/dreamy/style.css\";}}s:7:\"scripts\";a:1:{s:9:\"script.js\";s:41:\"sites/all/themes/contrib/dreamy/script.js\";}s:10:\"screenshot\";s:46:\"sites/all/themes/contrib/dreamy/screenshot.png\";s:3:\"php\";s:5:\"4.3.5\";}', 'theme', 'sites/all/themes/contrib/dreamy/', 0, 0, 0) in /Applications/MAMP/htdocs/modules/system/system.module on line 822.
user warning: Duplicate entry 'sites/all/themes/contrib/deco/' for key 1 query: INSERT INTO system (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('deco', 'themes/engines/phptemplate/phptemplate.engine', 'a:13:{s:4:\"name\";s:4:\"Deco\";s:11:\"description\";s:71:\"Modern, tableless, multi-column, fluid width theme with art deco looks.\";s:4:\"core\";s:3:\"6.x\";s:6:\"engine\";s:11:\"phptemplate\";s:7:\"regions\";a:9:{s:13:\"sidebar_right\";s:13:\"Right sidebar\";s:12:\"sidebar_left\";s:12:\"Left sidebar\";s:17:\"sidebar_right_sec\";s:23:\"Secondary right sidebar\";s:11:\"pre_content\";s:14:\"Before content\";s:7:\"content\";s:7:\"Content\";s:8:\"featured\";s:8:\"Featured\";s:14:\"content_bottom\";s:14:\"Bottom content\";s:6:\"header\";s:6:\"Header\";s:13:\"footer_region\";s:6:\"Footer\";}s:8:\"features\";a:6:{i:0;s:4:\"logo\";i:1;s:7:\"favicon\";i:2;s:4:\"name\";i:3;s:6:\"slogan\";i:4;s:7:\"mission\";i:5;s:20:\"comment_user_picture\";}s:11:\"stylesheets\";a:2:{s:3:\"all\";a:1:{s:9:\"style.css\";s:39:\"sites/all/themes/contrib/deco/style.css\";}s:5:\"print\";a:1:{s:9:\"print.css\";s:39:\"sites/all/themes/contrib/deco/print.css\";}}s:7:\"version\";s:7:\"6.x-1.1\";s:7:\"project\";s:4:\"deco\";s:9:\"datestamp\";s:10:\"1218130212\";s:7:\"scripts\";a:1:{s:9:\"script.js\";s:39:\"sites/all/themes/contrib/deco/script.js\";}s:10:\"screenshot\";s:44:\"sites/all/themes/contrib/deco/screenshot.png\";s:3:\"php\";s:5:\"4.3.5\";}', 'theme', 'sites/all/themes/contrib/deco/', 0, 0, 0) in /Applications/MAMP/htdocs/modules/system/system.module on line 822.
user warning: Duplicate entry 'sites/all/themes/contrib/barlow/' for key 1 query: INSERT INTO system (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('barlow', 'themes/engines/phptemplate/phptemplate.engine', 'a:13:{s:4:\"name\";s:6:\"Barlow\";s:11:\"description\";s:42:\"A sober but stylish theme, good for blogs.\";s:4:\"core\";s:3:\"6.x\";s:6:\"engine\";s:11:\"phptemplate\";s:11:\"stylesheets\";a:1:{s:3:\"all\";a:3:{s:14:\"typography.css\";s:46:\"sites/all/themes/contrib/barlow/typography.css\";s:10:\"layout.css\";s:42:\"sites/all/themes/contrib/barlow/layout.css\";s:9:\"style.css\";s:41:\"sites/all/themes/contrib/barlow/style.css\";}}s:7:\"regions\";a:6:{s:4:\"left\";s:12:\"Left sidebar\";s:5:\"right\";s:13:\"Right sidebar\";s:14:\"before_content\";s:14:\"Before content\";s:7:\"content\";s:7:\"Content\";s:6:\"header\";s:6:\"Header\";s:6:\"footer\";s:6:\"Footer\";}s:7:\"version\";s:7:\"6.x-1.0\";s:7:\"project\";s:6:\"barlow\";s:9:\"datestamp\";s:10:\"1194596703\";s:8:\"features\";a:10:{i:0;s:20:\"comment_user_picture\";i:1;s:7:\"favicon\";i:2;s:7:\"mission\";i:3;s:4:\"logo\";i:4;s:4:\"name\";i:5;s:17:\"node_user_picture\";i:6;s:6:\"search\";i:7;s:6:\"slogan\";i:8;s:13:\"primary_links\";i:9;s:15:\"secondary_links\";}s:7:\"scripts\";a:1:{s:9:\"script.js\";s:41:\"sites/all/themes/contrib/barlow/script.js\";}s:10:\"screenshot\";s:46:\"sites/all/themes/contrib/barlow/screenshot.png\";s:3:\"php\";s:5:\"4.3.5\";}', 'theme', 'sites/all/themes/contrib/barlow/', 0, 0, 0) in /Applications/MAMP/htdocs/modules/system/system.module on line 822.

OK, now there's an example hook implementation on the documentation page.

Those errors pop up every so often, but I have no idea why. It seems to be at random, and I can't tell if Ubercart causes them or not. However, they seem to be harmless, and don't show up that often.

If the hook is implemented so that the invoices with the custom names are recognized, the email predicates should still work because they will still have set the same invoice template. If instead the custom templates are changed to override the customer template, then changing those settings is correct.

The error messages in #60 look like a race condition rebuilding the system table.

Most likely this will be #147000: Rewrite module_rebuild_cache() and system_theme_data() I think (more info in comments on #307756: Backport of #147000: Unify and rewrite module_rebuild_cache() and system_theme_data() too).

EDIT: What I'm trying to say (but didn't make explicit) is that this is unlikely to be related to the UC theme change, and is probably just that you hit two admin pages at once, causing Drupal to attempt to rebuild its internal (menu|theme|module) list more than once concurrently and triggering INSERT DUPE errors in the process.

Ah, that might have been it; I may well have been popping open multiple admin pages at once to try and find the right ubercart admin page (a maze of twisty configuration options, all alike).

My experience agrees with grobot. The INSERT INTO system errors are probably unrelated. Typically flushing the cache then loading multiple pages simultaneously triggers this. I think this was supposed to be fixed in Drupal 6.16 (see #251792: Implement a locking framework for long operations).

BTW MadOverlord, are you sure it wasn't a twisting maze of little configuration options, all alike?


just a short note: it's still not working for me. therefor I updated uc_bank_transfer (only .dev so far) with instructions to put the new template into uc_order/templates. at least there it is found.

users of my module confirm the problem - see this duplicate issue #860380: uc_order-customer-bank_transfer.tpl.php


@frankj1013: You need to say what error message you got, or if it is the same as one previously mentioned, cite the comment number where someone else posted the error message. For example, "I got the same error as in #123" or "I got an error message that said 'xxxxx'". Either of these is helpful, but a simple "I'm getting an error" is not.

I just updated Ubercart and I cannot get my custom customer and admin templates to show unless I put them in uc_order/templates. This is obviously not the way the new system is supposed to show up. I have went over the documentation on Ubercart's website multiple times with no success.

These are the things that I did:
- Copied my old itpl files to my theme directory and renamed them to uc_order-admin.tpl.php and uc_order-customer.tpl.php and changed all tokens to variables
- Copied the dummy uc_order.tpl.php file to my theme directory
- Removed the templates from uc_order/templates (obviously didn't work, but I was shooting in the dark)
- Moved my custom templates into the uc_order/templates directory (the correct templates so up, but will obviously be overwritten on update)

Also, is it possible to put the templates in a sub-directory of the theme folder, like views allows for? This would be nice for organizational purposes. To clarify, I haven't put my custom templates in a sub-directory, this was just a thought I had had while setting things up!

@jacobneher From what you've said it should work, sub dirs should be fine too as the invoices are using the Drupal theme layer just like views.

All that springs to mind: did you clear your caches? This is needed to trigger a theme registry rebuild.

@fenstrat I tried clearing that cache (couldn't remember if I did that initially or not) but with no success.

Here is what I have tried:
I have placed the three template files in the root theme directory

I have placed the three template files in an 'invoices' subdirectory of the theme directory (and removed them from the root directory)

I cleared the cache in both instances.

At first I tried my old (itpl) template files (renamed and modified according to the instructions on I also copied the default templates and did the same thing as above (putting a test string in each template so I could tell while files were being called).

Nothing above has worked. I am assuming others are having success with the new template system??

Thanks for your reply fenstrat!

@jacobneher Very strange, everything you've outlined should have worked.

I've got similar setups working across many different sites.

Try stripping it right back. Try a fresh install of Drupal, then Ubercart and see if it still persist. You can also try hook_theme_registry_alter() and look for uc_order to find where the theme layer is picking up the templates from. Good luck!

NOTE: I changed my username, formally jacobneher (just to avoid confusion...sorry!)

@fenstrat Thanks again for your reply! I have not yet tried a clean install of Drupal/UberCart, I will try that soon and post my results.

I did try hook_theme_registry_alter() and this is what I got (only pertinent information posted - changed out 'theme-name' and 'domain-name' since this is a protected project) :

[uc_order] => Array
        [template] => uc_order
        [path] => sites/domain-name/themes/theme-name
        [include files] => Array
        [type] => theme_engine
        [theme path] => sites/domain-name/themes/theme-name
        [arguments] => Array
                [order] =>
                [op] => view
                [template] => customer
        [theme paths] => Array
                [0] => sites/domain-name/modules/contrib/ubercart/uc_order/templates
                [1] => sites/domain-name/themes/theme-name
        [preprocess functions] => Array
                [0] => template_preprocess
                [1] => template_preprocess_uc_order
                [2] => theme-name_preprocess

It appears to me that the [theme paths] array has the two locations backwards ... shouldn't my theme path be listed first? It seems to me like since the default module templates directory is in the first position of the array that it would check there first to see if anything exists, which obviously it does, so it doesn't even check my theme directory.

I admit I have no experience with the theme layer though so I could be totally off the mark.

Any help on this would be very helpful. I have everything working fine still with the customized templates in the module template directory, but that is obviously the correct setup.

Go to the admin page for conditional actions and check all the actions that involve sending email. You will probably have to reset the template to use (even if it looks OK), and then resave the action. That was what got things working for me (though I had custom actions before, and copied them into the default customer/admin templates as part of my debugging process)

I tried MadOverlord's suggestion a second time, still no change:
1) delete custom template from ubercart/uc_order/templates (the custom template together with the uc_order.tpl and the two default templates are all in the site theme)
2) reset the conditional actions listed under "Trigger: Customer completes checkout"
3) flush all caches
4) run cron
5) set the conditional actions again (admin to default, customer to bank transfer custom template)
6) go to ../admin/store/orders/13310/invoice -> it uses the default customer template (but it should be using the custom template)
7) copy the custom template to ubercart/uc_order/templates
8) reload ../admin/store/orders/13310/invoice -> it uses the custom template

@xibun I think I finally figured out the issue that I was having, which appears to be the same as yours. Mine was caused, it appears, by something not working correctly on my svn repository. Not sure that this helps you at all.

I created an 'invoices' subdirectory under my theme directory and I could not get that to work, but if the files are in the root theme directory then it appears to work.

1) delete custom template from ubercart/uc_order/templates (the custom template together with the uc_order.tpl and the two default templates are all in the site theme)

Did you try leaving the default templates in the uc_order/templates directory as well?

My current configuration, which is seeming to now work (using the custom templates) is:

- uc_order-admin.tpl.php
- uc_order-customer.tpl.php
- uc_order.tpl.php

- uc_order-admin.tpl.php
- uc_order-customer.tpl.php
- uc_order.tpl.php

I will try and post any follow-up comments I have once I learn more!

@bocaj: thanks for the info. I still struggle... I have the following setup (differences in bold):

bocaj xibun
- uc_order-admin.tpl.php
- uc_order-customer.tpl.php
- uc_order.tpl.php
- uc_order-admin.tpl.php
- uc_order-customer.tpl.php
- uc_order.tpl.php
- uc_order-admin.tpl.php
- uc_order-customer.tpl.php
- uc_order.tpl.php
- uc_order-admin.tpl.php
- uc_order-customer.tpl.php
- uc_order-customer-bank_transfer.tpl.php
- uc_order.tpl.php

my custom template has it's own name (I understand you modified the default files) with a hook in a module. also I have a "zen" based theme - could be another difference.

@xibun "/sites/all/themes/theme-name/ - Yeah, sorry, that was my typo...yours is the directory mine is in as well.

"uc_order-customer-bank_transfer.tpl.php" - My understanding of the new templating system is that the custom overrides had to be named "uc_order-admin.tpl.php" and "uc_order-customer.tpl.php" respectively, unless you created the newly created hook_uc_invoice_templates().

From - "Themes can now override invoice templates as per normal Drupal theming practices, e.g. copy uc_order-customer.tpl.php into your theme dir for customisation." I read this to mean that the file was supposed to be named uc_order-customer.tpl.php, but placed within your theme directory (and with your custom changes obviously).

Try changing your uc_order-customer-bank_transfer.tpl.php file to uc_order-customer.tpl.php and see if that works!

@bocaj: thanks, had the same idea yesterday when I read your post. just tried one more time now - but renaming uc_order-customer-bank_transfer.tpl.php to uc_order-customer.tpl.php doesn't solve the problem I see.
(and it should work both with both names as the hook is implemented and working when uc_order-customer-bank_transfer.tpl.php is in ../ubercart/uc_order/templates/)

I thought all template files (.tpl.php) have to use - (hyphens) instead of _ (underscores). Is it different for ubercart?

@xibun Have you tried hook_theme_registry_alter() in a custom module? I printed out the relevant information I received in #74 above. Maybe try this and make sure that the theme registry is even picking up your themes directory. You're specifically going to be looking at the [theme paths] array.

@robby.smith I believe (although I don't know this to be fact) that ubercart specifically looks for "uc_order" at the beginning of the filename. I am not a themer though...can anyone else clarify this better?

@robby.smith: I found some posts in external forums supporting your suggestion. but I couldn't find anything "official" - I posted a note here on d.o.

@bocaj: thanks again for your help. here is my output

    [uc_order] => Array
            [template] => uc_order
            [path] => sites/all/themes/theme-name
            [include files] => Array
            [type] => theme_engine
            [theme path] => sites/all/themes/theme-name
            [arguments] => Array
                    [order] =>
                    [op] => view
                    [template] => customer
            [theme paths] => Array
                    [0] => sites/all/modules/ubercart/uc_order/templates
                    [1] => sites/all/themes/theme-name
            [preprocess functions] => Array
                    [0] => template_preprocess
                    [1] => template_preprocess_uc_order

-> I cannot see a relevant difference to your output..

thanks xibun,

yea i use a lot of theme files and they all seem to use - instead of _ for drupal core as well as contrib modules:

a few examples:

@robby.smith I'm with you. I think for standardization that the invoice templates should use - instead of _. This is just one other thing that we as developers have to remember, and can potentially hang us up for quite so time trying to figure out why our custom templates aren't working.

@xibun Your hook_theme_registry_alter() does look identical to mine. I am actually not exactly sure what got mine was almost like one time it didn't and then all of the sudden it did (and thankfully has since). Do you have a separate sandbox or testing setup that you could try duplicating ubercart and your custom templates on? I have a feeling that it has to be something with your current configuration. It was a real pain on my end...and unfortunately, like I said, I'm not exactly sure what fixed it. There are several people though, including me now, that have it working so there has to be a system-specific configuration issue somewhere. Sorry I am not more help. If I think of anything else, I will certainly post.

I'm no theming master, but I'll take a stab at helping solve this. (See for more info on theming and template file suggestions.)

Has anyone implemented themename_preprocess_uc_order(&$vars) ? I'm wondering about the values are of any of

$vars['template'] or $vars['templates']
$vars['template_file'] or $vars['template_files']

The patch that was committed has template_preprocess_uc_order() which sets two template_files

// Add template file suggestions, default to customer template.
$variables['template_files'] = array(
'uc_order-'. $variables['template'],

I'm expecting that the second one is 'uc_order-customer-bank_transfer'.

Secondly, what are you guys using this template for? Emails or invoice pages?

The underscore in uc_order is part of the module name. Template names always use the module name unchanged - Ubercart doesn't do anything other than the Drupal default here.

@bocaj: there is one difference.. I didn't see [2] => theme-name_preprocess in the preprocess functions

@cedarm: thanks for your input! I was close to decide to let it rest...
I inspected the arrays as they enter and leave template_preprocess_uc_order() in uc_order.module..

array when going into the function:

    [template_files] => Array
    [template] => customer-bank_transfer

and when coming out:

    [template_files] => Array
            [0] => uc_order-customer
            [1] => uc_order-customer-bank_transfer
    [template] => customer-bank_transfer

EDIT: forgot to say: I use the template for both.. email and page invoices. currently debugging with page invoices. - and no, currently don't have a sandbox.

@xibun Have you tried devel themer on this page invoice?

now I got it !! stupid mistake in hindsight.. my admin theme is Garland and not the site theme - changing the admin theme and voilà! the .tpl is found.

thanks everyone!

EDIT: @TR: would it be possible to look in the site theme instead of the admin theme? from "be careful when updating Ubercart not to overwrite invoice template" I have moved to "be careful when updating Drupal not to overwrite invoice template" - to me a bigger problem since Drupal updates more often and the mental connection to invoices is less strong...


Shouldn't it still work with the admin theme set to Garland? This is how it works for drupal core template files such as profile-node-form.tpl.php (where the node form for content type 'profile' uses the template file) as well as with user-profile-form.tpl.php

Having to change the admin theme to the site theme seems weird right?

I'm sorry I don't know programming to help troubleshoot the code but I hope the info above allows for some investigating =)

Edit: as xibun mentioned, putting the .tpl.php file in the folder of the admin theme is a workaround, but as the above explanation shows this is not how other template file overrides work. I hope this can be looked into so that the .tpl.php file can be placed into the site's theme folder and work properly. Thanks!!

@xibun I have an admin theme setup on my site and have the templates working with them being in my frontend theme folder. Weird!

Glad you got it working (somewhat at least)!


I would recommend keeping a copy of the overridden template files in both the admin and the main theme. I find the admin theme setting to be a little flaky anyway, but this way you're almost guaranteed to get the correct template file.

I don't want to have to tell people to rename their invoice templates again, and (for me, at least) they do work correctly. They'll stay uc_order-[template].tpl.php for Drupal 6. However, for Drupal 7, the filename format has to change anyway. Help me remember to highlight some instructions to change any custom files to uc-order--[template].tpl.php. (That's a Drupal 7 change to put in two dashes.) Drupal 7 is also more strict in certain circumstances with the dashes in the filenames, so the change is doubly necessary.

FWIW, when I encountered the admin vs. default theme issue while patching uc_gift_order:

#862936: Fatal error: Call to undefined function uc_order_load_invoice() in D:\..ubercart\uc_gift_order\uc_gift_order.module on line 204

I found that placing the new template in uc_order/templates did make it available to both themes. I understand that's not desirable from a maintenance standpoint, and that getting away from having to maintain customized files in the ubercart module tree was part of the point here, but it may still be preferable to maintaining multiple copies and/or placing customizations in core theme directories.

Someone correct me if I'm wrong, but couldn't you subtheme Garland for example, and use that as your admin theme? Then you have a non-core admin theme to place templates into?

@cedarm & all: one could install an additional theme (renamed copy of Garland if you like) outside of core and make it the admin theme - but that also means more maintenance! and this change was meant to reduce maintenance. I think we all agree putting custom templates in a core theme is a no go. but forcing people to use a custom admin theme doesn't feel right either..

@robby.smith & Island Usurper: in that case the underscore in ...-bank_transfer will also change to a hyphen for the Drupal 7 template (and not before).

I thought this change was about conforming to the Drupal Way. I don't remember anyone saying anything about reducing the maintenance load. It's just that it's a more familiar kind of maintenance.

For Drupal 7, I was able to use hook_admin_paths() to specify 'admin/store/orders/*/invoice' and all of the paths underneath it as non-admin pages. Supposedly, that will keep Drupal from using the admin theme on those pages, but in my experience, it only works half the time.

Actually, the "bank_transfer" part can go either way on the filename, in both 6 and 7. When finding template files, it changes the filename to use underscores before matching it to theme function names. The reason it needs to start with uc-order in D7 is because it modifies the pattern "uc_order__" to use dashes to find the possible candidate files first.

Status:Fixed» Closed (fixed)

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

Yikes! I finally had time to upgrade to UC-2.4, and I have had a ton of trouble getting UC to recognize my custom templates. I have an admin theme and a public-facing theme, and even after putting templates in both (along with the dummy template), clearing the caches multiple times, etc., I was unable to get the template picked up by ubercart.

Only after using the ubercart function to add a new template in my custom module, and adding the uc_order-donor.tpl.php file directly into ubercart/uc_order/templates was I able to get it to work (more info:

Shall I open a new issue for this? It seems a lot of people are having trouble getting custom templates to work.

I found that you not only had to create the admin and user themes, but you had to go into conditional actions and resave the send email actions in order for the themes to be used.

Documentation could probably use some love:

Here's what worked for me.

  1. All of these changes required a hard cache clear (drush cc all), we're using a modified branch of Pressflow, so your mileage may vary.
  2. Overrides for default templates and custom templates all live in our theme. For example, this is the path to a custom template.

    sites/all/themes/(our theme)/ubercart/uc_order-group-admin.tpl.php

    Then that entire directory is symlinked into our admin theme.

  3. The hook to enable our custom template lives in a custom module where we set a bunch of other ubercart settings (apci_commerce.module):

    * Implementation of hook_uc_invoice_templates().
    * @return
    *  array of invoice types this module provides.
    function apci_commerce_uc_invoice_templates() {
      return array(

Category:task» bug
Status:Closed (fixed)» Active

I have reopened this issue and set it to "bug report" again.
It seems that the template files are not picked up.

Status:Active» Postponed (maintainer needs more info)

@JoepH: You're going to have to provide a little more information than that - how do you come to that conclusion? The three posts just above yours say it is working. I don't see any evidence that there's a bug here, other than the documentation needs some work.

When putting the custom template in sites/default/themes/[mytheme] they are just not picked up.
hook_uc_invoice_templates has been implemented and all caches were cleared.

It works if the custom template is stored in /sites/all/modules/ubercart/uc_order/templates but that is not an ideal situation.

@JoepH - I don't mean to be pedantic, but did you put your template files in the active theme?

sites/default/themes/ isn't a theme path, but whatever the path is, it needs to be the active theme when you are looking at uc_order settings.

no worries, good catch! The filter removed the themename because I put them between lt and gt
I meant sites/default/themes/mytheme

Hi all!

I am trying to customize the customer invoice template, but after updating to 2.4, I cannot get it to work. I had a customized customer template that was working (in ubercart/uc_order/) but after the update it was obviously overwritten. I uploaded the same customized template again, but it fails to show. I have cleared the cache multiple times without any luck.

Please help!

@hjelkris you need to upgrade your custom template. Please see


Thanks for the suggestion, but that is not it. I use the latest template and also tried to alter the version from the 2.4 ubercart zip file.

For me, it seems as it does not read and use the templates at all.

Any other ideas?

When renaming the custom template to admin, it worked... So problem solved for the moment, but still strange problem.

Status:Postponed (maintainer needs more info)» Closed (fixed)

I'm closing this thread again. It is degenerating into a general support thread for invoice templates. The original bug/task/issue is fixed and closed. If there is a reproducible problem with the invoice template system in Ubercart 2.4+ please open a new issue. If you just have problems getting it to work for you, please seek support in the forums.

Title:Move invoice templates to module based .tpl.php filesUbercart Multi Install - 2 languages, is it possible to use 2 templates ? How to select the right language template ?

Ubercart Multi Install - 2 languages, is it possible to use 2 templates ? How to select the right language template ?


I have a multi-install Drupal 6 Ubercart, and everything is OK but:

When customers orders they will receive a confirmation / summary Email that you can find in this file: uc_order-customer.tpl.php

It is possible to add a second uc_order-customer.tpl.php for the second website of the multi install (different language) ?
And how to select which template to use depending on which website customers ordered ?

Thanks for help.

Title:Ubercart Multi Install - 2 languages, is it possible to use 2 templates ? How to select the right language template ?Move invoice templates to module based .tpl.php files

Please create a new issue.

Version:6.x-2.x-dev» 6.x-2.4


Version:6.x-2.4» 6.x-2.x-dev

This issue was fixed in #57 and is part of ubercart-6.x-2.4, there is nothing to subscribe to here.