25 replies [Last post]
bmoreinis's picture
Offline
Joined: 02/01/2008
Juice: 29

Currently the order confirmation email includes the website logo in the top left. My client's logo is too big for his confirmation email and I would like to edit the template to put in a different logo there.

How to do that?

[Here I am posting an issue to the forum, Mike! Thanks for the Ethiopian dinner! -Bram]

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15422
Re: Customizing the Order Confirmation Email

Hey Bram, hope I didn't miss you in the crowd at dinner! Basically, what you need to do is copy the customer.itpl.php file in your uc_order/invoices folder and rename it. Then you can alter it to use a specific image file instead of the [site-logo] token. You just need to babysit this file when you do updates (i.e. make sure you don't delete the templates directory w/o backing up your custom file). Then in the e-mail checkout notifications predicate in Conditional Actions you can choose which e-mail template will be used for checkout notifications.

shiroitatsu's picture
Offline
Joined: 01/28/2009
Juice: 8
Re: Re: Customizing the Order Confirmation Email

Hmm. I was trying that, but when I change the template in Conditional Actions I always get "Unable to send e-mail"-error. Even if I choose the template that already is chosen and save changes. When i reset the action, e-mails are again moving normally.

It also seems that if I change the code in template, the e-mail that is sent doesn't change. The shop is localized and the phares in the template are getting translated (there's a translations-folder in uc_order/templates/) - could that somehow conflict with the action? Or is it something else? (UC D6-2.0-beta5)

daveydo's picture
Offline
Joined: 01/05/2009
Juice: 92
Do you have a wysiwyg editor configured.

I had the same error when fckeditor was adding flags to my recipients list.

ferrangil's picture
Offline
Joined: 02/27/2009
Juice: 62
Multilanguages??

And what about having multiple languages?? It is possible? How can I email the orders or any extra email in the user defined language?
Any help will be apreciated!

slipsey1's picture
Offline
Joined: 06/30/2009
Juice: 6
Re: Re: Re: Customizing the Order Confirmation Email

Did you ever figure out the fix for when you change the template in Conditional Actions.
I am still getting the "Unable to send e-mail" error

jasonabc's picture
Offline
Uber Donor
Joined: 05/05/2008
Juice: 573
shiroitatsu wrote: Hmm. I
shiroitatsu wrote:

Hmm. I was trying that, but when I change the template in Conditional Actions I always get "Unable to send e-mail"-error. Even if I choose the template that already is chosen and save changes. When i reset the action, e-mails are again moving normally.

I am experiencing this also. I've created a new template in the uc_orders/templates folder and assigned that template in Conditional Actions. When I check out - I too get the "Unable to send e-mail" error. No customer receipt/invoice ever arrives.

I re-set this condition using the "reset" link next to it and now it's working again - but I dont want to use the default template. I want to use my own.

Any ideas?

thanks

Jason

govatron's picture
Offline
Joined: 02/22/2008
Juice: 24
Symlink

Heya Ryan, Ubercart rocks!

Regarding babysitting the order email .itpl files and making sure they don't get overwritten during Ubercart updates, here's a simple tip for those of you on the forum who have the basic ability to create symlinks:

Just put your custom order templates in your theme directory with your other tpl's and then put symlinks to those custom order itpl themes in the ubercart/uc_order/templates directory. That way even if you accidentally overwrite your whole ubercart module directory during an update, you'll only loose the symlinks and not the files. All you'd have to do is recreate the symlinks. Easy peasy.

scott.mclewin@drupal.org's picture
Offline
Joined: 12/19/2009
Juice: 2
Re: Re: Customizing the Order Confirmation Email

Ryan - is there a recommended method for customizing customer.itpl.php on a multi-site installation where Ubercart is under sites/all/modules and is shared between multiple sites?

The solutions recommended here appear to presume that the ubercart installation is dedicated to a single site. I only need to customize my customer.itpl.php file for a single site and want the default for the others.

Thanks for the help and the great module - Scott

janette's picture
Offline
Joined: 06/22/2009
Juice: 22
multiple site stores

I have three stores running off one ubercart install using the domain access module, and I'm using a custom invoice template that uses store-specific tokens:
[order-site-logo][order-store-name][order-store-address]
and this works great to customize every invoice with the store credentials from which the order was placed

HOWEVER

the store-specific tokens are not available for use on the "E-mail customer checkout notification" conditional action Sad
so the confirmation emails are sent from the main domain and not the sub-domain stores

