Jump to content
Olof Larsson

[Contribution] U HTML Emails

Recommended Posts

Hi Nick

I use a logo image with this:

In catalog/includes/languages/modules/UHtmlEmails/Standard/"all files you want" :

 

define('UHE_GREET_MR', '<a href="http://www.YOURSITE.com"><img src=http://www.YOURSITE.com/images/logo.gif width=240 height=92 border=0></a><br /> Exmo(a). Sr(a). %s,');

define('UHE_GREET_MS', '<a href="http://www.YOURSITE.com"><img src=http://www.YOURSITE.com/images/logo.gif width=240 height=92 border=0></a><br /> Exmo(a). Sr(a). %s,');

define('UHE_GREET_NONE', '<a href="http://www.YOURSITE.com"><img src=http://www.YOURSITE.com/images/logo.gif width=240 height=92 border=0></a><br /> Exmo(a). Sr(a). %s,');

 

Don't forget customize url's and width and height image settings

:)

Adelino

 

Thanks for the reply Adelino, but could you help me? I have know idea where to put the iage code in checkout_process.php! Maybe you know?

 

<?php
*/
require(DIR_WS_LANGUAGES . $language . '/modules/UHtmlEmails/Standard/checkout_process.php');
$ArrayLNTargets = array("\r\n", "\n\r", "\n", "\r", "\t"); //This will be used for taking away linefeeds with str_replace() throughout the mail. Tabs is invisible so we take them away to

for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {//walk through the order totals and create a string containing them
//The title sometimes ends with ':' and somtimes not and sometimes there is a space. Take it all away =)
$temp_title = trim(strip_tags($order_totals[$i]['title']));
if(substr($temp_title, -1) == ':'): $temp_title = substr($temp_title, 0, -1); endif;

$HTMLEmailOrderTotals .= '<em>'. $temp_title .': </em><strong>' . strip_tags($order_totals[$i]['text']) . "</strong>\n";
}

//Now we chall create an array with the attribute info for every product.
$HTML_Email_product_attributes = array();

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
if (isset($order->products[$i]['attributes'])) {//This product has attributes
	$HTML_Email_product_attributes[$i] ='';//make sure the array position is a string
	for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
		if (DOWNLOAD_ENABLED == 'true') {

		  $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename 
							   from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa 
							   left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
								on pa.products_attributes_id=pad.products_attributes_id
							   where pa.products_id = '" . $order->products[$i]['id'] . "' 
								and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' 
								and pa.options_id = popt.products_options_id 
								and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' 
								and pa.options_values_id = poval.products_options_values_id 
								and popt.language_id = '" . $languages_id . "' 
								and poval.language_id = '" . $languages_id . "'";
		  $attributes = tep_db_query($attributes_query);
		} else {
		  $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . "

popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id 
= '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and 

pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
		}
		$attributes_values = tep_db_fetch_array($attributes);

		$HTML_Email_product_attributes[$i] .= '<br /><em style="font-size:12px;">   -'. $attributes_values['products_options_name'] . ': ' . $attributes_values['products_options_values_name'] .'</em>';
	}
}else{ //This product does not have attributes
	$HTML_Email_product_attributes[$i] ='';
}
}




$html_email = '<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body style="margin: 0px; padding: 0px; background-color:#87A44C;">
<font face="Times New Roman, Times, serif">

<table width="100%" height="75px" border="0" background="'. HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_MODULES .'UHtmlEmails/'.ULTIMATE_HTML_EMAIL_LAYOUT.'/mailgradient.png" cellpadding="0" cellspacing="0"><tr valign="middle"><td>


