Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[contribution] Send_order_html_email


Elazar

Recommended Posts

Hi, how does one remove the extra line breaks showing up in the email? For example, in my define for define('EMAIL_MESSAGE_GREETING', it's adding in extra <br> after each line. It's also doing it in code I didnt touch - i.e. the billing and shipping addresses. Thanks for the help, I'm sure its something easy - that I'm just not aware of.

 

Hi, please let me know which file you changed to remove the line breaks. I've tried taking at /n many places in checkout_process.php without success.

 

Allan.

Link to comment
Share on other sites

  • Replies 344
  • Created
  • Last Reply

Top Posters In This Topic

I just installed this contribution and it is working great! It's saved me many hours and headaches of trying to get this other HTML email contribution to work.

 

In the account creation confirmation mail, I would like to include the customer's login and password. How would this be done? Thanks for your help!

Link to comment
Share on other sites

Hi, please let me know which file you changed to remove the line breaks. I've tried taking at /n many places in checkout_process.php without success.

 

Allan.

From memory, some of it comes from the language files and some from the templates.

Link to comment
Share on other sites

I got a little problem with the layout of the email. unfortunately I can't send a picture on this forum. Let me explain

 

I got an email with 4 columns. In every column there is info about the product. The products itself stands in a row. But when I got 2 or more products in one column every information is in one box! instead of different rows. It's about the manufacturers.

 

I change a little this is how it works fine:

 

$products_ordered_attributes ."\n");		
if (!tep_not_null($order->products[$i]['model'])) {       
$products_model .= ''.EMAIL_NO_MODEL.'' ;         }    else       
$products_model .= nl2br($order->products[$i]['weight'] . "\n");
$orders_picture_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . (int)
$order->products[$i]['id'] . "'"); $orders_picture=tep_db_fetch_array($orders_picture_query); 

 

But I want the manufactures also in a column, change something and it works. Only not in every row! All the information was showing in 1 row, intstead of a table, with different rows.

 

$products_ordered_attributes ."\n");		
if (!tep_not_null($order->products[$i]['model'])) {       
$products_model .= ''.EMAIL_NO_MODEL.'' ;         }    else       
$manufacturers_name .= nl2br(tep_not_null(tep_get_manufacturer_name($order->products[$i]['id'])) ? tep_get_manufacturer_name($order->products[$i]['id']) . '' : '');
$orders_picture_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . (int)
$order->products[$i]['id'] . "'"); $orders_picture=tep_db_fetch_array($orders_picture_query); 

 

What code makes this information of the manufacturers like a table instead of all information in one row?

 

I hope you understand me :huh:

Link to comment
Share on other sites

Ok. Maybe it's better to make something different:

 

 

What I got in the email html:

 

color.....aantal.......... Totaal

grijs............1................0.32 euro

..................1................0.19 euro

wit .............2................0.44 euro

................................................

blauw

 

The problem is the color, table is not right.

 

What I got:

 

$manufacturers_name .= nl2br(tep_not_null(tep_get_manufacturer_name($order->products[$i]['id'])) ? tep_get_manufacturer_name($order->products[$i]['id']) . '' : ''). "\n";

 

 

What did I do wrong?

Edited by Simpel
Link to comment
Share on other sites

I am having this same problem it's all white how do I add some color?

 

Try this:

 

$html_email_order .= " <td><table width=\"600\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=#f9f9f9>";

 

in the

 

html_checkout_process.php file

Link to comment
Share on other sites

Ok I got the next problem.

 

When I order 4 products and get the email.

 

The email shows all 4 products with there information in 1 Row! instead of each product his own row.

 

//BEGIN SEND HTML MAIL//

//manware.nl altered manufacturer name to order (email)
$products_ordered .= $order->products[$i]['qty'] . ' x ' . tep_get_manufacturer_name($order->products[$i]['id']) . ' - ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";  
$products_quantity .= nl2br($order->products[$i]['qty'] . "\n");	
$products_name .= nl2br("" . $order->products[$i]['name'] . $products_ordered_attributes ."\n");	
	 $orders_picture_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . (int)
$order->products[$i]['id'] . "'"); $orders_picture=tep_db_fetch_array($orders_picture_query);  

if (!tep_not_null($order->products[$i]['model'])) {
      $products_model .= ''.EMAIL_NO_MODEL.'' ;
        }
   else{
      $products_model .= nl2br($order->products[$i]['model'] . "\n");
       }; 