Has anyone found a work-around for this? tokens can be used in the subject and body of the email, why not for the sender? I would like to use [order-store-email] in that field as shown in the attached screen shot

AttachmentSize
Screen shot 2010-01-16 at 5.18.36 AM.png 73.72 KB
Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6841
Re: multiple site stores

As a hack, I implemented hook_mail_alter() in a custom module for a similar setup.

<?php
function hook_mail_alter(&$message) {
  if (
$message['id'] == 'uc_order_invoice' || $message['id'] == 'uc_order_action-mail') {
    if (
$message['id'] == 'uc_order_invoice') {
     
$order = $message['params']['order'];
    }
    else {
     
$order = $message['params']['replacements']['order'];
    }

   

$email = uc_domain_variable_get($order->domain_id, 'uc_store_email', NULL);
   
$message['from'] = uc_domain_variable_get($order->domain_id, 'uc_store_name', NULL) .' <'. $email .'>';
   
// The "email invoice to admin" action can only hold settings for one site.
    // Replace it with the active site's email address.
   
if ($message['to'] == 'sales@site1.com') {
     
$message['to'] = $email;
    }
   
$headers = $message['headers'];
   
$headers['From'] = $headers['Sender'] = $headers['Return-Path'] = $headers['Errors-To'] = $message['from'];
   
$message['headers'] = $headers;
   
watchdog('debug', '<pre>@message</pre>', array('@message' => print_r($message, TRUE)), WATCHDOG_DEBUG);
  }
}
?>

For a more proper solution, we should make an issue for either uc_domain or domain_conf.

Baart's picture
Offline
Joined: 01/28/2011
Juice: 8
Neato! It worked Thanks a

Neato! It worked Smiling Thanks a million!

bayofodeke's picture
Offline
Joined: 03/07/2011
Juice: 7
Re: Re: Customizing the Order Confirmation Email

Daamn, you got major juice man! Seriously tho, your responses in these forums have walked me through most of my ubercart woes and earned me some money!

Thanks man

RachelNY's picture
Offline
Joined: 01/06/2009
Juice: 62
Re: Customizing the Order Confirmation Email

I had the same problem, the store name is repeated twice across the top of the email.

[LOGO] [Store Name] [Store Name]

I really think it would be helpful to have a configuration option so we can choose which elements to show at the top of the email.

In the interim, I took another approach to avoid having to babysit a template (I have one site - my first Drupal/Ubercart site - that I made modifications outside of the custom theme folder and changes mean having to refer to documentation to fix things that will break during upgrades - Never Again! - I am slowly eliminating these as I maintain the site). All the new sites only have customization in the theme folder (or with modules).

Here is the approach I took on the new sites: The logo for the sites are a 1px x 1px transparent gif. The actual logo that is visible on the site is a background image in the header that I set in styles.css. This way I have the nice large logo on the site and the Ubercart email has the small invisible gif instead of the giant logo.

Not exactly what I would like (an admin option to not display the store name would be great, then I could show the logo), but it is working here and I haven't done anything to muddle my upgrade path on the sites or create additional maintenance issues.

Rachel

angela's picture
Offline
Joined: 08/14/2009
Juice: 13
Hi, I'm having issues even

Hi,

I'm having issues even displaying the image. I used tag and it doesn't work. I also tried to set the header image as the [site-logo] in themes, and it still won't display the image in emails... I also clicked "Display image below" in my e-mail. Please help!

Angela

Edit: nevermind, for some reason when I went into conditional actions, it wouldn't read the new template I made, template2. It kept reading the default template.. so I just edited that one instead.

zapple@drupal.org's picture
Offline
Joined: 11/03/2009
Juice: 2
Templates in Theme

Hi,

Is it possible to place the templates inside your theme rather than inside the module? It would be the logical place to put it.

If not is this on the development roadmap?

Cheers
Zap

tstackhouse's picture
Offline
Joined: 01/28/2010
Juice: 22
Re: Customizing the Order Confirmation Email

I'd love to hear of any progress on this, having to sprinkle files into a module's directory kind of scares me, from a maintenance standpoint. I'm not really keen on the symlink idea either, because of my deployment setup.

ahimsauzi's picture
Offline
Joined: 09/21/2009
Juice: 51
Re: Customizing the Order Confirmation Email

I am running version 6.x.2.2 and I followed these instructions: http://www.duckzland.info/2009/05/ubercart-custom-invoice-page/