<div style="font-size:14px; padding: 1em; border-style:solid; border-width: 14px; border-color: #87A44C; background-color:#FFFFFF;">
	<span style="font-size: 24px;">'.UHE_TEXT_DEAR . ' ' . $order->customer['firstname'] . ' ' . $order->customer['lastname'].',</span><br/>
	'.UHE_MESSAGE_GREETING.'<br /><br />
	<table style="font-size:14px; font-family:\'times\';" border="0" cellspacing="0" cellpadding="0">
	  <tr>
		<td><font face="Times New Roman, Times, serif" style="font-size:14px;"><strong>'.UHE_TEXT_ORDER_NUMBER.'</strong></font></td>
		<td><font face="Times New Roman, Times, serif" style="font-size:14px;"> '.$insert_id.'</font></td>
	  </tr>
	  <tr>
		<td><font face="Times New Roman, Times, serif" style="font-size:14px;"><strong>'.UHE_TEXT_INVOICE_URL.'</strong></font></td>
		<td><font face="Times New Roman, Times, serif" style="font-size:14px;"> <a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) .'">' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) .'</a></font></td>
	  </tr>
	  <tr>
		<td><font face="Times New Roman, Times, serif" style="font-size:14px;"><strong>'.UHE_TEXT_DATE_ORDERED.'</strong></font></td>
		<td><font face="Times New Roman, Times, serif" style="font-size:14px;"> '.strftime(DATE_FORMAT_LONG).'</font></td>
	  </tr>
	</table>';

	if ($order->info['comments']) {// Add the customers order comments If the exists.
   		$html_email .= '<strong>'.UHE_TEXT_COMMENTS.'</strong><br /><font face="Courier New, Courier, monospace" size="-1">'. str_replace($ArrayLNTargets, '<br />', tep_db_output($order->info['comments'])) .'</font><br />';
 		}

	//Now we will add a table containing the products of the order.
	$html_email .='
	<br />
	<strong>'.UHE_TEXT_ORDER_CONTENTS.'</strong><br />

	<table style="font-size:14px; font-family:\'times\';" border="0" cellpadding="3" cellspacing="2" bgcolor=white>
		<tr style="background-color:#87A44C; color:#FFFFFF; font-weight:bold;"> 
			<td align="left" width="300"><font face="Times New Roman, Times, serif" style="font-size:14px;">'.UHE_TEXT_PRODUCTS_ARTICLE.'</font></td>
			<td align="left" width="160"><font face="Times New Roman, Times, serif" style="font-size:14px;">'.UHE_TEXT_PRODUCTS_MODEL.'</font></td>
			<td align="center" width="100"><font face="Times New Roman, Times, serif" style="font-size:14px;">'.UHE_TEXT_PRODUCTS_PRICE.'</font></td>
			<td align="center" width="40"><font face="Times New Roman, Times, serif" style="font-size:14px;">'.UHE_TEXT_PRODUCTS_QTY.'</font></td>
			<td align="right" width="100"><font face="Times New Roman, Times, serif" style="font-size:14px;">'.UHE_TEXT_PRODUCTS_TOTAL.'</font></td>
		</tr>';
		for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {//Add one row for each product. The array $order exists already in checkout_process.php; to which we will include this file.
		$html_email .='
		<tr style="background-color:#DDDDDD;"> 
			<td valign="top" align="left"><font face="Times New Roman, Times, serif" style="font-size:14px;">'.$order->products[$i]['name'] . $HTML_Email_product_attributes[$i].'</font></td>
			<td valign="top" align="left"><font face="Times New Roman, Times, serif" style="font-size:14px;">'.$order->products[$i]['model'].'</font></td>
			<td valign="top" align="center"><font face="Times New Roman, Times, serif" style="font-size:14px;">'.$currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], 1).'</font></td>
			<td valign="top" align="center"><font face="Times New Roman, Times, serif" style="font-size:14px;">'.$order->products[$i]['qty'].'</font></td>
			<td valign="top" align="right"><font face="Times New Roman, Times, serif" style="font-size:14px;">'.$currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']).'</font></td>
		</tr>';
		}
	$html_email .='
	</table>

	<br />
	'.str_replace($ArrayLNTargets, '<br />', $HTMLEmailOrderTotals).'
	<br />';

	if (is_object($$payment)) {
		$html_email .= '<strong>'.UHE_TEXT_PAYMENT_METHOD . ': </strong>'. $order->info['payment_method'] . '<br />';
   		$payment_class = $$payment;
		if ($payment_class->email_footer) { 
     			$html_email .=str_replace($ArrayLNTargets, '<br />', $payment_class->email_footer).'<br />';
   		}else{
			$html_email .= '<br />';
		}
 		}

	$html_email .='<table style="font-size:14px; font-family:\'times\';" border="0" cellpadding="3" cellspacing="2" bgcolor=white>
		<tr style="background-color:#87A44C; color:#FFFFFF; font-weight:bold;">';
			if ($order->content_type != 'virtual') {
				$html_email .= '<td width="160"><font face="Times New Roman, Times, serif" style="font-size:14px;">'. UHE_TEXT_DELIVERY_ADDRESS .'</font></td>';
			}
			$html_email .= '<td width="160"><font face="Times New Roman, Times, serif" style="font-size:14px;">'. UHE_TEXT_BILLING_ADDRESS .'</font></td>
		</tr>
		<tr style="background-color:#DDDDDD;">';
			if ($order->content_type != 'virtual') {
				$html_email .= '<td><font face="Times New Roman, Times, serif" style="font-size:14px;">'. tep_address_label($customer_id, $sendto, 0, '', '<br />') .'</font></td>';
			}
			$html_email .= '<td><font face="Times New Roman, Times, serif" style="font-size:14px;">'. tep_address_label($customer_id, $billto, 0, '', '<br />') .'</font></td>
		</tr>
	</table>
	';

