close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Confirmation email

Thread began 11/19/2012 6:27 am by info364504 | Last modified 11/21/2012 11:43 am by info364504 | 2556 views | 12 replies |

info364504

Confirmation email

hi,
I have created a php script that collects client data and sends an email tothe shop admin when an order is received. All working fine but....how can I include a summary of the items ordered in this email?.

Is ther any way I can email a list of the cart contents?

thanks

Sign in to reply to this post

Jason ByrnesWebAssist

Yes, you can add an email friendly cart display.

Edit the email body, then go to insert -> WebAssist -> eCart -> Display Manager.

from the Display type, select email friendly.

Sign in to reply to this post

info364504

Hi Jason,
thanks for your reply.
I need to make sure I understand this, so this is my script to send the email:

<?
$strTo = $_POST["txtTo"];
$strSubject = stripslashes($_POST["txtSubject"]);
$strMessage = '<font face="tahoma,arial" size=2>'."Hola\n\n" .$_POST["companyname"]. "<br>alguien ha hecho un pedido:<p>Nombre:\n\n".$_POST["nombre"]."<br>Apellidos:\n\n".$_POST["apellidos"]."<br>Direccion:\n\n".$_POST["tipo_via"].$_POST["nombre_via"]."<br>Ciudad:\n\n".$_POST["poblacion"]."<br>C.P.:\n\n".$_POST["cp"]."<br>Provincia:\n\n".$_POST["provincia"]."<br>Telefono:\n\n".$_POST["telefono"]."<br>Movil:\n\n".$_POST["movil"]."<br>Email:\n\n".$_POST["email"]."<br>Importe Total:\n\n".$totalemail."";

$from = stripslashes($_POST['fromname'])."<".stripslashes($_POST['fromemail']).">";
//*** Uniq id Session ***//
$strSid = md5(uniqid(time()));


$strHeader = "";
$strHeader .= "From: $from\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed;\r\n"; // esta línea es muy importante, porque hace que lleguen bien los acentos y que los párrafos tengan separación no muy ancha.
$strHeader .= "Cc: {$_POST['cc']}\r\n";
$strHeader .= "Bcc: {$_POST['bcc']}\r\n";

$strHeader .= "MIME-Version: 1.0\n";
$strHeader .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"\n\n";
$strHeader .= "This is a multi-part message in MIME format.\n";

$strHeader .= "--".$strSid."\n";
$strHeader .= 'Content-Type: text/html; charset=iso-8859-1'.$eol;
$strHeader .= "Content-Transfer-Encoding: 7bit\n\n";
$strHeader .= $strMessage."\n\n";


$flgSend = @mail($strTo,$strSubject,null,$strHeader);

?>

Should I then create an email friendly cart display and add all of the code to my $strMessage = variable?

Sign in to reply to this post

Jason ByrnesWebAssist

yes, that is correct.

Sign in to reply to this post

info364504

Hi again,
I have inserted the cart display code inside my code but get plenty of errors on submit.
I'm sure i'm doing it wrong...

<?
$strTo = $_POST["txtTo"];
$strSubject = stripslashes($_POST["txtSubject"]);
$strMessage = '<font face="tahoma,arial" size=2>'."Hola\n\n" .$_POST["companyname"]. "<br>alguien ha hecho un pedido:<p>Nombre:\n\n".$_POST["nombre"]."<br>Apellidos:\n\n".$_POST["apellidos"]."<br>Direccion:\n\n".$_POST["tipo_via"].$_POST["nombre_via"]."<br>Ciudad:\n\n".$_POST["poblacion"]."<br>C.P.:\n\n".$_POST["cp"]."<br>Provincia:\n\n".$_POST["provincia"]."<br>Telefono:\n\n".$_POST["telefono"]."<br>Movil:\n\n".$_POST["movil"]."<br>Email:\n\n".$_POST["email"]."<br>Importe Total:\n\n".$totalemail."


