Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nguyen Dung Tri 106 posts 606 karma points
    Dec 02, 2016 @ 08:01
    Nguyen Dung Tri
    0

    Merchello - Notification on Order Confirmation

    Hello,

    I have setup an SMTP Notification Provider and add a new message on Notification:

    enter image description here

    In my email template, I have added some lines:

    <p class="">
         {{shipping_address.name}}<br />
         {{shipping_address.street}}<br />
         {{shipping_address.city}}<br />
         {{shipping_address.province}}
         {{shipping_address.zip}}<br />
         {{shipping_address.country}}
     </p>
    

    In my class, I have use Notification to send a notification email to customer:

    var attempt = this.CheckoutManager.Payment.AuthorizePayment(paymentMethod.Key);
                        Merchello.Core.Notification.Trigger("OrderConfirmation", attempt, new[] { customerEmail }, Core.Observation.Topic.Notifications);
    

    From here, I don't know how to update parameters from my email template like {{shippingaddress.name}} and {{shippingaddress.street}}.

    So how can I update the parameters in my email template before seding to customer?

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Dec 02, 2016 @ 16:09
    Rusty Swayne
    1

    The pattern formatter is obsolete (but still available). However, you are using the razor formatted editor so the patterns you're showing in your example are irrelevant.

    Simply use razor code in the view.

    View is located in:

    /Views/Merchello/Notifications/

  • Nguyen Dung Tri 106 posts 606 karma points
    Dec 03, 2016 @ 07:42
    Nguyen Dung Tri
    0

    Could you provide a sample OrderConfirmation template for me? I didn't know how to place a the brackets "{{}}" inside my cshtml for it to replace with invoice information.

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Dec 05, 2016 @ 16:19
    Rusty Swayne
    100

    You don't use the {{}} when dealing with razor.

      @inherits Merchello.Web.Mvc.MerchelloHelperViewPage<Merchello.Core.Models.MonitorModels.IPaymentResultMonitorModel>
      @using Merchello.Core
      @using Merchello.Core.Models
      @*
          MerchelloHelperViewPage<T> inherits from UmbracoViewPage<t>          and exposes the MerchelloHelper as 'Merchello'
          Example usage:  var product = Merchello.TypedProductContent(YOURPRODUCTKEY);
      *@
    
      Dear @Model.Invoice.BillToName
    
      <p>Thank you for your order.</p>
      <ul>
      @foreach (var item in Model.Invoice.Items)
      {
        <li>@item.Name + @item.Price.AsFormattedCurrency()</li>
      }
      </ul>
    
      <p>Thanks!</p>
    
  • Josué González 17 posts 110 karma points
    Mar 28, 2017 @ 21:17
    Josué González
    0

    Hello everyone.

    I have been developing a website using umbraco and merchello and I have been fortunate enough that there is enough documentation for every circumstance I have needed.

    I want to contribute a little to this community. I have noticed that many request a template for a 'merchello' invoice. So I share the one I developed, with a little style that looks great, modesty aside.

    I hope it will be useful for someone. Here a sample, and later the code.

    Note: In the code you can edit the colors.

    enter image description here

    @inherits Merchello.Web.Mvc.MerchelloHelperViewPage<Merchello.Core.Models.MonitorModels.IPaymentResultMonitorModel>
    @using Merchello.Core
    @using Merchello.Core.Models
    @{ 
        string primaryColor = "D47F3C";
        string secundaryColor = "EDDEBC";
        string whiteColor = "FFFFFF";
        string grayColor = "666666";
        string lightgrayColor = "9D9D9D";
    
        string rowBackgroun1 = "F6F6F6";
        string rowBackgroun2 = "E5E5E5";
    }
    <table align="center" width="100%">
        <tr height="32px"></tr>
        <tr align="center">
            <td width="32px"></td>
            <td align="left">
                <h2 style="color:#@primaryColor" align="center">INVOICE</h2>
                <h3 style="color:#@grayColor">Hello <strong style="color:#@primaryColor">@Model.Invoice.BillToName</strong>,</h3>
                <p style="color:#@grayColor">Thank you very much for your order, number <strong>@Model.Invoice.PrefixedInvoiceNumber()</strong></p>
                <p style="color:#@grayColor">
                    <strong style="color:#@primaryColor">Your address</strong><br />
                    @Model.Invoice.BillToAddress1<br />
                    @Model.Invoice.BillToAddress2<br />
                    @Model.Invoice.BillToLocality, @Model.Invoice.BillToRegion @Model.Invoice.BillToPostalCode
                </p>
                <p style="color:#@grayColor">
                    <strong style="color:#@primaryColor">Email :</strong> @Model.Invoice.BillToEmail<br />
                    <strong style="color:#@primaryColor">Phone :</strong> @Model.Invoice.BillToPhone
                </p>    
                <table border="0" width="100%" align="center">
                    <tbody>
                        <tr>
                            <td colspan="2" align="left">
                                <p>
                                    <strong style="color:#@primaryColor">Items Purchased:</strong>
                                </p>
                            </td>
                            <td colspan="3">
                                <table width="100%" style="background:#@primaryColor; color:#@secundaryColor">
                                    <tr>
                                        <td align="right">
                                            Payment Method: <br />
                                            <strong style="color:#@whiteColor">@Model.Payment.PaymentMethodName</strong>
                                        </td>
                                        <td align="right">
                                            Invoice Date: <br />
                                            <strong style="color:#@whiteColor">@Model.Invoice.InvoiceDate.ToShortDateString()</strong>
                                        </td>
                                        <td align="right">
                                            Invoice Number: <br />
                                            <strong style="color:#@whiteColor">@Model.Invoice.PrefixedInvoiceNumber()</strong>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr style="background:#@grayColor;color:#@whiteColor">
                            <th>No</th>
                            <th>Item Name</th>
                            <th>Unit Price</th>
                            <th>Quantity</th>
                            <th>Total</th>
                        </tr>
                        @{
                            var cont = 1;    
                            foreach (var item in Model.Invoice.Items)
                            {
                                string color = (cont % 2 == 0) ? rowBackgroun1 : rowBackgroun2;
                                decimal totalItem = item.Price * item.Quantity;
                                <tr style="background:#@color;color:#@grayColor">
                                    <td align="center">@cont</td>
                                    <td>
                                        <strong style="color:#@grayColor">@item.Name</strong><br />
                                        @if (!string.IsNullOrEmpty(@item.Sku))
                                        {
                                            <p><small>Code: @item.Sku</small></p>
                                        }
                                    </td>
                                    <td align="right">@item.Price.AsFormattedCurrency()</td>
                                    <td align="center">@item.Quantity</td>
                                    <td align="right">@totalItem.AsFormattedCurrency()</td>
                                </tr>
                                cont++;
                            }
                        }
                        <tr>
                            <td colspan="3"></td>
                            <td style="background:#@lightgrayColor;color:#@whiteColor" align="right">DISCOUNT:</td>
                            <td style="background:#@lightgrayColor;color:#@whiteColor" align="right">@Model.Invoice.TotalDiscounts().AsFormattedCurrency()</td>
                        </tr>
                        <tr>
                            <td colspan="3"></td>
                            <td style="background:#@grayColor;color:#@whiteColor" align="right">TOTAL:</td>
                            <td style="background:#@grayColor;color:#@whiteColor" align="right">@Model.Invoice.Total.AsFormattedCurrency()</td>
                        </tr>
                    </tbody>
                </table>
                <p style="color:#@grayColor">We will process your order and ship your items soon, have an excellent day.</p>
            </td>
            <td width="32px"></td>
        </tr>
        <tr height="32px"></tr>
    </table>
    
  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Mar 29, 2017 @ 16:33
    Rusty Swayne
    0

    Josué González - High Five, You Rock!!!

Please Sign in or register to post replies

Write your reply to:

Draft