Jump to content
Sign in to follow this  
killer-g

Email Templates

Recommended Posts

i found the email templates contrib " 26 Jan 2005 - Email Templates" by idabagusmade.

you can choose in your orders area custom templates to send to customers.

 

The Problem it adresses:

you alway have to send out confirmation emails with the same stuff in it. now you can predefine your emails for your different sales-stages. one click and you have the propper email send out f.ex. "please pay"

 

the problem with this contrib is that it had only 5 variables/placeholders which are put in the text and are substituted at send time f.ex. [CUSTOMER_NAME]

 

for me this was not enough because i wanted to send out the details of the order (sum/products/payment method...) without having to fill it manually in the orders email comments field in adminarea.

 

bevor i?m going to add this i want to discuss it here, since i?m not a super coder and want to KEEP THE CONTRIB Area CLEAN! the author does not seem to have opened a thread, so i?m doing it here.

 

so if anybody is interested in this please post here or mail to vespaschorsch at gmx dot de

Share this post


Link to post
Share on other sites

I agree, There should be more like STORE_NAME, STORE_ADDRESS, STORE_URL, or what ever you need to make up.

 

I guess that we can search the 2 included files for [CUSTOMER_NAME] or CUSTOMER_NAME

 

I will see what I can find and post it here unless the author finds this and posts the answer.


L8r,

PopTheTop

 

Published osC Contributions:

- eCheck Payment Module v3.1

- Reviews in Product Display v2.0

- Fancier Invoice & Packingslip v6.1

- Admin Notes / Customer Notes v2.2

- Customer Zip & State Validation v2.2

- Search Box with Dropdown Category Menu v1.0

 

Pop your camper's top today!

It's a popup thing...

You wouldn't understand

Share this post


Link to post
Share on other sites

I did seem to find something that needs work though...

 

If the customer has HTML e-mails turned off in their e-mail program or if the customer is unable to receive HTML e-mails, everything in your template is posted/sent on one line with no line breaks.

 

I guess that there should be some kind of code that will strip <BR> tags to \n and <P> tags to \n\n or something. Anyone know how to fix this?


L8r,

PopTheTop

 

Published osC Contributions:

- eCheck Payment Module v3.1

- Reviews in Product Display v2.0

- Fancier Invoice & Packingslip v6.1

- Admin Notes / Customer Notes v2.2

- Customer Zip & State Validation v2.2

- Search Box with Dropdown Category Menu v1.0

 

Pop your camper's top today!

It's a popup thing...

You wouldn't understand

Share this post


Link to post
Share on other sites

I like the idea of this contrib as I would like to send custom emails when the order status changes.

 

I have installed it but can't seem to get the template into the comments box!

 

Any ideas?

 

 

 

I did seem to find something that needs work though...

 

If the customer has HTML e-mails turned off in their e-mail program or if the customer is unable to receive HTML e-mails, everything in your template is posted/sent on one line with no line breaks.

 

I guess that there should be some kind of code that will strip <BR> tags to \n and <P> tags to \n\n or something. Anyone know how to fix this?

Share this post


Link to post
Share on other sites
I have installed it but can't seem to get the template into the comments box!

there was a little code problem in this contrib, i wrote the author but maybe he has not changed it yet in

here is what he wrote me:

 

Hi George,

Thank for the correction. You are right, the instruction should says:

 

#FIND

 

              $notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE,

$comments) . "\n\n";

 

#ADD (after)

 

      require(DIR_WS_FUNCTIONS . 'email_templates.php');

      $comments = tep_email_templates_replace_keywords($comments,

$check_status['customers_email_address'], '');

 

not #ADD (before).

 

Hope this helps. I?m just implementing my enhanced version again and if i find the time i?ll post it here or in the contrib area. If somebody is interested you can also send me an email.

Share this post


Link to post
Share on other sites

Thanks for the comments.

I have made the changes you state and get the following error

Line:392
Char:6
Error: 'Undefined' is null or not an oblect
Code:0

this is my line 392

