Help with HTML Confirmation Email - Only show one specific performance in the email.

Hello all!

Is someone able to help me with the HTML template for a performance exchange. In the confirmation email I only want to show the new performance (Performance ID 1058). Everything else looks fine. Essentially we're exchange people from one performance to another (in an existing order) we only want to show them the new show, how many seats they have and the section. I have attached the HTML text Here is a rendered example of what I want it to look like:

<!--
This head section is needed to insure that QR Codes and other background elements print correctly.  If this template will be
printed to paper or PDF by the customer leave this code in place.
-->
<head>
    <style>
        * {
            -webkit-print-color-adjust: exact !important;   /* Chrome, Safari */
            color-adjust: exact !important;                 /*Firefox*/
        }
    </style>
</head>

@*using statement required for access to Constituencies object type when making REST call to CRM/Constituencies*@
@using Tessitura.Service.Client.CRM;
@using Tessitura.Service.Client.Txn;
@using System.Linq;

@{
    var hasConstituent = Model.OrderProductView.Constituent != null;
    var hasAddress = Model.Address != null;
    var hasElectronicAddress = Model.ElectronicAddress != null;
    var hasBooking = Model.Booking != null;
    var isInSpecialConstituency = false;
    var constituencyMessage = Model.GetPropertyValue("ConstituencyMessage") ?? "Thank you for being a part of Friend's Circle!";
    var constituency = Model.GetPropertyValue("Constituency") ?? "FRC";
    var hasState = hasAddress && Model.Address.State != null;
    var hasProducts = Model.OrderProductView.Products != null && Model.OrderProductView.Products.Count > 0;
}

@if (hasConstituent)
{
    var url = "CRM/Constituencies?constituentId=" + Model.OrderProductView.Constituent.Id + "&includeAffiliations=true";
    var constituencies = Model.RestClient.AtUrl(url).Get<Constituencies>().ResponseObject;
    isInSpecialConstituency = constituencies != null && (constituencies as Constituencies).Count(x => x.ConstituencyType.ShortDescription == constituency) > 0;
}