$html_email .= '
</div>
</font>
</body>
</html>';

//This erases the newlines =) if this is not done the mail sent will have adittional <br /> in it. 
//Why? Hint: look at the function tep_convert_linefeeds and where it is used.

$html_email = str_replace($ArrayLNTargets, '', $html_email);
?>

Edited by Stitch20

Share this post


Link to post
Share on other sites

I made some changes...

 

Please go to catalog/includes/languages/modules/UHtmlEmails/Standard/checkout_process.php

(not the file you show; this is in catalogue/includes/modules...)

 

Find

define('UHE_TEXT_DEAR', '

 

and insert the code for image logo

<a href="http://www.YOURSITE.com"><img src=http://www.YOURSITE.com/images/logo.gif width=240 height=92 border=0></a><br />

 

It'll look something like this:

define('UHE_TEXT_DEAR', '<a href="http://www.YOURSITE.com"><img src=http://www.YOURSITE.com/images/logo.gif width=240 height=92 border=0></a><br />Dear Sir / Mrs.');

 

Don't forget customize url's and width and height image settings

 

Adelino

Share this post


Link to post
Share on other sites
I made some changes...

 

Please go to catalog/includes/languages/modules/UHtmlEmails/Standard/checkout_process.php

(not the file you show; this is in catalogue/includes/modules...)

 

Find

define('UHE_TEXT_DEAR', '

 

and insert the code for image logo

<a href="http://www.YOURSITE.com"><img src=http://www.YOURSITE.com/images/logo.gif width=240 height=92 border=0></a><br />

 

It'll look something like this:

define('UHE_TEXT_DEAR', '<a href="http://www.YOURSITE.com"><img src=http://www.YOURSITE.com/images/logo.gif width=240 height=92 border=0></a><br />Dear Sir / Mrs.');

 

Don't forget customize url's and width and height image settings

 

Adelino

 

Thanks Adelino ik works great. You made my day :D

Edited by Stitch20

Share this post


Link to post
Share on other sites

Hi Olof,

 

I am completely new to this, so I apologize if this sounds stupid but I hope you (or someone else) can help me. I found and downloaded your contribution/addon but now what do I do?

 

Thanks!

Share this post


Link to post
Share on other sites

Hi, i'm italian so i'm sorry for my bad english...

 

I have a little problem with this contribution...i try to explain...

It works great if my customers chooses "Cash on Delivery" as payment method. They receive a beautiful html e-mail with their order details. But if they choose to pay with paypal standard, they receive a textual e-mail. I've noticed that osCommerce send orders e-mail directly from the paypal standard payment module with the same code that i've found in the checkout_process.php page, so i've tried to add the code of this contribution in the paypal_standard.php page but it doesn't work...

Can anyone help me? I hope that i have been clear...thank you very much!!

Share this post


Link to post
Share on other sites
Right I checked again and found I had made a mistake with inserting some code...

 

MODIFY THE FILE catalog/admin/orders.php

########		  FIND		   ########

if (isset($HTTP_POST_VARS['notify_comments']) && ($HTTP_POST_VARS['notify_comments'] == 'on')) {
		  $notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n\n";
}

I inseted BEFORE the last bracket :blush:

 

Everything works now, "Order Process" emails are in HTML form from Protx and Cheque/Postal orders BUT bloody Paypal is still playing up.

If someone pays using Paypal and completes the checkout process. The "Order Process" is in normal text form.

If I update that orders status though the email is sent in HTML.

 

I am using PayPal_Shopping_Cart_IPN_v3.1.4 by the way

 

Crazy

 

Hi, i have the same problem...but i've noticed that when customers choose Paypal as Payment method the e-mail is sent from the includes/modules/payment/paypal_standard.php file not from the checkout_process.php file. So we have to modify something in the paypal_standard.php file. I've tried to add there the same code that i've added in checkout_process.php but it doesn't work. When the customers come back to my site from paypal a blank page is displayed and the url is on checkout_process.php. In the last 2 days i was not able to fix this problem...please someone help me!!

Share this post


Link to post
Share on other sites

Could use some help. At points and rewards, I was suggested to try here. I have UHTML emails and points/rewards module installed.

First of all, new customers, orders placed, customers receives their email. Plus when order is moved from processed to delivered.

 

But my problem lies when I from admin add points to customer account, message at top of screen states, email sent to name(customer). But customer never receives this email. Below is a section of code from create_account.php that I believe is the issue area:

 

// build the message content
//---  Beginning of addition: Ultimate HTML Emails  ---//
if (EMAIL_USE_HTML == 'true') {
require(DIR_WS_MODULES . 'UHtmlEmails/'. ULTIMATE_HTML_EMAIL_LAYOUT .'/create_account.php');
$email_text = $html_email;
}else{
//---  End of addition: Ultimate HTML Emails  ---//
        $name = $firstname . ' ' . $lastname;

if (ACCOUNT_GENDER == 'true') {
        if ($gender == 'm') {
        $email_text = sprintf(EMAIL_GREET_MR, $lastname);
        } else {
        $email_text = sprintf(EMAIL_GREET_MS, $lastname);
        }
        } else {
        $email_text = sprintf(EMAIL_GREET_NONE, $firstname);
        }

// Points/Rewards system V2.1rc2a BOF
     if ((USE_POINTS_SYSTEM == 'true') && (NEW_SIGNUP_POINT_AMOUNT > 0)) {
      tep_add_welcome_points($customer_id);

     $points_account = '<a href="' . tep_href_link(FILENAME_MY_POINTS, '', 'SSL') . '"><b><u>' . EMAIL_POINTS_ACCOUNT . '</u></b></a>.';
     $points_faq = '<a href="' . tep_href_link(FILENAME_MY_POINTS_HELP, '', 'NONSSL') . '"><b><u>' . EMAIL_POINTS_FAQ . '</u></b></a>.';
     $text_points = sprintf(EMAIL_WELCOME_POINTS , $points_account, number_format(NEW_SIGNUP_POINT_AMOUNT,POINTS_DECIMAL_PLACES), $currencies->format(tep_calc_shopping_pvalue(NEW_SIGNUP_POINT_AMOUNT)), $points_faq) ."\n\n";



   $email_text .= EMAIL_WELCOME . EMAIL_USERNAME . EMAIL_PASSWORD . EMAIL_TEXT . $text_points . EMAIL_CONTACT . EMAIL_WARNING;
     } else {
      $email_text .= EMAIL_WELCOME . EMAIL_USERNAME . EMAIL_PASSWORD . EMAIL_TEXT .EMAIL_CONTACT . EMAIL_WARNING;
     }
// Points/Rewards system V2.1rc2a EOF
//---  Beginning of addition: Ultimate HTML Emails  ---//
}

if(ULTIMATE_HTML_EMAIL_DEVELOPMENT_MODE === 'true'){
//Save the contents of the generated html email to the harddrive in .htm file. This can be practical when developing a new layout.
$TheFileName = 'Last_mail_from_create_account.php.htm';
$TheFileHandle = fopen($TheFileName, 'w') or die("can't open error log file");
fwrite($TheFileHandle, $email_text);
fclose($TheFileHandle);
}
//---  End of addition: Ultimate HTML Emails  ---//

 

I hope someone can help or direct me to find a solution. Thanks.

 

blr

Share this post


Link to post
Share on other sites

Is the somebody out there using UHtmlEmails + idealm module?

When people buy something with the IDEAL payment module, they get the default osc mail? How can I change that in the UHtmlEmails?

Tanx

Share this post


Link to post
Share on other sites

For those still trying to get this contribution to work with edit order contribution, i have managed to succesfully integrate this, however it took a lot of soul searching and i lost track of exactly what i did, i will try to create a full instruction soon but whilst things are fresh in my mind here are some of the things i did, if someone could follow this and create a better set of instructions please do so....

 

**please note edit orders uses different files for AJAX and NON AJAX versions)

 

1. i searched my entire store for all instances of tep_mail (wherever you find tep mail is where an email will be sent)

2. wherever you find tep mail in a document, scroll upward and find where the first instance of $email= or $email_order= occurs (the start will be the $email= or the $email_order= that does not have a . (dot) emmediatly after it and is usually $email = STORE_NAME) an example that is NOT the start of this variable is $email_order .= EMAIL_TEXT_PRODUCTS (has a dot after $email_order)

3. once you have located the start of the $email.... variable you need to add the IF/else statement directly above it.

 

***** i found this part hard to explain but ill try ******

 

The if/else code may need changing depending on where the file that your are changing is located, if the file your are changing is located in the admin folder then you need to add DIR_FS_CATALOG . (shown red as below, this tells the include to find your layouts in CATALOG/includes/modules/UHtmlEmails/templatefolder and not in ADMIN/includes/modules....... which does not exist and will give a 'unable to open stream' error)

 

the XXXXXXXX you will need to change to the name of the Template file you have created (i simply copied orders.php that is already in your template folder and rename it to edit_orders.php which i use for both normal and ajax files.)

 

 

** I suspect that having DIR_FS_catalog at the start wont be a problem whether file is in the admin folder or not ********

 

 

//--- Beginning of addition: Ultimate HTML Emails ---//

if (EMAIL_USE_HTML == 'true') {

require(DIR_FS_CATALOG . DIR_WS_MODULES . 'UHtmlEmails/'. ULTIMATE_HTML_EMAIL_LAYOUT .'/edit_orders.php');

$email_order = $html_email;

}else{//Send text email

 

//--- End of addition: Ultimate HTML Emails ---//

 

4. i then copied orders.php in catalog/includes/languages/english/modules/UHtmlEmails/Standard folder and rename it edit_orders.php

 

Not sure if i missed any steps, but this worked for me.

 

PS. You also need to add a closing } at the end of the email code, the instructions dont tell you to do that, i add the closing } just before the first instance of tep_mail

 

