HTML Gift Certificate mples

Hi!

Has anyone created a pretty gift certificate using the "new" html order confirmation templates? I'm trying to chop down the sample confirmations to just the gift certificate bits so I can then pass that along to design to turn into a pretty "digital gift card" we can send through the app, but having a heck of a time with my limited Razor skills. If anyone has some sample code that would be great!

-Amanda

Parents
  • Hi there!

    I don't know that it's especially pretty, but the Granada Theatre uses an HTML template for e-gift certificates (and I have indeed chopped out nearly all non-GC bits from the code.) I've included a wee screenshot of the results, and the code below. I hope it helps!

    It looks like this:

     (Sorry so teensy)

    And the code is:

    @using Tessitura.Service.Client.CRM;

    @{
    var hasConstituent = Model.OrderProductView.Constituent != null;
    var hasAddress = Model.Address != null;
    var hasElectronicAddress = Model.ElectronicAddress != null;
    var hasBooking = Model.Booking != null;
    var isInFriendsCircle = false;
    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;
    isInFriendsCircle = constituencies != null && constituencies.Count(x => x.ConstituencyType.ShortDescription == "FRC") > 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 width="100%" style="vertical-align: top;text-align:left">
    <tr>
    <td colspan="2" style="text-align:left">
    <h3>Enjoy the Gift of Live Performances at The Granada Theatre!</h3>

    <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 print or save this page for your reference.</small></p>
    </td>
    </tr>


    </td>
    </tr>
    </table>
    </td>
    </tr>
    @if (hasProducts)
    {

    var giftCertificates = Model.OrderProductView.Products.Where(x => x.ProductClass.Description == "Gift Certificate");
    var giftCertificateTotal = giftCertificates.Sum(x => -x.GiftCertificate.Amount);

    if (giftCertificates != null && giftCertificates.Count() > 0)
    {
    <tr>
    <td align="left" valign="top">

    <table style="font-size: 12px; color: #000000; font-family: Arial, Helvetica, sans-serif; text-align: left">
    <tr>
    <th style="background-color: #b92323; color: #ffffff; font-weight: bold; font-size: 12px; text-align: left; vertical-align: top">
    <b>Your Gift Certificate Details</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="600" style="background-color: #FFFFFF ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #b92323; text-align: left; vertical-align: top">Redemption Code</th>
    <th style="background-color: #FFFFFF ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #b92323; text-align: right; vertical-align: top">Value</th>
    </tr>
    @foreach (var giftCertificate in giftCertificates)
    {
    var amount = -giftCertificate.GiftCertificate.Amount;
    <tr>
    <td>
    @giftCertificate.GiftCertificate.GiftCertificateNumber
    </td>
    <td style="vertical-align: top; text-align: right">
    @string.Format("{0:C}", amount)
    </td>
    </tr>
    }

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

    }
    <br>
    </tbody>
    <tfoot>
    <tr>
    <td colspan="2">
    <li>This certificate may be redeemed in person at the Granada Box Office, by calling (508)899-2222, or online at www.granadasb.org.<br>
    <li>Be prepared to give full gift certificate number to Box Office associate.<br>
    <li>This certificate and tickets acquired through its use are non-refundable and may not be redeemed for cash.<br>
    <li>This certificate does not expire and is valid until redeemed.<br>
    <li>This certificate cannot be replaced if lost, stolen, or altered.<br>
    <li>Tickets are subject to availability.<br></td>
    </tr>
    </tfoot>
    </table>

Reply
  • Hi there!

    I don't know that it's especially pretty, but the Granada Theatre uses an HTML template for e-gift certificates (and I have indeed chopped out nearly all non-GC bits from the code.) I've included a wee screenshot of the results, and the code below. I hope it helps!

    It looks like this:

     (Sorry so teensy)

    And the code is:

    @using Tessitura.Service.Client.CRM;

    @{
    var hasConstituent = Model.OrderProductView.Constituent != null;
    var hasAddress = Model.Address != null;
    var hasElectronicAddress = Model.ElectronicAddress != null;
    var hasBooking = Model.Booking != null;
    var isInFriendsCircle = false;
    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;
    isInFriendsCircle = constituencies != null && constituencies.Count(x => x.ConstituencyType.ShortDescription == "FRC") > 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 width="100%" style="vertical-align: top;text-align:left">
    <tr>
    <td colspan="2" style="text-align:left">
    <h3>Enjoy the Gift of Live Performances at The Granada Theatre!</h3>

    <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 print or save this page for your reference.</small></p>
    </td>
    </tr>


    </td>
    </tr>
    </table>
    </td>
    </tr>
    @if (hasProducts)
    {

    var giftCertificates = Model.OrderProductView.Products.Where(x => x.ProductClass.Description == "Gift Certificate");
    var giftCertificateTotal = giftCertificates.Sum(x => -x.GiftCertificate.Amount);

    if (giftCertificates != null && giftCertificates.Count() > 0)
    {
    <tr>
    <td align="left" valign="top">

    <table style="font-size: 12px; color: #000000; font-family: Arial, Helvetica, sans-serif; text-align: left">
    <tr>
    <th style="background-color: #b92323; color: #ffffff; font-weight: bold; font-size: 12px; text-align: left; vertical-align: top">
    <b>Your Gift Certificate Details</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="600" style="background-color: #FFFFFF ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #b92323; text-align: left; vertical-align: top">Redemption Code</th>
    <th style="background-color: #FFFFFF ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #b92323; text-align: right; vertical-align: top">Value</th>
    </tr>
    @foreach (var giftCertificate in giftCertificates)
    {
    var amount = -giftCertificate.GiftCertificate.Amount;
    <tr>
    <td>
    @giftCertificate.GiftCertificate.GiftCertificateNumber
    </td>
    <td style="vertical-align: top; text-align: right">
    @string.Format("{0:C}", amount)
    </td>
    </tr>
    }

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

    }
    <br>
    </tbody>
    <tfoot>
    <tr>
    <td colspan="2">
    <li>This certificate may be redeemed in person at the Granada Box Office, by calling (508)899-2222, or online at www.granadasb.org.<br>
    <li>Be prepared to give full gift certificate number to Box Office associate.<br>
    <li>This certificate and tickets acquired through its use are non-refundable and may not be redeemed for cash.<br>
    <li>This certificate does not expire and is valid until redeemed.<br>
    <li>This certificate cannot be replaced if lost, stolen, or altered.<br>
    <li>Tickets are subject to availability.<br></td>
    </tr>
    </tfoot>
    </table>

Children