2 replies [Last post]
xerbutter's picture
Offline
Bug Finder
Joined: 09/07/2007
Juice: 146
Was this information Helpful?

Hi,

I wanted to theme invoices with more flexibility than the Notify > Checkout settings form provides. (Basically, I wanted to tweak the default, but still have access to the PHP variables set by uc_order_load_invoice).

I think an easy way to achieve this might be to let users override the default "customer.itpl.php" file by placing their own version in their theme directory.

This code seems to work well (line 2874 in uc_order.module):

  //Try the override template first
  $theme_directory_name = path_to_theme();
$file = $theme_directory_name . '/' . $template .'.itpl.php';
 
  //If override file doesn't exit, get the default
  if (!file_exists($file)) {
    $file = drupal_get_path('module', 'uc_order') .'/templates/'. $template .'.itpl.php';
  }

I still have one problem that I haven't found an easy fix for: hiding the shipping address on the invoice/email when no shippable products or in the invoice. Currently it shows up as just the state and zip code, which looks rather strange.

Hope this helps...and I would welcome other ideas...

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: better theming of invoices?

Just to clarify... you do know you can copy/modify the templates in that directory and select which one to use for e-mails, correct? I like the idea of looking in the themes directory for these, but that would take more changes due to the select box and all that.

xerbutter's picture
Offline
Bug Finder
Joined: 09/07/2007
Juice: 146
heh, nope. I figured I

heh, nope. Laughing out loud

I figured I could modify the customer.itpl.php file, but then that would get overwritten when upgrading. I didn't realize I could duplicate the file.

I agree that it would be a slight improvement to be able to put these in the theme directory...knowing me, I will forget all about this by tomorrow and delete the file during an upgrade or forget where to look to theme it... still, not that important. As usual, you guys are way ahead of me!

Thanks.