Adding split shipping to order submission email template - xmpie-users/uStore-js GitHub Wiki
Updated Message Template id 5 Includes a table with each item and where its being shipped that is underneath the normal order products list.
This is the new part for XSLT
<xsl:for-each select="//Sqls/ShippingTable/Row">
<tr>
<td style="width=20%;">
<xsl:value-of select="Ship_Name"/>
<br/>
<xsl:value-of select="Ship_AddressReference"/>
<br/>
<xsl:value-of select="Ship_Add1"/> <xsl:value-of select="Ship_Add2"/>
<br/>
<xsl:value-of select="Ship_City"/>,  <xsl:value-of select="Ship_State_Name"/> <xsl:value-of select="Ship_Zip"/>
<br/>
<xsl:value-of select="Ship_Country_Name"/>
</td>
<td style="width=10%; text-align: center; vertical-align: middle;">
<xsl:value-of select="Method"/>: <xsl:value-of select="Service"/>
</td>
<td style="width=20%; text-align: center; vertical-align: middle;">
<xsl:value-of select="ProductName"/>
</td>
<td style="width=10%; text-align: center; vertical-align: middle;">
<xsl:value-of select="QuantityPerRecipient"/>
</td>
</tr>
</xsl:for-each>
Updated XSLT
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html"/>
<xsl:variable name="DownloadableCount"
select="count(//Sqls/OrderProductList/Row[DownloadOutput!=''])"/>
<xsl:variable name="FormatPattern"
select="//Sqls/Order/Row/FormatPattern"/>
<xsl:decimal-format name="DecimalFormat"
decimal-separator=","
grouping-separator="."/>
<xsl:template match="/">Dear<xsl:value-of select="//Sqls/CustomerName/Row/FirstName"/>
<xsl:value-of select="//Sqls/CustomerName/Row/LastName"/>,<br/>
<br/>Thank you for your order.<br/>
<br/>Your order number is:<xsl:value-of select="//Sqls/Order/Row/EncryptedOrderId"/>.<br/>
<br/>The product(s) you ordered are:<br/>
<table width="80%"
border="1"
cellpadding="4"
cellspacing="2"
style="border-collapse:collapse">
<tr style="background-color:#eeeeee;">
<td>Item #</td>
<td>Product Name</td>
<td>Quantity</td>
<xsl:if test="//Sqls/Permission/Row/IsPriceAllowed = 'True'">
<td>Total Price</td>
</xsl:if>
<xsl:if test="//OrderDetailsUrl and $DownloadableCount>0">
<td/>
</xsl:if>
<xsl:if test="//Sqls/OrderProductList/Row/IsPack = 'True'">
<td/>
</xsl:if>
</tr>
<xsl:for-each select="//Sqls/OrderProductList/Row">
<tr>
<td>
<xsl:value-of select="OrderProductID"/>
</td>
<td>
<xsl:if test="IsKitItem = 'True'">
<xsl:text disable-output-escaping="yes">&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
</xsl:if>
<xsl:value-of select="Name"/>
</td>
<td>
<xsl:value-of select="TotalQuantity"/> <xsl:value-of select="ProductUnitName"/>
<xsl:if test="IsPack = 'True'">*</xsl:if>
</td>
<xsl:if test="//Sqls/Permission/Row/IsPriceAllowed = 'True'">
<td>
<xsl:if test="((RawTotalPrice != 0) or ((IsKitItem = 'False') and (IsKit = 'False')))">
<xsl:value-of select="TotalPrice"/>
</xsl:if>
</td>
</xsl:if>
<xsl:if test="//OrderDetailsUrl and $DownloadableCount>0">
<td>
<xsl:if test="DownloadOutput!=''">
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="//OrderDetailsUrl"/>
</xsl:attribute>Download</xsl:element>
</xsl:if>
</td>
</xsl:if>
<xsl:if test="//Sqls/OrderProductList/Row/IsPack = 'True'">
<td>
<xsl:if test="IsPack = 'True'">*<xsl:value-of select="ProductUnitConversionString"/>
</xsl:if>
</td>
</xsl:if>
</tr>
</xsl:for-each>
</table>
<xsl:if test="//Sqls/Permission/Row/IsPriceAllowed = 'True'">
<br/>
<br/>
<table width="80%"
border="1"
cellpadding="4"
cellspacing="2"
style="border-collapse:collapse;">
<tr style="background-color:#eeeeee;">
<th style="width=20%;">Ship to Address</th>
<th style="width=20%;">Delivery Method</th>
<th style="width=20%;">Products to be Shipped</th>
<th style="width=20%;">Quantity</th>
</tr>
<xsl:for-each select="//Sqls/ShippingTable/Row">
<tr>
<td style="width=20%;">
<xsl:value-of select="Ship_Name"/>
<br/>
<xsl:value-of select="Ship_AddressReference"/>
<br/>
<xsl:value-of select="Ship_Add1"/> <xsl:value-of select="Ship_Add2"/>
<br/>
<xsl:value-of select="Ship_City"/>,  <xsl:value-of select="Ship_State_Name"/> <xsl:value-of select="Ship_Zip"/>
<br/>
<xsl:value-of select="Ship_Country_Name"/>
</td>
<td style="width=10%; text-align: center; vertical-align: middle;">
<xsl:value-of select="Method"/>: <xsl:value-of select="Service"/>
</td>
<td style="width=20%; text-align: center; vertical-align: middle;">
<xsl:value-of select="ProductName"/>
</td>
<td style="width=10%; text-align: center; vertical-align: middle;">
<xsl:value-of select="QuantityPerRecipient"/>
</td>
</tr>
</xsl:for-each>
</table>
<br/>
<table border="1"
cellpadding="4"
cellspacing="2"
style="border-collapse:collapse;">
<tr>
<td style="background-color:#eeeeee;">Subtotal Price:</td>
<td>
<xsl:value-of select="//Sqls/OrderProductList/Row/OrderAmount"/>
</td>
</tr>
<xsl:if test="//Sqls/OrderSummary/Row/ShowDeliveryPrice = 'True'">
<tr>
<td style="background-color:#eeeeee;">Shipping and Handling:</td>
<td>
<xsl:value-of select="//Sqls/OrderSummary/Row/DeliveryPriceFormatted"/>
</td>
</tr>
</xsl:if>
<tr>
<td style="background-color:#eeeeee;">Tax:</td>
<td>
<xsl:value-of select="//Sqls/OrderProductList/Row/TaxAmount"/>
</td>
</tr>
<xsl:if test="//Sqls/Order/Row/CouponCode != ''">
<tr>
<td style="background-color:#eeeeee;">Coupon #<xsl:value-of select="//Sqls/Order/Row/CouponCode"/>:</td>
<td>-<xsl:value-of select="//Sqls/Order/Row/CouponDiscountAmount"/>
</td>
</tr>
</xsl:if>
<tr>
<td style="background-color:#eeeeee;">Total Price:</td>
<td>
<xsl:value-of select="//Sqls/OrderProductList/Row/BillAmount"/>
</td>
</tr>
</table>
</xsl:if>
<br/>
<xsl:if test="//Sqls/Order/Row/ShowOrderCommentOnCheckout = 'True'">
<xsl:if test="//Sqls/Order/Row/OrderNotes != ''">
<b>Order Comment:</b>
<xsl:value-of select="//Sqls/Order/Row/OrderNotes"/>
<br/>
</xsl:if>
</xsl:if>
<b>Payment Details:</b> <xsl:value-of select="//Sqls/Order/Row/PaymentMethod"/>
<br/>
<xsl:if test="//Sqls/Order/Row/ClearingResult/UserData/PaymentDisplayString">
<xsl:value-of select="//Sqls/Order/Row/ClearingResult/UserData/PaymentDisplayString"
disable-output-escaping="yes"/>
<br/>
</xsl:if>
<xsl:if test="//Sqls/Order/Row/ClearingResult/UserData/ThirdParty">Third Party:<xsl:value-of select="//Sqls/Order/Row/ClearingResult/UserData/ThirdParty"/>
<br/>PO number:<xsl:value-of select="//Sqls/Order/Row/ClearingResult/UserData/ThirdPartyOrderNumber"/>
<br/>
</xsl:if>
<br/>Sincerely Yours,<br/>The<xsl:value-of select="//Sqls/StoreName/Row/StoreName"/> team.<xsl:if test="//Sqls/Merchant/Row/AddressID>0">
<br/>
<br/>
<img src="{//Parameters/MerchantLogo}"/>
<br/>
<div>
<table id="tblAddressDetails">
<tr>
<td>
<span id="lblCompany">
<xsl:value-of select="//Sqls/Merchant/Row/Company"/>
</span>
</td>
</tr>
<xsl:if test="//Sqls/Merchant/Row/TaxRegistration!=''">
<tr>
<td>
<span id="lblTaxRegistrationHeading">Tax registration:</span>
<span id="lblTaxRegistration">
<xsl:value-of select="//Sqls/Merchant/Row/TaxRegistration"/>
</span>
</td>
</tr>
</xsl:if>
<xsl:if test="//Sqls/Merchant/Row/Address1!=''">
<tr>
<td>
<span id="lblAddress1">
<xsl:value-of select="//Sqls/Merchant/Row/Address1"/>
</span>
</td>
</tr>
</xsl:if>
<xsl:if test="//Sqls/Merchant/Row/Address2!=''">
<tr>
<td>
<span id="lblAddress2">
<xsl:value-of select="//Sqls/Merchant/Row/Address2"/>
</span>
</td>
</tr>
</xsl:if>
<tr>
<td noWrap="noWrap"
xml:space="preserve">
<span id="lblCity">
<xsl:value-of select="//Sqls/Merchant/Row/City"/>
</span>
<span id="lblState">
<xsl:value-of select="//Sqls/Merchant/Row/StateName"/>
</span>
<span id="lblZip">
<xsl:value-of select="//Sqls/Merchant/Row/Zip"/>
</span>
</td>
</tr>
<tr>
<td>
<span id="lblCountry">
<xsl:value-of select="//Sqls/Merchant/Row/CountryName"/>
</span>
</td>
</tr>
<xsl:if test="//Sqls/Merchant/Row/Phone!=''">
<tr>
<td>
<span id="lblPhone">
<xsl:value-of select="//Sqls/Merchant/Row/Phone"/>
</span>
</td>
</tr>
</xsl:if>
<xsl:if test="//Sqls/Merchant/Row/Fax!=''">
<tr>
<td>
<span id="lblFax">
<xsl:value-of select="//Sqls/Merchant/Row/Fax"/>
</span>
</td>
</tr>
</xsl:if>
<xsl:if test="//Sqls/Merchant/Row/Email!=''">
<tr>
<td>
<span id="lblEmail">
<xsl:value-of select="//Sqls/Merchant/Row/Email"/>
</span>
</td>
</tr>
</xsl:if>
</table>
</div>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Adding Message Template SQL for Message Template Id 5
ShippingTable
exec('SELECT Product_Culture.Name AS ProductName , DeliveryItem.QuantityPerRecipient, DeliveryMethod.Name as Method , DPS.Name as Service, DeliveryTentative.DeliveryPrice , DeliveryTentative.DeliveryTentativeID , DeliveryTentative.Ship_Add1 , DeliveryTentative.Ship_Add2 , DeliveryTentative.Ship_AddressReference , DeliveryTentative.Ship_City , DeliveryTentative.Ship_Company , DeliveryTentative.Ship_Name , DeliveryTentative.Ship_Phone , Ship_StateName.Name AS Ship_State_Name , Ship_CountryName.Name AS Ship_Country_Name , DeliveryTentative.Ship_Zip FROM Orders Join OrderProduct ON Orders.OrderID = OrderProduct.OrderID Join Product on OrderProduct.productid = product.ProductID JOIN Product_Culture ON OrderProduct.ProductID = Product_Culture.ProductID AND Product_Culture.CultureID = 1 JOIN DeliveryItem ON OrderProduct.OrderProductID = DeliveryItem.OrderProductID JOIN DeliveryTentative ON DeliveryTentative.DeliveryTentativeID = DeliveryItem.DeliveryTentativeID JOIN DeliveryMethod ON DeliveryMethod.DeliveryMethodId = OrderProduct.DeliveryMethodId JOIN DeliveryProviderService DPS ON DPS.DeliveryProviderServiceID = DeliveryTentative.DeliveryServiceId LEFT OUTER JOIN Province_Culture AS Ship_StateName ON Ship_StateName.ProvinceId = DeliveryTentative.Ship_State AND Ship_StateName.CultureId = 1 LEFT OUTER JOIN Country_Culture AS Ship_CountryName ON Ship_CountryName.CountryId = DeliveryTentative.Ship_Country AND Ship_CountryName.CultureID = 1 where orders.orderid = '+@OrderId)