HtmlMailOrderDetails plugin workaround -> Improvement

zandmanneke

No avatar

2005-07-06 12:08

Below is an improvement for the HtmlMailOrderDetails plugin. Normally this plugin sends a html formatted order confirmation email to both the admin and the customer. This message is always from the email address you entered in your config (config/config.php).

This workaround shows the email with a user-friendly-name (i.e. Myshop) instead of shop@myshop.com. Also, the subject for the admin and the customer is different.

Here are the instructions:

- Make a backup of your shop.
- Download and Install the HtmlMailOrderDetails plugin and check whether it works.
- Make a backup of your shop.
- Open the language file (lang/en.php or your current language) and find the line below:

$lang['mail_title'] = 'New order';

Change this into the following 2 lines:
---------------------------------------
$lang['mail_user_title'] = 'Order confirmation'; // subject for client mail
$lang['mail_admin_title'] = 'New Order'; // subject for the admin mail

- Open plugins/HtmlMailOrderDetails/HtmlMailOrderDetails.php and locate the following code:

if( (isset($GLOBALS['config']['mail_informing']) && $GLOBALS['config']['mail_informing']) || (isset($GLOBALS['config']['mail_toclient']) && $GLOBALS['config']['mail_toclient']) ){
$sMailBody = throwOrderMail($iOrder);
if( isset($sMailBody) && isset($GLOBALS['config']['mail_informing']) && $GLOBALS['config']['mail_informing'] ){
// @mail( EMAIL, $GLOBALS['lang']['mail_title'], $GLOBALS['lang']['mail_txt'], 'FROM: '.EMAIL );
$sMail = finishOrderMail($sMailBody, $GLOBALS['lang']['mail_txt']);
sendHtmlMail( EMAIL, $GLOBALS['lang']['mail_title'], $sMail, 'FROM: '.EMAIL );
}
if( isset($sMailBody) && isset($GLOBALS['config']['mail_toclient']) && $GLOBALS['config']['mail_toclient'] ){
$sMail = finishOrderMail($sMailBody, $GLOBALS['lang']['mail_txtCustomer']);
sendHtmlMail( $aForm['sEmail'], $GLOBALS['lang']['mail_title'], $sMail, 'FROM: '.EMAIL );
}

Change this into the following:
-------------------------------
if( (isset($GLOBALS['config']['mail_informing']) && $GLOBALS['config']['mail_informing']) || (isset($GLOBALS['config']['mail_toclient']) && $GLOBALS['config']['mail_toclient']) ){
$sMailBody = throwOrderMail($iOrder);
if( isset($sMailBody) && isset($GLOBALS['config']['mail_informing']) && $GLOBALS['config']['mail_informing'] ){
// @mail( EMAIL, $GLOBALS['lang']['mail_title'], $GLOBALS['lang']['mail_txt'], 'FROM: '.EMAIL );
$sMail = finishOrderMail($sMailBody, $GLOBALS['lang']['mail_txt']);
sendHtmlMail( EMAIL, $GLOBALS['lang']['mail_admin_title'], $sMail, 'FROM: '.EMAIL );
}
if( isset($sMailBody) && isset($GLOBALS['config']['mail_toclient']) && $GLOBALS['config']['mail_toclient'] ){
$sMail = finishOrderMail($sMailBody, $GLOBALS['lang']['mail_txtCustomer']);
sendHtmlMail( $aForm['sEmail'], $GLOBALS['lang']['mail_user_title'], $sMail, 'FROM: '.EMAIL );
}

In the same file, locate the following code:
--------------------------------------------
if( isset($GLOBALS['config']['htmlMailSeparator']) && $GLOBALS['config']['htmlMailSeparator'] == 'LF' ){
$sHeaders = "MIME-Version: 1.0\n";
$sHeaders .= "Content-type: text/html; charset=iso-8859-1\n";
$sHeaders .= "Reply-To: ". EMAIL . "\n";
$sHeaders .= "X-Mailer: PHP/". phpversion() . "\n";
}else{ //default is CRLF
$sHeaders = "MIME-Version: 1.0\r\n";
$sHeaders .= "Content-type: text/html; charset=iso-8859-1\r\n";
$sHeaders .= "Reply-To: ". EMAIL . "\r\n";
$sHeaders .= "X-Mailer: PHP/". phpversion() . "\r\n";
}

And change this into the following:
-----------------------------------
if( isset($GLOBALS['config']['htmlMailSeparator']) && $GLOBALS['config']['htmlMailSeparator'] == 'LF' ){
$sHeaders = "MIME-Version: 1.0\n";
$sHeaders .= "Content-type: text/html; charset=iso-8859-1\n";
$sHeaders .= "Reply-To: ". EMAIL . "\n";
$sHeaders .= "X-Mailer: PHP/". phpversion() . "\n";
$sHeaders .= "From: ". EMAIL . "\n";
}else{ //default is CRLF
$sHeaders = "MIME-Version: 1.0\r\n";
$sHeaders .= "Content-type: text/html; charset=iso-8859-1\r\n";
$sHeaders .= "Reply-To: ". EMAIL . "\r\n";
$sHeaders .= "X-Mailer: PHP/". phpversion() . "\r\n";
$sHeaders .= "From: ". EMAIL . "\r\n";
}


- Open templates/admin/preferences_form.tpl and locate the following line (this is the last line in an array):

,Array( "email", "email" )

Remove this line and make sure the rest of the array stays unchanged!

- Login to your QC admin console and change your email adress to:

MyShop<mail@myshop.org>

Use your own shopname and email address ofcourse, and make sure the email address is in between the < and > brackets.

- Save your configuration and place an order in your own webshop. Check if everything works ok. Sometimes (depending on your e-mail client) the Html email is displayed as complete garbage. This is a known issue, I do not have a workaroud for that one yet and it is not caused by this workaround.

If it DOES NOT work, restore your previously made backup (you do have it don't you?)

Goodluck!

Zandmanneke

Back to top
about us | contact