if (!$enersolmaCart->IsEmpty())
{
<table width="100%" style=" border-right:solid 1px #CAD0CD; /* Neutral_Medium */ border-left:solid 1px #CAD0CD; /* Neutral_Medium */ border-bottom:solid 1px #CAD0CD; /* Neutral_Medium */ margin-bottom:14px;" border="0" cellspacing="0" cellpadding="0">
<tr>
<th style="padding:10px 14px 10px 7px; vertical-align:top; text-align:left; background-color:#578557; /* Accent1 */ color:#FFFFFF; /* Global_White */" text-align:left;>Name</th>
<th style="padding:10px 14px 10px 7px; vertical-align:top; text-align:left; background-color:#578557; /* Accent1 */ color:#FFFFFF; /* Global_White */" text-align:left;>Description</th>
<th style="padding:10px 14px 10px 7px; vertical-align:top; text-align:right; background-color:#578557; /* Accent1 */ color:#FFFFFF; /* Global_White */" text-align:right;>Price</th>
<th style="padding:10px 14px 10px 7px; vertical-align:top; text-align:right; background-color:#578557; /* Accent1 */ color:#FFFFFF; /* Global_White */" text-align:right;>Shipping</th>
<th style="padding:10px 14px 10px 7px; vertical-align:top; text-align:right; background-color:#578557; /* Accent1 */ color:#FFFFFF; /* Global_White */" text-align:right;>IVA</th>
<th style="padding:10px 14px 10px 7px; vertical-align:top; text-align:right; background-color:#578557; /* Accent1 */ color:#FFFFFF; /* Global_White */" text-align:right;>Total</th>
</tr>

while (!$enersolmaCart->EOF()) {

<tr>
<td style="padding:10px 14px 10px 7px; vertical-align:top;" >echo $enersolmaCart->DisplayInfo("Name"); </td>
<td style="padding:10px 14px 10px 7px; vertical-align:top;" >echo $enersolmaCart->DisplayInfo("Description");</td>
<td style="padding:10px 14px 10px 7px; vertical-align:top; text-align:right;" >WA_eCart_DisplayMoney($enersolmaCart, $enersolmaCart->DisplayInfo("Price")); </td>
<td style="padding:10px 14px 10px 7px; vertical-align:top; text-align:right;" >WA_eCart_DisplayMoney($enersolmaCart, $enersolmaCart->DisplayInfo("Shipping")); </td>
<td style="padding:10px 14px 10px 7px; vertical-align:top; text-align:right;" >WA_eCart_DisplayMoney($enersolmaCart, $enersolmaCart->DisplayInfo("IVA")); </td>
<td style="padding:10px 14px 10px 7px; vertical-align:top; text-align:right;" >WA_eCart_DisplayMoney($enersolmaCart, $enersolmaCart->DisplayInfo("TotalPrice"));
</td>
</tr>
<?php
$enersolmaCart->MoveNext();
}
$enersolmaCart->MoveFirst();

</table>
<h3 style="color:#578557; /* Accent1 */ margin:0 0 4px 0; font-size:small;">Order Summary</h3>

<table width="100%" style=" border:solid 1px #CAD0CD; /* Neutral_Medium */ border-top:solid 0px #CAD0CD; /* Neutral_Medium */" border="0" cellpadding="0" cellspacing="0" >

//WA eCart Merchandizing Show Start
//ecart="enersolmaCart"
if ($enersolmaCart->GetDiscounts() > 0 || $enersolmaCart->GetCharges() > 0 || $enersolmaCart->GetShipping() > 0 || $enersolmaCart->GetTax() > 0) {

<tr>
<td style="text-align:left; font-weight:bold; color:#001807; /* Accent4 */ padding: 10px 5px 10px 7px; border-top:solid 1px #CAD0CD; /* Neutral_Medium */" >Sub-total</td>
<td style=" text-align:right; padding: 10px 14px 10px 5px; border-top:solid 1px #CAD0CD; /* Neutral_Medium */">WA_eCart_DisplayMoney($enersolmaCart, $enersolmaCart->TotalColumn("TotalPrice")); </td>
</tr>

//WA eCart Merchandizing Show End
//ecart="enersolmaCart"
}


//WA eCart Merchandizing Show Start
//ecart="enersolmaCart"

if ($enersolmaCart->GetDiscounts() > 0) {


//WA eCart Merchandizing Show End
//ecart="enersolmaCart"
}


//WA eCart Merchandizing Show Start
//ecart="enersolmaCart"
if ($enersolmaCart->GetCharges() > 0) {


//WA eCart Merchandizing Show End
//ecart="enersolmaCart"
}


//WA eCart Merchandizing Show Start
//ecart="enersolmaCart"
if ($enersolmaCart->GetShipping() > 0) {

<tr>
<td style="text-align:left; font-weight:bold; color:#001807; /* Accent4 */ padding: 10px 5px 10px 7px; border-top:solid 1px #CAD0CD; /* Neutral_Medium */">Shipping</td>
<td style="text-align:right; padding: 10px 14px 10px 5px; border-top:solid 1px #CAD0CD; /* Neutral_Medium */">WA_eCart_DisplayMoney($enersolmaCart, $enersolmaCart->GetShipping());</td>
</tr>

//WA eCart Merchandizing Show End
//ecart="enersolmaCart"
}


//WA eCart Merchandizing Show Start
//ecart="enersolmaCart"
if ($enersolmaCart->GetTax() > 0) {

<tr>
<td style="text-align:left; font-weight:bold; color:#001807; /* Accent4 */ padding: 10px 5px 10px 7px; border-top:solid 1px #CAD0CD; /* Neutral_Medium */">Tax</td>
<td style="text-align:right; padding: 10px 14px 10px 5px; border-top:solid 1px #CAD0CD; /* Neutral_Medium */">WA_eCart_DisplayMoney($enersolmaCart, $enersolmaCart->GetTax()); </td>
</tr>

//WA eCart Merchandizing Show End
//ecart="enersolmaCart"
}

<tr style="background-color:#D2E6FF; /* Accent11 */" >
<td style="font-weight:bold; text-align:left; font-weight:bold; color:#001807; /* Accent4 */ padding: 10px 5px 10px 7px; border-top:solid 1px #CAD0CD; /* Neutral_Medium */" >Total:</td>
<td style="font-weight:bold; text-align:right; padding: 10px 14px 10px 5px; border-top:solid 1px #CAD0CD; /* Neutral_Medium */">WA_eCart_DisplayMoney($enersolmaCart, $enersolmaCart->GrandTotal()); </td>
</tr>
</table>
</div>

//WA eCart Show If Middle
}
else {
<table><tr><td>The cart is empty</td></tr></table>

//WA eCart Show If End
}