<table width="700" style="font-size: 12px; text-align:left;	color: #000000; font-family:Arial, Helvetica, sans-serif;">
    <tr>
        <td align="left" valign="top">

            <table style="vertical-align: top;text-align:left">
                <tr>
                    <td colspan="2" style="text-align: left">
						<!--Replace the URL in this link with your organization's website.-->
						<!--Replace the logo image with one hosted on your website. -->
                        <a href="https://austinsymphony.org" target="_blank"><img src="https://austinsymphony.org/wp-content/uploads/2021/03/ASO-OFFICIAL-Logo-300x139-1.png" alt="ASO" width="308" height="173"></a>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="text-align:left">
                        <h3>Thank You for Your Order with the Austin Symphony Orchestra!</h3>
                        <b>Order Date:</b> @Model.OrderProductView.OrderDateTime <br />
                        <b>Order Number:</b> @Model.OrderProductView.Id<br />
                        @if (hasConstituent)
                        {
                            <b>Customer Number:</b>
                            @Model.OrderProductView.Constituent.Id
                            <br />
                            <br />
                        }
                        <p style="margin-top: -10px; padding-bottom: 20px;"><small>Please retain this receipt for your reference.</small></p>
                    </td>
                </tr>
                @{
                    var state = hasState ? ", " + Model.Address.State.StateCode : "";
                    var electronicAddress = hasElectronicAddress ? Model.ElectronicAddress.Address : "";
                }
                
                <tr>
                    <td width="50%" style="padding-bottom: 20px; vertical-align: top;">
                        <b>Your Account Information:</b><BR />
                        @if (isInSpecialConstituency)
                        {
                            @constituencyMessage <br />
                        }
                        @if (hasConstituent)
                        {
                            @Model.OrderProductView.Constituent.DisplayName <br />
                        }
                        @if (hasAddress)
                        {
                            @Model.Address.Street1<br />
                            @Model.Address.City@state @Model.Address.PostalCode<br />
                        }
                        @electronicAddress<br />
                    </td>
                    <td width="50%" style="padding-bottom: 20px; text-align: left;vertical-align: top">
                        <b>Order Shipping Information</b><BR />
                        @if (Model.OrderProductView.DeliveryMethod.Id == -1)
                        {
                            <text> Hold order at Box Office</text><br />
                            <i>Please pick up your tickets no later than 10 minutes before curtain</i>
                        }
                        else if (Model.OrderProductView.DeliveryMethod.Id == 2)
                        {
                            <text>Email Delivery</text><br />
                            <text>Tickets will be sent via email on June 8th.</text> <i>If you do not see the tickets in your inbox please check your Spam folder or promotions tab.</i>
                        }
                        else if (hasAddress)
                        {
                            <text>
                                @Model.Address.Street1<br />
                                @Model.Address.City@state @Model.Address.PostalCode<br />
                            </text>
                        }


                    </td>
                </tr>
            </table>
        </td>
    </tr>
    @if (hasProducts)
    {
        /* PERFORMANCES */
        var perfs = (Model.OrderProductView.Products as OrderProductViewProducts).Where(x => x.ProductClass.Description == "Performance");

        // If the order has performances, loop through them and display them in a table
        if (perfs != null && perfs.Count() > 0)
        {
            <tr>
                <td align="left" valign="top">
                    <table align="left" style="font-size: 12px; color: #000000; font-family: Arial, Helvetica, sans-serif;">
                        <tr>
                            <th style="background-color: #F15E47; color: #ffffff; font-weight: bold; font-size: 12px; text-align: left; vertical-align: top">
                                <b>Performances</b>
                            </th>
                        </tr>
                        <tr>
                            <td style="text-align: left; vertical-align: top">
                                <table width="700" style="vertical-align: top; text-align: left">
                                    <tr>
                                        <th width="250" style="background-color: #FFFFFF ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #F15E47; vertical-align: top; text-align: left">Description</th>
                                        <th width="150" style="background-color: #FFFFFF ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #F15E47; vertical-align: top; text-align: left">Location</th>
                                        <th width="100" style="background-color: #FFFFFF ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #F15E47; vertical-align: top; text-align: left">Type</th>
                                        <th width="85" style="background-color: #FFFFFF ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #F15E47; vertical-align: top; text-align: right">Seats</th>
                                    </tr>

                                    @{
                                        var performanceTotal = @perfs.Sum(x => x.Performance.LineItem.TotalDue);
                                    }

                                    @foreach (var product in perfs)
                                    {
                                        var performance = product.Performance.LineItem.Performance;
                                        var subLineItems = product.Performance.LineItem.SubLineItems;
                                        int ticketCount = subLineItems.Count();
                                        <tr>
                                            <td>
                                                @performance.Description<br />
                                                @performance.Facility.Description<br />
                                                @performance.PerformanceDateTime
                                            </td>
                                            <td style="vertical-align: top">
                                                @product.Performance.LineItem.SubLineItems[0].Zone.Description
                                            </td>
                                            <td style="vertical-align: top">
                                                @{
                                                 if (performance.BestSeatMap.IsGA == false) {
                                                     foreach (var subLineItem in product.Performance.LineItem.SubLineItems)
                                                        {
                                                           var seatRow = string.IsNullOrEmpty(subLineItem.Seat.Number) ? "TBD" : subLineItem.Seat.Row + " " + subLineItem.Seat.Number;
                                                            @seatRow<br />
                                                         }
                                                             }
                                                   else {
                                                    <span>General Admission</span>
                                                     }
                                                 }
                                            </td>
                                            <td style="vertical-align: top; text-align: right">
                                                @ticketCount<br />
                                                <td/>
                                        </tr>
                                    }
                                </table>

                            </td>
                        </tr>
                    </table>
                </td>
            </tr>

        }
    }