i hope someone can make sense of the above and create a good set of instructions - i tried my best, the instructions above if you can folow them will help you change ALL areas of OSC that use emails and allow you to set them all to HTML

 

regards

 

S/\/\iler

Share this post


Link to post
Share on other sites

If using order editor and you find that the 'NEW ORDER EMAIL' does not show the DEAR NAME,

 

Add the following just above if (EMAIL_USE_HTML == 'true') { (around line 831 in admin/edit_orders_ajax.php)

 

 

$check_status_query = tep_db_query("

SELECT customers_name, customers_email_address, orders_status, date_purchased

FROM " . TABLE_ORDERS . "

WHERE orders_id = '" . (int)$oID . "'");

 

$check_status = tep_db_fetch_array($check_status_query);

Share this post


Link to post
Share on other sites
If using order editor and you find that the 'NEW ORDER EMAIL' does not show the DEAR NAME,

 

Add the following just above if (EMAIL_USE_HTML == 'true') { (around line 831 in admin/edit_orders_ajax.php)

 

 

$check_status_query = tep_db_query("

SELECT customers_name, customers_email_address, orders_status, date_purchased

FROM " . TABLE_ORDERS . "

WHERE orders_id = '" . (int)$oID . "'");

 

$check_status = tep_db_fetch_array($check_status_query);

 

I was wondering if someone could help me with this? I have Ultimate HTML Email installed, I have everything working fine accept when I go to Admin to update an order for a customer. I change the order status from pending to processing and it sends the Ultimate HTML Email layout that I use. When I update the order to shipped and include the tracking number and send the update, it's in plain text. The shipping number is there and it is a working link to track the package but I cant figure out how to change this email layout to use the Ultimate HTML Email.

Share this post


Link to post
Share on other sites
I was wondering if someone could help me with this? I have Ultimate HTML Email installed, I have everything working fine accept when I go to Admin to update an order for a customer. I change the order status from pending to processing and it sends the Ultimate HTML Email layout that I use. When I update the order to shipped and include the tracking number and send the update, it's in plain text. The shipping number is there and it is a working link to track the package but I cant figure out how to change this email layout to use the Ultimate HTML Email.

 

ricky,

 

as per my prev post+1, above, order editor has 2 options,

 

1. normal mode (not using Ajax)- add the if/else stuff to admin/edit_orders.php

2. AJAx Mode - add if/else stuff to admin/edit_orders_ajax.php

Share this post


Link to post
Share on other sites

Hi....Sorry my bad english

 

 

But,

 

My require(DIR_FS_CATALOG . '/' . DIR_WS_MODULES . 'UHtmlEmails/'. ULTIMATE_HTML_EMAIL_LAYOUT' .'/checkout_process.php');

dont work.

 

I receive blank page...and dont continue process of send email..

 

to test my checkout_process.php is blank

 

idea??

 

Acolen

Share this post


Link to post
Share on other sites

I try too:

 

require(DIR_FS_CATALOG . DIR_WS_MODULES . 'UHtmlEmails/'. ULTIMATE_HTML_EMAIL_LAYOUT .'/checkout_process.php');

 

Dont work

Share this post


Link to post
Share on other sites

Hi

i did install this contribute ....

 

But when i want to switch pr change the default ( basic ) i see this error :

 

Fatal error: Call to undefined function tep_cfg_pull_down_uhtml_email_layout_list() in

/webwinkel/iadmin/configuration.php(125) : eval()'d code on line 1

Someone knows what can be wrong or what did i wrong ?

i did install everything as in the manual , checked all the files

 

hope someone knows the sollution

 

bye all mandy

Share this post


Link to post
Share on other sites
Hi

i did install this contribute ....

 

But when i want to switch pr change the default ( basic ) i see this error :

 

Fatal error: Call to undefined function tep_cfg_pull_down_uhtml_email_layout_list() in

/webwinkel/iadmin/configuration.php(125) : eval()'d code on line 1

Someone knows what can be wrong or what did i wrong ?

i did install everything as in the manual , checked all the files

 

hope someone knows the sollution

 

bye all mandy

 

Hi All problem is solved,,,,,,,

it was just a small typo

Share this post


Link to post
Share on other sites
Hi, great work this contribution.

I installed and everything goes fine except the subject of "tell_a_friend" -> is empty!!

Here the code of my tell_a_friend.php:

 

 

//--- Beginning of addition: Ultimate HTML Emails ---//

if (EMAIL_USE_HTML == 'true') {

require(DIR_WS_MODULES . 'UHtmlEmails/'. ULTIMATE_HTML_EMAIL_LAYOUT .'/tell_a_friend.php');

$email_body = $html_email;

}else{//Send text email

//--- End of addition: Ultimate HTML Emails ---//

$email_subject = sprintf(TEXT_EMAIL_SUBJECT, $from_name, STORE_NAME);

$email_body = sprintf(TEXT_EMAIL_INTRO, $to_name, $from_name, $product_info['products_name'], STORE_NAME) . "\n\n";

 

if (tep_not_null($message)) {

$email_body .= $message . "\n\n";

}

 

$email_body .= sprintf(TEXT_EMAIL_LINK, tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'], 'NONSSL', false)) . "\n\n" .

sprintf(TEXT_EMAIL_SIGNATURE, STORE_NAME . "\n" . HTTP_SERVER . DIR_WS_CATALOG . "\n");

//--- Beginning of addition: Ultimate HTML Emails ---//

}

 

if(ULTIMATE_HTML_EMAIL_DEVELOPMENT_MODE === 'true'){

//Save the contents of the generated html email to the harddrive in .htm file. This can be practical when developing a new layout.

$TheFileName = 'Last_mail_from_tell_a_friend.htm';

$TheFileHandle = fopen($TheFileName, 'w') or die("can't open error log file");

fwrite($TheFileHandle, $email_body);

fclose($TheFileHandle);

}

//--- End of addition: Ultimate HTML Emails ---//

tep_mail($to_name, $to_email_address, $email_subject, $email_body, $from_name, $from_email_address);

 

$messageStack->add_session('header', sprintf(TEXT_EMAIL_SUCCESSFUL_SENT, $product_info['products_name'], tep_output_string_protected($to_name)), 'success');

 

tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));

}

} elseif (tep_session_is_registered('customer_id')) {

$account_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");

$account = tep_db_fetch_array($account_query);

 

$from_name = $account['customers_firstname'] . ' ' . $account['customers_lastname'];

$from_email_address = $account['customers_email_address'];

}

==========================

 

Thanks

 

same problem. please help...

Share this post


Link to post
Share on other sites
same problem. please help...

 

 

Hi timehost

 

I think the problem is not in the file you show

 

Please go to catalog/tell_a_friend.php and find :

 

tep_mail($to_name, $to_email_address, UHE_TEXT_EMAIL_SUBJECT, $email_body, $from_name, $from_email_address);

´

If you find UHE_TEXT_EMAIL_SUBJECT, that's OK!

 

Then go to catalog/includes/languages/-- your language -- /modules/UHtmlEmails/standard/tell_a_friend.php and put the subject you want in:

 

define('UHE_TEXT_EMAIL_SUBJECT', ' --- THE SUBJECT YOU WANT --- ');

 

That's it.

Share this post


Link to post
Share on other sites
Hi timehost

 

I think the problem is not in the file you show

 

Please go to catalog/tell_a_friend.php and find :

 

tep_mail($to_name, $to_email_address, UHE_TEXT_EMAIL_SUBJECT, $email_body, $from_name, $from_email_address);

´

If you find UHE_TEXT_EMAIL_SUBJECT, that's OK!

 

Then go to catalog/includes/languages/-- your language -- /modules/UHtmlEmails/standard/tell_a_friend.php and put the subject you want in:

 

define('UHE_TEXT_EMAIL_SUBJECT', ' --- THE SUBJECT YOU WANT --- ');

 

That's it.

 

 

It works fine now. Many thanks conta_b!!!

Share this post


Link to post
Share on other sites

I installed this contribution and it was very easy and with great results!

 

Thanks Olof and Liliagiba!

 

There is one thing that is missing in this contribution, the 'Content-Type: text/plain' is worst than standard osC.

 

If someone use a 'non-HTML' e-mail viewer with U HTML they see:

storeDear customer,Thank you for shopping with us today.Please find below the details of your order. Order Number: 82 Detailed Invoice: https://www.store.com/account_history_info.php?order_id=82 Date Ordered: Wednesday 24 December, 2008 Contents of the order ProductModelPrice (Inc. VAT)Qty.Total (Inc. VAT) Product -Music Download: mp32.65 EUR12.65 EURTotal: 2.65 EURPayment Method: Credit CardBilling AddressName, Address, Country

 

Standard osC puts linebreaks on the right places (in both text/plain and text/html).

 

What can I do to display the Content-Type: text/html like it does, but change the Content-Type: text/plain with linebreaks to make it readable?

 

I do not mind if I also must make a text/plain layout (in this way you are more certan on the behavour of the text layout than with conversion from the html).

 

I hope to hear some suggestions...

 

Kind regards, Patrick

Share this post


Link to post
Share on other sites

[update text/plain has no linefeeds]

 

The problem seems to be the handling of the $email_text in general.php, function tep_mail.

 

tep_mail expects $email_text to be text/plain (with \n as linefeed).

 

If EMAIL_USE_HTML = true it uses $email_text as text/plain and converts $email_text to text/html with function tep_convert_linefeeds(array("\r\n", "\n", "\r"), '<br>', $email_text ) (-> simply replace 'text linefeed' by 'html linefeed').

(this is done in email.php function add_html)

 

U HTML works the other way around and offers tep_mail html as $email_text.

The text/html is handled fine with add_html because there are no \r and/or \n in the offered $email_text (which is html).

 

At this moment there are a few alternatives that could work to put linefeeds in text/plain:

1. to make a U HTML tep_mail, cons: 'not standard osC'

2. change tep_mail in general.php (admin and catalog) to correct the email->html_text with an additional if EMAIL_USE_HTML=true && isset(ULTIMATE_HTML_EMAIL_LAYOUT)

 

The problem with 2. is how to translate the html to text with linefeeds, or how a new variable from the modules/UHtmlEmails (with text/plain) can be used in general.php.

 

Again, if you have some suggestions...

 

...maybe a other update soon...

Share this post


Link to post
Share on other sites

[update text/plain has no linefeeds]

 

.. alternative 2.

 

Solution is relative simple without any heavy modifications (as far I can see).

 

Modification IN ADDITION to U HTML v2.1 (2008/08/02):

 

--- step 1 modify admin/includes/functions/general.php AND catalog/includes/functions/general.php ---

Find:

  function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address) {
if (SEND_EMAILS != 'true') return false;

// Instantiate a new mail object
$message = new email(array('X-Mailer: osCommerce'));

// Build the text version
$text = strip_tags($email_text);
if (EMAIL_USE_HTML == 'true') {
  $message->add_html($email_text, $text);

Add after:

//---  Beginning of addition: Ultimate HTML Emails  ---//	  
  global $UHTML_html_text;
  if (tep_not_null($UHTML_html_text) ){
	  $message->html_text = $UHTML_html_text;
  }
//---  End of addition: Ultimate HTML Emails  ---//

--- step 2 add text/plain ---

For the e-mail you want to modify the text/plain go to:

catalog/includes/modules/UHtmlEmails/LAYOUT_NAME/FILENAME.php

At the end of the file, before '?>' insert:

$UHTML_html_text = "This is the text/plain code\nwith linefeeds.\n\nYou can also use the variables used in the $html_email.";

 

That's all...

 

This code is also added to the ADDONS-page.

 

Kind regards, Patrick

Share this post


Link to post
Share on other sites

I am really hoping that someone can help me, because I am absolutely pulling my hair out....

 

I've installed this contribution, but I am missing something.... I'm pretty certain all of the pieces are in place.

 

Here's what happens (for example). I try a password change, I can see in the file "last_mail_from...." that the email is formatted properly and everything looks good - so, I'm guessing that that means that all of my pieces are in place. But, the email never gets shipped off.

 

I did not make any changes to the tep_mail function as none were indicated in the instructions (prior to the most recent patch), so my function looks like this:

 

  function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address) {
if (SEND_EMAILS != 'true') return false;</P> <P>	// Instantiate a new mail object
$message = new email(array('X-Mailer: osCommerce Mailer'));</P> <P>	// Build the text version
$text = strip_tags($email_text);
if (EMAIL_USE_HTML == 'true') {
  $message->add_html($email_text, $text);
} else {
  $message->add_text($text);
}</P> <P>	// Send message
$message->build_message();
$message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject);
 }

 

Through A TON of experiments, I've finally figured out that if tep_mail doesn't "like" what it receives in $email_text, it will not send the email through. For example, just to try and see what would work and what wouldn't, I just played with the vanilla osCommerce forgotten password message:

 

//define('EMAIL_PASSWORD_REMINDER_BODY', 'A new password was requested from ' . $REMOTE_ADDR . '.' . "\n\n" . 'Your new password to \'' . STORE_NAME . '\' is:' . "\n\n" . ' %s' . "\n\n");

 

If I would drop of the trailing /n/n, then no message would be sent. If I would shorten the message to

 

//define('EMAIL_PASSWORD_REMINDER_BODY', 'A new password was request' . "\n\n");

 

it would work, but removing one more character from the word "request", then it would no longer send one off...

 

OK, this was all long-winded, but what I'm trying to show is that tep_mail seems to be a little particular about the actual message contents. So, I'm guessing that since I can see that I do have message contents (because of my last_mail... file), that it just must be tep_mail that is finding some error with the message and therefore not sending it off.

 

Does anyone have any clue at all about where I can look next or have any ideas about something else that I can try?

 

Any help would be GREATLY appreciated!

 

Thanks,

Moez

Share this post


Link to post
Share on other sites

Moez,

I guess you set EMAIL_USE_HTML == 'true'.

 

It seems that email.php and mime.php have some trouble to make/translate the body of your mail.

 

Maybe you did not set the admin -> configuration -> E-Mail Linefeeds to LF (Windows server to: CRLF)?

(this translates the html_text to only "\n" or "\r\n" (therefore the original $email_text must only have code's/tags that strip_tags can strip) )

 

Something else you can try is:

Find:

$message->add_html($email_text, $text);

 

Add after:

var_dump($message);

break;

 

This will display (dump) the whole message the next time you trigger a mail. (do not try this in production... ;) )

Now you can see what is wrong (I hope).

If you see html-coding in the dump ask your browser to diplay the source-code of the page.

 

If this code seems good the email.php function add_html (and find_html_images) works o.k.

 

You can now move the var_dump code just after $message->build_message();

The email.php function build_message is some more complex and triggers the mime.php, but this way you can focus and find the problem.

 

I hope this approach works.

 

P.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×