$orderarray[$i] = array( "Image" => "<img src=".DIR_EXT_HTTP . $orders_picture['products_image']." width='90px' border='0'>",
              "Model" => nl2br("" . $order->products[$i]['name'] . $products_ordered_attributes . "\n" ),
				     "Modelnr" => nl2br($order->products[$i]['name'] . "\n"),
						 "Color" => nl2br(($order->products[$i]['id']) ? tep_get_manufacturer_name($order->products[$i]['id']) . '' : ''). "\n",
						 "Qty" => nl2br($order->products[$i]['qty'] . "\n"),
						 "Price" => nl2br($currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty'])  . "\n"));}




for ($i=0; $i<sizeof($order_totals); $i++) {
   $Vartaxe .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }

 

and here the html_checkout_process code

 

$html_email_order .= "          	<td align=\"center\" width=\"40\" bgcolor=#CDC0B0>$VarQte</td>";
$html_email_order .= "          	<td align=\"right\" width=\"80\" bgcolor=#CDC0B0>$VarTotal</td>";
$html_email_order .= "        	</tr>";
$html_email_order .= "        	<tr> ";
$m=0;
foreach ($orderarray as $Orderpos){
$products_images = $Orderpos['Image'];
$products_name = $Orderpos['Modelnr'];
$manufacturers_name = $Orderpos['Color'];
$products_quantity = $Orderpos['Qty'];
$products_price = $Orderpos['Price'];
$html_email_order .= "          	<td width=\"80\" valign=\"top\" align=\"center\" class=\"boxmailgris\">$products_images</td>";
$html_email_order .= "          	<td width=\"260\" valign=\"top\" align=\"left\" class=\"boxmailgris\">$products_name</td>";
$html_email_order .= "          	<td width=\"140\" valign=\"top\" align=\"left\" class=\"boxmailgris\">$manufacturers_name</td>";
$html_email_order .= "          	<td width=\"40\"  valign=\"top\" align=\"center\" class=\"boxmailgris\">$products_quantity</td>";
$html_email_order .= "          	<td width=\"80\" valign=\"top\" align=\"right\" class=\"boxmailgris\">$products_price</td>";
$m = $m+1;
if ($m == 2)$m=0;
};
$html_email_order .= "        	</tr>";	
$html_email_order .= "        	<tr height=\"14\"> ";
$html_email_order .= "          	<td height=\"14\" width=\"300\" valign=\"top\" align=\"left\" class=\"tableur\">$Vardetail</td>";
$html_email_order .= "          	<td colspan=\"4\" width=\"300\" valign=\"top\" align=\"right\" class=\"tableur\">$Vartaxe</td>";
$html_email_order .= "        	</tr>";

 

How can I get the products in the email beneath each other?

Link to comment
Share on other sites

Ok. Maybe it's better to make something different:

What I got in the email html:

 

color.....aantal.......... Totaal

grijs............1................0.32 euro

..................1................0.19 euro

wit .............2................0.44 euro

................................................

blauw

 

The problem is the color, table is not right.

 

What I got:

 

$manufacturers_name .= nl2br(tep_not_null(tep_get_manufacturer_name($order->products[$i]['id'])) ? tep_get_manufacturer_name($order->products[$i]['id']) . '' : ''). "\n";

What did I do wrong?

 

 

I changed this to

$products_model .= nl2br($manufacturer_name = tep_get_manufacturer_name($order->products[$i]['id']) . "\n");

 

And now are these 3 colomns the same. The only problem I got is that the picture colomn is stand alone. The pictures seems bigger then the row. So the picture column will be longer when I got more products in the order. Where can I change the high of the row in px ?

Link to comment
Share on other sites

foreach ($orderarray as $Orderpos){

$products_images = $Orderpos['Image'];

$products_name = $Orderpos['Modelnr'];

$manufacturers_name = $Orderpos['Color'];

$products_quantity = $Orderpos['Qty'];

$products_price = $Orderpos['Price'];

$html_email_order .= " <td width=\"80\" valign=\"top\" align=\"center\" class=\"boxmailgris\">$products_images</td>";

$html_email_order .= " <td width=\"260\" valign=\"top\" align=\"left\" class=\"boxmailgris\">$products_name</td>";

$html_email_order .= " <td width=\"140\" valign=\"top\" align=\"left\" class=\"boxmailgris\">$manufacturers_name</td>";

$html_email_order .= " <td width=\"40\" valign=\"top\" align=\"center\" class=\"boxmailgris\">$products_quantity</td>";

$html_email_order .= " <td width=\"80\" valign=\"top\" align=\"right\" class=\"boxmailgris\">$products_price</td></tr>";

$m = $m+1;

if ($m == 2)$m=0;

 

 

missed this!

Link to comment
Share on other sites

you are using nl2br before and have added one \n behind every line. this results in one <br> ;)

 

similar problem. i do have 2 <br> between products name and products_attributes like this

 

 

USL 50 Endkappe Rechts (23 Dekore) <----- Products name

<br>

<br>

Dekor kiefer <----- Products attribute

 

 

but i want it like this instead

 

USL 50 Endkappe Rechts (23 Dekore)

Dekor kiefer

 

 

what code do i have to remove? I've tried several code changes but none of them worked.

Link to comment
Share on other sites

similar problem. i do have 2 <br> between products name and products_attributes like this

USL 50 Endkappe Rechts (23 Dekore) <----- Products name

<br>

<br>

Dekor kiefer <----- Products attribute

but i want it like this instead

 

USL 50 Endkappe Rechts (23 Dekore)

Dekor kiefer

what code do i have to remove? I've tried several code changes but none of them worked.

You remove one of the <br>

Link to comment
Share on other sites

You remove one of the <br>

but where? please tell me what file and what line does have that code. my problem is i did not found that code.

 

to make it clear: i don't know if the code is <br> or \n in the source file. The email source code shows <br> but as both <br> and \n would create a <br> in the arrived email i'm not sure which of both to look for.

 

anyway, i assume i have to change something in catalog/checkout_process.php within this code

 

	$orderarray[$i] = array( "Model" => nl2br("" . $order->products[$i]['name'] . $products_ordered_attributes . "\n" ),
						 "Modelnr"=> nl2br($order->products[$i]['model'] . "\n"),
						 "Qty" => nl2br($order->products[$i]['qty'] . "\n"),
						 "Price" => nl2br($currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty'])  . "\n"));

 

but as between $order->products[$i]['name'] and $products_ordered_attributes there is no <br> or \n i don't know why the mail has three <br> between them.

Link to comment
Share on other sites

Modelnr"=> nl2br($order->products[$i]['model'] . "\n"), where nl2br=<br><br> and \n=<br>

 

 

i've changed

 

$orderarray[$i] = array( "Model" => nl2br("" . $order->products[$i]['name'] . $products_ordered_attributes . "\n" ),

into

$orderarray[$i] = array( "Model" => ("" . $order->products[$i]['name'] . $products_ordered_attributes . "\n" ),

 

so now there is only one space line between them. not perfect but better than before. thanks for your help.

Link to comment
Share on other sites

i've changed

 

$orderarray[$i] = array( "Model" => nl2br("" . $order->products[$i]['name'] . $products_ordered_attributes . "\n" ),

into

$orderarray[$i] = array( "Model" => ("" . $order->products[$i]['name'] . $products_ordered_attributes . "\n" ),

 

so now there is only one space line between them. not perfect but better than before. thanks for your help.

So if you want the same elsewhere, do the same. If you want no line fed, remove the ."\n"

Link to comment
Share on other sites

  • 2 weeks later...

hi there,

 

Firstly I'd like to say that this is a great contribution, and I would like to thank all the authors involved.

 

I am having trouble getting the product image to display in the email. I just get the empty image holder marked with the "X".

 

I looked at the link for the image, and its just coming up as http://www.mystore.com/images/

 

The problem is that I am using an additional images contribution too, and the images are placed in separate manufacturer folders. For example if i create a t-shirt product called "black t-shir"t, and its manufacturer is "Armani", the path to the images will be:

 

catalog/images/products/armani/tshirts/black_small.jpg

catalog/images/products/armani/tshirts/black_medium.jpg

catalog/images/products/armani/tshirts/black_large.jpg

 

Will this affect the image in the email? I'm pretty sure it will, but I don't know how to fix this. Can anyone help?

 

kind regards

Jonathan

Link to comment
Share on other sites

i have found it in this topic :)

 

But do you know where is the text instrcutions for the payement by CHECK ?

 

thanks

probably in the payment modules language area.

Link to comment
Share on other sites

beause normaly the instructions are on 3 line, and now they are on only 1 line. Where can i add \n or <br> ?

 

Thanks

In the same place, use <br> for one carriage return. <br><br> for two carriage returns.

Link to comment
Share on other sites

yes but i don't find where i can add them, because i don't find the intructions text for the payement by check (Mail In Payment).

 

Do you know that ? It isn't in the language module for the check, because it is not a module.

 

thanks

Edited by ataga
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...