Email template error

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
meer2005
Captain (CAPT)
Captain (CAPT)
Posts: 245
Joined: Wed Feb 09, 2005 2:00 pm

Email template error

Post by meer2005 » Tue Dec 22, 2009 5:57 pm

Keep getting this when sending order shipped email:

Error generating email messages for template 'Order Shipped' having subject 'Your order has shipped from $store.Name'.

Debug data: Foreach directives must be the only items on the line (comments or contents are not allowed); Foreach directives must be the only items on the line (comments or contents are not allowed)



Here is the code from the template:

Code: Select all

<html>
<head>
<style type="text/css">
TABLE.Email {
width: 640px;
padding: 5px;
margin: 0px;
border: 1px solid #5872CB;
}
TABLE.Email TH {
font-weight: bold;
font-size: 12px;
color: #ffffff;
font-family: Arial, Verdana, Sans-Serif;
font-style: strong;
background-color: #800000;
text-align: center;
text-decoration: none;
padding: 5px;
}
TABLE.Email TD {
font-weight: normal;
font-size: 12px;
color: #000000;
font-family: Arial, Verdana, Sans-Serif;
background-color: #ffffff;
text-align: left;
text-decoration: none;
padding: 3px;
}
</style>
</head>
<body>
<table class="Email">
 <tr>
    <td class="head">&nbsp;</td>
    <td class="head" style="text-align:right; color:#CCCCCC; font-size: 1.5em;">Order Shipped  </td>
  </tr>
<tr>
<td colspan="2" class="Email">
<p><strong>Hello $order.BillToFirstName, </strong></p>
<p>        We thought you'd like to know that we shipped your items, and that
this 
completes your order.</p>
<p><a href="http://www.store.com/orderstatus.htm">Click here to view the final detais of your shipment(s) here.</a></p>      
<p>Thank you for shopping with us.<br>
$store.Name</p>

</tr>
</table>
<table class="Email">
<tr>
<th class="Email">Order Summary</th>
</tr>
</table>
<table class="Email">
<tr>
<td class="Email"><div align="right"><strong>Email Address:</strong></div></td>
<td class="Email">${order.BillToEmail}</td>
</tr>
<tr>
<td class="Email" width="140"><div align="right"><strong>Order Number:</strong> </div></td>
<td class="Email" width="500"><p>$order.OrderId</p></td>
</tr>
<tr>
<td class="Email"><div align="right"><strong>Ordered on:</strong></div></td>
<td class="Email">$order.OrderDate.ToString("G")</td>
</tr>
<tr>
<td class="Email"><div align="right"><strong>Ordered by:</strong></div></td>
<td class="Email">$order.BillToFirstName $order.BillToLastName</td>
</tr>
<tr>
<td><div align="right"><strong>Order Total:</strong></div></td>
<td>$order.Items.TotalPriceById().ToString("ulc")</td>
</tr>
<tr>
<td class="Email"><div align="right"><strong>Order Details:</strong></div></td>
<td class="Email"><a href="http://www.store.com/orderstatus.htm">View Online</a></td>
</tr>
</table>
<table class="Email">
<tr valign="top">
<td class="Email" width="50%"><strong>Billing Address:</strong>
<div style="padding-left:30px;">
$order.FormatAddress(true)
</div>
</td>
<td class="Email" width="50%">
<strong>Payment Method:</strong>
<div style="padding-left:30px;">
#foreach($payment in $payments)
$payment.PaymentMethodName<br />
$payment.ReferenceNumber<br />
#end
</div>
</td>
</tr>
</table>  
#set ($shipNo = 1)   
#foreach($shipment in $order.Shipments)
#beforeall
<table class="Email">
<tr>
<th class="Email">Shipment Information</th>
</tr>
</table>
#each
<table class="Email">
<tr>
<td class="Email" style="text-align: center;">                     
<strong><u>Shipment $shipNo of $order.Shipments.Count</u></strong>
#set ($shipNo = $shipNo + 1)</td>
</tr>
<tr>
<td class="Email" style="text-align: center;">
<table width="100%">
<tr>
<td class="Email" valign="top">
<strong>Ship From:</strong>
<div style="padding-left:30px;">store.com</div></td>
<td class="Email" valign="top">
<strong>Ship To:</strong>
<div style="padding-left:30px;">
$shipment.FormatToAddress(true)
#if ($shipment.ShipMessage.Length > 0)
<br/><strong>Message:</strong>$shipment.ShipMessage
#end</div></td>
<td class="Email" valign="top">
<strong>Shipment Method:</strong>
<div style="padding-left:30px;">
$shipment.ShipMethodName</div>
<strong>Shipment Status:</strong>
<div style="padding-left:30px;">
#if ($shipment.IsShipped)
Shipped
#else
Waiting to ship
#end</div>

<strong>Tracking Information:</strong>
<div style="padding-left:30px;">

#foreach($trackingNumber in $shipment.TrackingNumbers)

#if($trackingNumber.ShipGateway)

#set($provider = $trackingNumber.ShipGateway.GetProviderInstance())

#set($summary = $provider.GetTrackingSummary($trackingNumber))

#if($summary.TrackingResultType == "ExternalLink")
<a href='$summary.TrackingLink'>$trackingNumber.TrackingNumberData</a>
#end

#end
#end</div></td>
</tr>
</table></td>
</tr>
#foreach($orderItem in $order.Items.FilterByShipmentAndSort($shipment.OrderShipmentId))
#beforeall #each
#if (($orderItem.OrderItemType == "Product") || ($orderItem.OrderItemType == "Discount") || ($orderItem.OrderItemType == "GiftWrap") )
 #end
#end
<tr class="Email"><td>&nbsp;</td>
</tr>
</table>      
#end 
<p>&nbsp;</p>
</body>
</html>
Last edited by meer2005 on Thu Apr 23, 2015 5:22 am, edited 1 time in total.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Email template error

Post by mazhar » Wed Dec 23, 2009 10:50 am

What was the last change made to template you expect to cause this problem?

meer2005
Captain (CAPT)
Captain (CAPT)
Posts: 245
Joined: Wed Feb 09, 2005 2:00 pm

Re: Email template error

Post by meer2005 » Wed Dec 23, 2009 12:15 pm

I don't recall making any changes besides adding tracking information, but that was 6 mo. ago, and it worked after that.

Post Reply