$from = stripslashes($_POST['fromname'])."<".stripslashes($_POST['fromemail']).">";
//*** Uniq id Session ***//
$strSid = md5(uniqid(time()));


$strHeader = "";
$strHeader .= "From: $from\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed;\r\n"; // esta línea es muy importante, porque hace que lleguen bien los acentos y que los párrafos tengan separación no muy ancha.
$strHeader .= "Cc: {$_POST['cc']}\r\n";
$strHeader .= "Bcc: {$_POST['bcc']}\r\n";

$strHeader .= "MIME-Version: 1.0\n";
$strHeader .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"\n\n";
$strHeader .= "This is a multi-part message in MIME format.\n";

$strHeader .= "--".$strSid."\n";
$strHeader .= 'Content-Type: text/html; charset=iso-8859-1'.$eol;
$strHeader .= "Content-Transfer-Encoding: 7bit\n\n";
$strHeader .= $strMessage."\n\n";

$flgSend = @mail($strTo,$strSubject,null,$strHeader);
?>

Sign in to reply to this post

Jason ByrnesWebAssist

you cant just simply add the cart display code to the page, you need concatenate it to the existing message string. there are some parts of the cart display that are PHP code, and part of the display.

for example:

if (!$enersolmaCart->IsEmpty())
{


so those parts should not be concatenated.


you should terminate the string before the if statement, then continue concatinging the rest of the message.:
$strMessage = '<font face="tahoma,arial" size=2>'."Hola\n\n" .$_POST["companyname"]. "<br>alguien ha hecho un pedido:<p>Nombre:\n\n".$_POST["nombre"]."<br>Apellidos:\n\n".$_POST["apellidos"]."<br>Direccion:\n\n".$_POST["tipo_via"].$_POST["nombre_via"]."<br>Ciudad:\n\n".$_POST["poblacion"]."<br>C.P.:\n\n".$_POST["cp"]."<br>Provincia:\n\n".$_POST["provincia"]."<br>Telefono:\n\n".$_POST["telefono"]."<br>Movil:\n\n".$_POST["movil"]."<br>Email:\n\n".$_POST["email"]."<br>Importe Total:\n\n".$totalemail."';
if (!$enersolmaCart->IsEmpty())
{
$strMessage .= '<table width="100%" style=" border-right:solid 1px #CAD0CD; /* Neutral_Medium */ border-left:solid 1px #CAD0CD; /* Neutral_Medium */ border-bottom:solid 1px #CAD0CD; /* Neutral_Medium */ margin-bottom:14px;" border="0" cellspacing="0" cellpadding="0">
<tr>...';

Sign in to reply to this post

info364504

Jason many than for your help but I can't make this work.
Could you give me a working example of how to email the cart contents?. I don't mean you revising my code but perhaps you could show me one you have made before?
thanks

Sign in to reply to this post

Jason ByrnesWebAssist

if you use Universal Email with eCart in the checkout wizard, you c an generate an example of how the email body would be created. attached is an Include file generated by Universal Email that generates the mail body.

Attached Files
waue_em_confirm_1.php.zip
Sign in to reply to this post

info364504

Thanks jason,
i don't have UE and i see you don't sell it anymore?

Sign in to reply to this post

Jason ByrnesWebAssist

it is now a part of Data Bridge.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...