</table>

  • Hi Abbe,

    In my order confirmation, when I'm listing out the performances I have it broken up into sections to show the difference between purchased performances and returned performances based on the subline item status. In the for loop section where it loops through performances, I have this line:

    var purchased = product.Performance.LineItem.SubLineItems.Where(x => (x.StatusId == sliUnseatedUnpaid || x.StatusId == sliSeatedUnpaid || x.StatusId == sliSeatedPaid || x.StatusId == sliUnseatedPaid || x.StatusId == sliTicketedPaid));

    And then I have an if clause to only print out the information if purchased is not null:

    if (purchased != null && purchased.Count() > 0)

    Does that help?

    Sara

  • Hi Sara,

    Do you have an @using for this also? I don't think referencing sli works without it.

    However, in my case I wouldn't mind something a lot simpler. This is for a one off where I only want to show the one specific performance. So I'm looking for the HTML wording to get it to show a specific performance instead of looping through.

  • Yes I think you're right, I have @using Tessitura.Service.Client.Txn; at the top of my template.

    Is this a specific template that you're using for these specific orders? Or is this a template that gets used for all orders? If it's the default for all orders I would think you'd still want to keep the loop through performances as your orders could have more than one product in them? But if this is only for specific cases where you know the order and only want to show the one performance, you could take out the @foreach (var product in perfs) and instead have an if clause to check for performance id and only display if the performance id = 1058?

  • Hi Sara,

    Would you be willing to share your template design? If so I can be reached at gharrower@broadwaysacramento.com. Thank you! ~ Gina

  • Hi Gina,

    I was able to get it to work for the individual show. Here is my final code:

    <!--
    This head section is needed to insure that QR Codes and other background elements print correctly. If this template will be
    printed to paper or PDF by the customer leave this code in place.
    -->
    <head>
    <style>
    * {
    -webkit-print-color-adjust: exact !important; /* Chrome, Safari */
    color-adjust: exact !important; /*Firefox*/
    }
    </style>
    </head>

    @*using statement required for access to Constituencies object type when making REST call to CRM/Constituencies*@
    @using Tessitura.Service.Client.CRM;
    @using Tessitura.Service.Client.Txn;
    @using System.Linq;

    @{
    var hasConstituent = Model.OrderProductView.Constituent != null;
    var hasAddress = Model.Address != null;
    var hasElectronicAddress = Model.ElectronicAddress != null;
    var hasBooking = Model.Booking != null;
    var isInSpecialConstituency = false;
    var constituencyMessage = Model.GetPropertyValue("ConstituencyMessage") ?? "Thank you for being a part of Friend's Circle!";
    var constituency = Model.GetPropertyValue("Constituency") ?? "FRC";
    var hasState = hasAddress && Model.Address.State != null;
    var hasProducts = Model.OrderProductView.Products != null && Model.OrderProductView.Products.Count > 0;
    }

    @if (hasConstituent)
    {
    var url = "CRM/Constituencies?constituentId=" + Model.OrderProductView.Constituent.Id + "&includeAffiliations=true";
    var constituencies = Model.RestClient.AtUrl(url).Get<Constituencies>().ResponseObject;
    isInSpecialConstituency = constituencies != null && (constituencies as Constituencies).Count(x => x.ConstituencyType.ShortDescription == constituency) > 0;
    }

    <table width="700" style="font-size: 12px; text-align:left; color: #000000; font-family:Arial, Helvetica, sans-serif;">
    <tr>
    <td align="left" valign="top">

    <table style="vertical-align: top;text-align:left">
    <tr>
    <td colspan="2" style="text-align: left">
    <!--Replace the URL in this link with your organization's website.-->
    <!--Replace the logo image with one hosted on your website. -->
    <a href="">https://austinsymphony.org" target="_blank"><img src="">austinsymphony.org/.../ASO-OFFICIAL-Logo-300x139-1.png" alt="ASO" width="308" height="173"></a>
    </td>
    </tr>
    <tr>
    <td colspan="2" style="text-align:left">
    <h3>Thank You for Your Order with the Austin Symphony Orchestra!</h3>
    <b>Order Date:</b> @Model.OrderProductView.OrderDateTime <br />
    <b>Order Number:</b> @Model.OrderProductView.Id<br />
    @if (hasConstituent)
    {
    <b>Customer Number:</b>
    @Model.OrderProductView.Constituent.Id
    <br />
    <br />
    }
    <p style="margin-top: -10px; padding-bottom: 20px;"><small>Please retain this receipt for your reference.</small></p>
    </td>
    </tr>
    @{
    var state = hasState ? ", " + Model.Address.State.StateCode : "";
    var electronicAddress = hasElectronicAddress ? Model.ElectronicAddress.Address : "";
    }

    <tr>
    <td width="50%" style="padding-bottom: 20px; vertical-align: top;">
    <b>Your Account Information:</b><BR />
    @if (isInSpecialConstituency)
    {
    @constituencyMessage <br />
    }
    @if (hasConstituent)
    {
    @Model.OrderProductView.Constituent.DisplayName <br />
    }
    @if (hasAddress)
    {
    @Model.Address.Street1<br />
    @Model.Address.City@state @Model.Address.PostalCode<br />
    }
    @electronicAddress<br />
    </td>
    <td width="50%" style="padding-bottom: 20px; text-align: left;vertical-align: top">
    <b>Order Shipping Information</b><BR />
    @if (Model.OrderProductView.DeliveryMethod.Id == -1)
    {
    <text> Hold order at Box Office</text><br />
    <i>Please pick up your tickets no later than 10 minutes before curtain</i>
    }
    else if (Model.OrderProductView.DeliveryMethod.Id == 2)
    {
    <text>Email Delivery</text><br />
    <text>If you do not see the tickets in your inbox please check your Spam folder or promotions tab.</text>
    }
    else if (hasAddress)
    {
    <text>
    @Model.Address.Street1<br />
    @Model.Address.City@state @Model.Address.PostalCode<br />
    </text>
    }
    </td>
    </tr>
    </table>
    </td>
    </tr>
    @if (hasProducts)
    {
    /* PERFORMANCES */
    var perfs = (Model.OrderProductView.Products as OrderProductViewProducts).Where(x => x.ProductClass.Description == "Performance" && x.Performance.LineItem.Performance.Id == 1053);

    // If the order has performances, loop through them and display them in a table
    if (perfs != null && perfs.Any())
    {
    <tr>
    <td align="left" valign="top">
    <table align="left" style="font-size: 12px; color: #000000; font-family: Arial, Helvetica, sans-serif;">
    <tr>
    <th style="background-color: #F15E47; color: #ffffff; font-weight: bold; font-size: 12px; text-align: left; vertical-align: top">
    <b>Performances</b>
    </th>
    </tr>
    <tr>
    <td style="text-align: left; vertical-align: top">
    <table width="700" style="vertical-align: top; text-align: left">
    <tr>
    <th width="190" style="background-color: #FFFFFF ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #F15E47; vertical-align: top; text-align: left">Description</th>
    <th width="170" style="background-color: #FFFFFF ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #F15E47; vertical-align: top; text-align: left">Location</th>
    <th width="200" style="background-color: #FFFFFF ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #F15E47; vertical-align: top; text-align: left">Seat</th>
    <th width="85" style="background-color: #FFFFFF ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #F15E47; vertical-align: top; text-align: right">Number of Seats</th>
    </tr>

    @{
    var performanceTotal = @perfs.Sum(x => x.Performance.LineItem.TotalDue);
    }

    @foreach (var product in perfs)
    {
    var performance = product.Performance.LineItem.Performance;
    var subLineItems = product.Performance.LineItem.SubLineItems;
    int ticketCount = subLineItems.Count();
    <tr>
    <td>
    @performance.Description<br />
    @performance.Facility.Description<br />
    @performance.PerformanceDateTime
    </td>
    <td style="vertical-align: top">
    @product.Performance.LineItem.SubLineItems[0].Zone.Description
    </td>
    <td style="vertical-align: top">
    @{
    if (performance.BestSeatMap.IsGA == false) {
    foreach (var subLineItem in product.Performance.LineItem.SubLineItems)
    {
    var seatRow = string.IsNullOrEmpty(subLineItem.Seat.Number) ? "TBD" : subLineItem.Seat.Row + " " + subLineItem.Seat.Number;
    @seatRow<br />
    }
    }
    else {
    <span>Open seating within section</span>
    }
    }
    </td>
    <td style="vertical-align: top; text-align: right">
    @ticketCount<br />
    <td/>
    </tr>
    }
    </table>

    </td>
    </tr>
    </table>
    </td>
    </tr>

    }
    }

    </table>