I believe it would be more effective and efficient if the email sent was based of a 'myfile.tpl.php' much like the invoices. This would allow for more flexibility in creating the emails and prevent the use of another module (MIMEMAIL).

Comments

jrust’s picture

Title: Email Message Template » Use tokens and theming system for email
Assigned: Unassigned » jrust
jrust’s picture

Status: Active » Fixed

Fixed in CVS

Status: Fixed » Closed (fixed)

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

kyuubi’s picture

Hello i would like to know if it is possible to have more than one tpl file for the gift certificate, to send customizaed emails based on some atributes (that part i have already done) but the theming system is allways getting the uc_gift_certificate.tpl.php even if i say in the theme function to get other tpl file :

function uc_gift_certificate_theme() {
return array(
'uc_gift_certificate' => array(
'template' => 'my_customized_certificate_email',
'arguments' => array('gift_certificate' => NULL, 'account' => NULL),
),
);
}

any idea why it allways gets the same file or what i would have to do to make him get another file?

best regards,

Joao Garin

kyuubi’s picture

Figured this out, the theme function is redirecting to the template_preprocess function where it is possible to set two special variables named "template_file" and "template_files", setting one of these variables (template_file has priority over template files) it will replace the tpl file to use in the gift email.

My code :

function template_preprocess_uc_gift_certificate(&$variables) {

$variables['template_file'] = 'uc_gift_mycertificate';
...

}

Put the file in the template dir and it´s done.

For more info on theme function http://api.drupal.org/api/drupal/includes--theme.inc/function/theme/6

Best regards,
Joao Garin