Tiny suggestion: E-mail templates

Posts: 130
Joined: 08/14/2007
Uber DonorBug FinderEarly adopter... addicted to alphas.Cool profile pic award.Internationalizationizer

Hi everyone.

Lately i've been doing a lot of upgrading of übercart installations. One of the things that "annoy" me is that I need to keep and copy the template files for the customer and admin emails. I know this sounds like a strange and somewhat unnessesary request, but we now have 12 übercart sites and this stuff is starting to become annoying/timeconsuming and a possible source for error as I might actually forget doing this Sticking out tongue

What if we defined a subdirectory in the theme folder where the store module can search for additional e-mail templates? We would then have this structure:

themes/garland/uc_templates

In this way people will still be able to download ubercart and use the default mail templates, while you give the possibility to have custom templates in the theme folder.

The ultimate goal for us is that upgrading übercart is simply a matter of:
1) Replace the entire ubercart folder.
2) Run update.php

Any cons?

Best regards,
Thomas Kulvik

Ny Media AS
www.nymedia.no
+47 4000 7955

Posts: 4747
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

I don't see any cons... if there's any way you can patch this, I'd get it in as soon as it was tested. Otherwise I can try and get to it later this afternoon. Definitely a good idea. I was thinking something similar yesterday evening when writing the FAQ about updating your site.

Posts: 130
Joined: 08/14/2007
Uber DonorBug FinderEarly adopter... addicted to alphas.Cool profile pic award.Internationalizationizer

Good Smiling Give me a couple of working days and i'll submit a patch for you Smiling

Best regards,
Thomas Kulvik

Ny Media AS
www.nymedia.no
+47 4000 7955

Posts: 302
Joined: 08/28/2007
Early adopter... addicted to alphas.Not KulvikTheminator

Hi Kulvik, how are things going with this?

Posts: 12
Joined: 02/25/2008

This seems like a good feature to have!

Any word on a patch?

Thanks.

Posts: 130
Joined: 08/14/2007
Uber DonorBug FinderEarly adopter... addicted to alphas.Cool profile pic award.Internationalizationizer

Hi guys. Just had another son so i've been spending a week in the hospital and taking care of mother and son. Patch coming soon Eye-wink

Best regards,
Thomas Kulvik

Ny Media AS
www.nymedia.no
+47 4000 7955

Posts: 4747
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Well, I was wondering if you had just died in a horrible dog sledding accident, but this is quite the opposite! Congratulations! Laughing out loud

Posts: 302
Joined: 08/28/2007
Early adopter... addicted to alphas.Not KulvikTheminator
Posts: 130
Joined: 08/14/2007
Uber DonorBug FinderEarly adopter... addicted to alphas.Cool profile pic award.Internationalizationizer

Thanks Smiling

Sledding dogs uh? lol. not every norwegian in the world have that privilege. I have to walk with snowshoes to work. Have you seen the ending of the movie "The day after tomorrow"?. That's me walking to work...

Posts: 18
Joined: 07/30/2008

Just got the point of where I should theme the invoice and noticed the current place for doing it is editing the files on the module itself and looking through the site I got here..

I would say this patch was never made, was it? Anyway, I don't mind doing so if it's still necessary. I have one question though, and why the templating is done this way instead of using a normal theme('xxx') drupal function so that can be easily overridden in any theme. I would think that a small change to ubercart to have a theme('xxx') function but still use the whole logic around the .itpl.php files could be useful.. any comments?

a.=

Posts: 302
Joined: 08/28/2007
Early adopter... addicted to alphas.Not KulvikTheminator

We need a way to define different itpl.php files, the web interface would work fine for that. Then we need to either have a theme function that points to the itpl.php files or a web interface that allows entering of paths for the itpl.php files. The main downside to having .tpl.php files in the module folder itself is when updating you may forget to copy the files out and back in.

I love the way with views you have a theme wizard to help you with the names of the fields. I usually have a single theme_views_view_list function that switches on the name of the view. It's also so useful to be able to dump the node object (or use dev render) to see what fields you can use. Something like this would make creating invoice templates much nicer.

Maybe I'm being shortsighted as it's been a long time since I made an invoice template (it was a pain last time I checked).

Posts: 4747
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

D6 brought with it the ability to have module based .tpl.php files that can be overridden at the theme layer. I believe this will solve some issues with the templating system the way it is right now, but it might make it harder to have multiple variations of a template.

fwiw, you actually don't need to hack the core .itpl.php to alter your template. My recommendation in the docs is to copy the file and rename/modify the copy instead.