if ($orders_history['customer_notified'] == '1') {

 

You say you have a similar contrib, I am after a way of sending out a more detailed email to customers when the order status changed. Would this be able to do this.

 

there was a little code problem in this contrib, i wrote the author but maybe he has not changed it yet in

here is what he wrote me:

Hope this helps. I?m just  implementing my enhanced version again and if i find the time i?ll post it here or in the contrib area. If somebody is interested you can also send me an email.

Share this post


Link to post
Share on other sites

i sat on it last night and i had my and your problem again ... now i was wondering how i solved it the first time. since it was very late i might have missed something. i also made the contrib show the new status set in backoffice in the header of the email.

i?m kinda busy right now because german is playing in the confed cup and my friends are waiting for my projektor and i?m off the pc till sunday from tomorrow on.

 

i hope i?ll find out more about the troubles.

 

cu george

Share this post


Link to post
Share on other sites

Hi,

 

I?m trynig to install this contribution, but having a problem with the WYSIWYG feature. I don?t have it installed and I?m to get rid of the WYSIWYG conifguration in functions/email_templates.php.

 

Does anyone have this file without WYSIWYG?

 

Thank?s for the contrib!

 

 

Claudio

Share this post


Link to post
Share on other sites
Hi,

 

I?m trynig to install this contribution, but having a problem with the WYSIWYG feature. I don?t have it installed and I?m to get rid of the WYSIWYG conifguration in functions/email_templates.php.

 

Does anyone have this file without WYSIWYG?

 

Thank?s for the contrib!

Claudio

 

 

I could be wrong here, but I thought that the whole point of this contribution was to use the WYSIWYG. I suggest installing it.


L8r,

PopTheTop

 

Published osC Contributions:

- eCheck Payment Module v3.1

- Reviews in Product Display v2.0

- Fancier Invoice & Packingslip v6.1

- Admin Notes / Customer Notes v2.2

- Customer Zip & State Validation v2.2

- Search Box with Dropdown Category Menu v1.0

 

Pop your camper's top today!

It's a popup thing...

You wouldn't understand

Share this post


Link to post
Share on other sites
I could be wrong here, but I thought that the whole point of this contribution was to use the WYSIWYG. I suggest installing it.

 

You?re right about it. But I chose to use the HTMLArea 3.0 instead of the WYSIWYG from MaxiDVD, because I was having trouble about white spaces and line breaks. I don?t know if it happens to all, but every time I had to rewrite any text using the MaxiDVD contribution, I got line spaces coming out of nowhere.

 

Anyway, I managed to have the text pasted in the message textarea when the editor is turned to text mode. Yet a little tricky for the user, but I?ll give it a try later.

 

If you have interest in the HTMLArea thing, I?m managing to have it full loaded with features for all text areas in the admin - exactly your point, it should be easy to write any text in the osC admin. Send me a pm and I?ll have my work so far emailed to you.

 

thanks

 

Claudio

Share this post


Link to post
Share on other sites

SORRY,BUT my english is soo bad !!!!!! rsrsrsr

 

Who i can send email?s too my custmers using this contribuition ??????

 

i only have two options:

 

Add Email Template

List Email Template

 

how to select a customer so that I can send the email?

screenshoot:

scr1.gif

 

 

Tanks!!!!!!!!!!!!!!!!


I did, helped or traslate.

http://addons.oscommerce.com/profile/104964

 

My english it´s só poor, but of you need help in portuguese, like shipping and payment that´s make a diference in brazil, come one,

Obrigado (thank´s)

 

Share this post


Link to post
Share on other sites

Hello,

please if my English excuses, with Google one translated.

 

I would like to work on gladly with the WYSIWYG editor the orders. Email Templates is installed, but the normal text field interprets no HTML, thought that it possibly functioned if the HTML editor into orders.php is built. Property however problems thereby, does not get the editor indicated, however with selection of a Templates passes anything, the text is not taken over.

 

Did someone already convert an idea or a that?

 

Greeting from Germany?.

Share this post


Link to post
Share on other sites

I'm using TinyMCE instead of HTMLarea of FKeditor (i prefer tinyMCE, it is an outstanding editor IMHO), however I can't get the template to load in the editor. Any Ideas?

Share this post


Link to post
Share on other sites

Hi everybody,

 

I have a problem with saving email templates. When I create a new template and hit Save, nothing happens. The template isn't saved to the db. Any help would be appreciated.

 

Thanks in advance.

Share this post


Link to post
Share on other sites

Hi,

 

I have installed this contribution successfully but am now stumped on how I actually implement one of the templates and test to see how they look. Is this something to do with 'Group' that each template belongs to? It would be great if this contribution had a bit of a user guide to go with it. Can you shed any light on how I do this?

 

thanks in advance.

Share this post


Link to post
Share on other sites
I'm using TinyMCE instead of HTMLarea of FKeditor (i prefer tinyMCE, it is an outstanding editor IMHO), however I can't get the template to load in the editor. Any Ideas?

Yeah i also would like to know how to do that..

 

Somebody knows?

Share this post


Link to post
Share on other sites

Hi, duz somebody having problems with this contri in combination with the HTML WYSIWYG Editor.

when i create a newsletter/email and i preview it everything show up correctly. but when i send the mail to my email, then there are a lot of unwanted spaces.

 

i found that this code was screwing the whole thing up

 

	require(DIR_WS_FUNCTIONS . 'email_templates.php');
tep_get_email_from($from, $from_email_name, $from_email_address);
while ($mail = tep_db_fetch_array($mail_query)) {
$email_text = tep_email_templates_replace_keywords($message, $mail['customers_email_address'], '');
tep_mail($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], $subject, $email_text, $from_email_name, $from_email_address);
}

If i remove the code the mails arrives correctly, but due this [CUSTOMER_NAME] will not transform to the customers name, i can live without that but it would be nice if it worked.

 

Somebody know more about it?

Share this post


Link to post
Share on other sites
Hello,

please if my English excuses, with Google one translated.

 

