HTML Templates, hide date/time in Order Confirmation

Hey, friends! My employer (Florida Studio Theatre) sells a lot of subscriptions. We need to be able to send out order confirmations that hide the dates & times of performances far in the future when necessary. We have systems that respect that for TNEW and current order confirmations, but we are trying to re-engineer this using HTML Templates.

I don't really have Razor skills, so I am looking for structures to copy. Using the recipe book's "SHOW DYNAMIC PRODUCT CONTENT" methods, I can display the Content Value that tells TNEW to hide date/time for a particular Performance or Performance Season. I have not been able to use the existence of that value to control whether or not to show "@performance.PerformanceDateTime" and I feel like it should be easy/obvious. Does anyone have advice? We could hire (as a contractor) someone with mad skills; I guarantee there will be more things to convert in the next year.

Parents
  • I finally gave birth to something that worked. Thanks, Sara Hoffman; your call for simplicity was eventually what was needed.

    I used the code in the recipe book's "SHOW DYNAMIC PRODUCT CONTENT" to test for existence of the Web Content field, and set a true/false variable called hasWebContent to make that information accessible from anywhere in the template. Then I put the if/else test within the table (see below). I was not certain how to output an empty response. Also, as I write this I realize that, if there is ever an order that contains both hidden and revealed dates, they will all be hidden. Oh well.

    var performance = lineItem.Performance;
    var displayedDateTime = lineItem.Performance.PerformanceDateTime.ToString("dddd, MMMM dd, yyyy h:mm tt");
    <tr>
    <td>
    @performance.Description<br />
    @performance.Facility.Description
    @if (@hasWebContent == true) {
    <b> </b>}
    else {
    <br />
    @displayedDateTime }
    </td>
Reply
  • I finally gave birth to something that worked. Thanks, Sara Hoffman; your call for simplicity was eventually what was needed.

    I used the code in the recipe book's "SHOW DYNAMIC PRODUCT CONTENT" to test for existence of the Web Content field, and set a true/false variable called hasWebContent to make that information accessible from anywhere in the template. Then I put the if/else test within the table (see below). I was not certain how to output an empty response. Also, as I write this I realize that, if there is ever an order that contains both hidden and revealed dates, they will all be hidden. Oh well.

    var performance = lineItem.Performance;
    var displayedDateTime = lineItem.Performance.PerformanceDateTime.ToString("dddd, MMMM dd, yyyy h:mm tt");
    <tr>
    <td>
    @performance.Description<br />
    @performance.Facility.Description
    @if (@hasWebContent == true) {
    <b> </b>}
    else {
    <br />
    @displayedDateTime }
    </td>
Children