I didn't use the code provided but rather changes the customer.tpl.php to sitename.tpl.php and selected it under admin/store/settings/orders. I could not find it in print anywhere but it looks like that template is different than what is emailed to clients.

It will also be great to have the ability to email the same invoice to admin and customer.

ahimsauzi's picture
Offline
Joined: 09/21/2009
Juice: 51
Re: Re: Customizing the Order Confirmation Email

I was able to figure this one out! Add the template as Ryan suggested then choose your new template at admin/store/ca/uc_checkout_customer_notification/edit/actions under Send an e-mail to the customer

HodakMoment's picture
Offline
Joined: 03/30/2010
Juice: 12
new invoice templates not showing up in conditional actions

Does anybody know of any reason why new/altered email templates (in /ubercart/uc_order/templates) would not be showing up at admin/store/ca/uc_checkout_customer_notification/edit/actions ?

I have tried clearing the cache. I have also tried deleting the template files and proceeding with an order (emails are sent just fine somehow). Ubercart does not seem to care about what I have in my /ubercart/uc_order/templates folder at all....how can I make it care?

I am using the 6.x.2.x-dev version of UC and ran update.php after upgrading.

EDIT - Figured out that when I upgraded ubercart, i created a back up copy of the ubercart directory in the sites/all/modules directory. BAD NEWS...this appears to have been the issue.

tigeda's picture
Offline
Joined: 08/23/2010
Juice: 12
Custom customer order confirmation email templates not picked up
HodakMoment wrote:

Does anybody know of any reason why new/altered email templates (in /ubercart/uc_order/templates) would not be showing up at admin/store/ca/uc_checkout_customer_notification/edit/actions ?

I have tried clearing the cache. I have also tried deleting the template files and proceeding with an order (emails are sent just fine somehow). Ubercart does not seem to care about what I have in my /ubercart/uc_order/templates folder at all....how can I make it care?

I'm having this exact problem, Ive created a custom invoice template in modules/ubercart/uc_order/template but it is not being shown in the conditional actions settings page. I noticed the naming has changed from .itpl.php to .tpl.php but can't seem to find any docs discussing custom email invoices with the new naming.

Ive create uc_order-customer2.tpl.php , cleared cache, but its just not being picked up!

Any help would be much appreciated!

EDIT - Sanity restored: http://www.ubercart.org/docs/developer/17385/changing_invoice_templates_...

bayofodeke's picture
Offline
Joined: 03/07/2011
Juice: 7
Just clarify for people

The solution is indeed on the referenced page. The rest of the information was so vague that I scanned over the document several times, overlooking the solution. so I'll post it here again.

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. If you have created other invoice templates for your site, you will need to create a module to implement this hook so that you can choose those templates in the UI. It should return an array of the invoice types:

<?php
function uc_order_uc_invoice_templates() {
  return array(
'admin', 'customer');
}
?>

The really important part is making use of hook_uc_invoice_templates() in the form:

<?php
function mymodule_uc_invoice_templates() {
  return array(
'admin', 'customer', 'custom1', 'custom2'); //where custom1 and custom2 correspond with uc_order-custom1.tpl.php and uc_order-custom2.tpl.php
}
?>

Hope this helps anybody out there

sselden's picture
Offline
Joined: 02/13/2010
Juice: 32
Re: Customizing the Order Confirmation Email

Please clarify where we put the custom template - does this go into my theme folder? and what naming convention we should use.
thanks!

I'm not really a geek, I just play one on TV.

ahimsauzi's picture
Offline
Joined: 09/21/2009
Juice: 51
Add custom tamplate for invoice

Add your custom invoice template to: modules/ibercart/uc_order/templates.

Once you do that you will be able to see your template at admin/store/settings/orders under on-site invoice template.

Hope this helps.

tigeda's picture
Offline
Joined: 08/23/2010
Juice: 12
Re: Re: Customizing the Order Confirmation Email

The invoice template directory has actually changed to, your theme folder. So you can update ubercart without having to worry about overwriting any custom templates in the ubercart module directory. See the post above for a link to more info, and naming convention.

make-online-shop's picture
Offline
Joined: 01/01/2011
Juice: 216
Option to hide shop logo (too big) in confirmation Email sent ?

How to hide shop logo in customers confirmation Emails ?

Hi,

Can you tell me if there is an option to hide shop logo (too big) in confirmation Email sent to customers ?

Or do I have to do it in the template ?

Thanks a lot.