I would like to work on gladly with the WYSIWYG editor the orders. Email Templates is installed, but the normal text field interprets no HTML, thought that it possibly functioned if the HTML editor into orders.php is built. Property however problems thereby, does not get the editor indicated, however with selection of a Templates passes anything, the text is not taken over.

 

Did someone already convert an idea or a that?

 

Greeting from Germany�.

I also would like 2 know how to do that, otherwise the template has not much effect in order.php

 

I'm busy trying to get the HTML WYSIWYG Editor to appear in the commentscreen but till now nothing works.

 

Any Suggetions?

Share this post


Link to post
Share on other sites

has anyone managed to get this working with TinyMCE?

 

Ive had several goes at it and it just refuses to load it

 

the offending code i suspect is related to the java that loads the comments templates:

 

					<script language=\"JavaScript\">\n
				function stripTags(oldString) {\n
					return oldString.replace(/(<([^>]+)>)/ig,'');\n
				}\n

				function change_email_template(id){\n
					var txtObjContents = document.{$form_name}.{$form_message_field_name};\n 
				";
	if(tep_not_null($form_subject_field_name)){			
		$out .= "var txtObjSubject  = document.{$form_name}.{$form_subject_field_name};\n 
						 txtObjSubject.value = eval('document.{$form_name}.subject_' + id + '.value');\n
				";
	}			
	if (HTML_AREA_WYSIWYG_DISABLE_EMAIL == 'Enable'){
		if(strstr($HTTP_USER_AGENT,"MSIE") && basename($PHP_SELF) == 'mail.php') {			
			$out .= "editor_setHTML('{$form_message_field_name}', eval('document.{$form_name}.contents_' + id + '.value'));\n";
		}else{
			$out .= "txtObjContents.value = stripTags(eval('document.{$form_name}.contents_' + id + '.value'));\n";
		}
	}else{
		$out .= "txtObjContents.value = stripTags(eval('document.{$form_name}.contents_' + id + '.value'));\n";
	}	

	$out .= "	
				}\n
				</script>\n\n";

 

i have tried removing the (HTML_AREA_WYSIWYG_DISABLE_EMAIL == 'Enable') if statement but it appears that the $out value is not correct to work with TinyMCE

 

anyone have any ideas?

Share this post


Link to post
Share on other sites

Hi together,

 

I know, the thread here is a little bit old, but perhaps things have improved...

 

I implemented this great contrib without any problems, it is working fine with HTMLarea editor in both mail.php and orders.php.

 

What I liked very much, is, that the template text is pasted into the appropriate field and you can edit it afterwards.

 

First problem:

Now, for nicer editing, I want to switch to FCKeditor, which is already working fine on my product descriptions.

 

But on my orders.php, the template text will not get pasted into the comment field :angry:

 

Second problem:

Is it possible to define more variables?

For example, I am in need of "customer_gender" (Sir, Madam or Mr./Mrs.), "customer_lastname", "customer_delivery_address" (Name and complete address).

I found the code in /admin/includes/functions/email_templates.php with the function "tep_email_templates_replace_keywords" beginning with line 92.

Is it possible just to add some new lines here ?

 

Thanks in advance for any input on both issues.

Regards

Andreas

Edited by Andreas2003

Share this post


Link to post
Share on other sites

Alright, for my second problem, I have partly a solution:

It is possilbe, to just add some lines into the function.

For the lastname I added:

$out = str_replace('[CUSTOMER_LASTNAME]', $customers['customers_lastname'], $out);

 

For the gender, I get "f" or "m" as result of:

$out = str_replace('[CUSTOMER_GENDER]', $customers['customers_gender'], $out);

Now I have to replace the result somehow (??) with Mr. or Mrs. for a nicer address like "Dear Mr. Doe".

Can anyone guide me a little bit, how to do that?

 

My worst problem with this part is the shipping address.

I have no idea on how to get this into the $out-var, because the shipping address is stored in an array.

In the orders.php, the shipping address have the output here:

<?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'); ?>

But I don't know, if all necessary information is included in the email_templates.php.

Just comparing it to the customers_id wouldn't be enough, because the customer can change the shipping address depending on the order.

 

Any help appreciated.

Edited by Andreas2003

Share this post


Link to post
Share on other sites

No ideas?

Neither on the FCK editor integration nor the extension of variables I was able to make progress - unfortunately.

 

Hope, that I'm not the only one, who has to work during summer time :-)

Share this post


Link to post
Share on other sites
Alright, for my second problem, I have partly a solution:

It is possilbe, to just add some lines into the function.

For the lastname I added:

			if ($customers['customers_gender'] == 'f'){
     $customers['customers_gender'] = 'Dear Ms. ';
		$out = str_replace('[CUSTOMER_GENDER]', $customers['customers_gender'], $out);
       }else{
     $customers['customers_gender'] = 'Dear Mr. ';
		$out = str_replace('[CUSTOMER_GENDER]', $customers['customers_gender'], $out);
       }

 

Try this and report back, if all went well.

 

Regards!

 

Oke

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
Sign in to follow this  

×