I have a custom invoice template (see https://drupal.org/node/1047638#comment-5587922 ) and when a customer completes checkout they get the correctly themed invoice (via my site theme template.php and custom order.tpl.php

However, if an admin creates and order and enters a payment for an over-the-counter transaction, the order invoice that is sent out is not the custom one.

Both scenarios trigger uc_order_action_email_invoice() from uc_order.rules.inc with the same parameters but the invoices generated a distinct. What I assume is happening is that the admin theme (seven) has no visibility of the custom invoice template where as my site theme does.

How can I get the custom invoice template used in both scenarious?

Comments

jonathan_hunt’s picture

I've worked around this by making a local copy of the seven theme (used for admin) and mapping to my template.php overrides.

This still seems like a UX/DX problem because setting a custom template via the settings UI for the uc_checkout_customer_notification rule lulls an administrator into thinking that setting will apply site-wide, when in fact it appears to be theme-dependent.

longwave’s picture

Ubercart does use hook_admin_paths() to address this issue when viewing invoices on screen, but looks like we need some further code to handle emails that are sent by Rules.

Rafal Lukawiecki’s picture

I can confirm I am experiencing this issue when invoices are sent as a result of a rule triggered after order status update. The workaround to subtheme an admin theme and to place a copy of the invoice templates in there has worked for me, too. Thank you.

longwave’s picture

I'm looking into hook_theme_registry_alter() for unrelated reasons but realised perhaps that could be a solution to this issue, if we can somehow force the admin theme to use template suggestions from another theme.

Rafal Lukawiecki’s picture

Pardon my ignorance, but I noticed that the most recent release of mailsystem module has an option that allows specifying which theme is in force when it handles email. Could that be of use?

longwave’s picture

So if you install mailsystem and use that option, does that fix this issue? If so, perhaps we can borrow the code and include it directly in Ubercart.

tr’s picture

Version: 7.x-3.0 » 7.x-3.x-dev
Issue summary: View changes