1

I am getting this error in the commerce.log:

2017/05/08 23:18:49 [error] [plugin] [Forced] Epostmal analysefeil for epost “Behandles”. Bestilling: “097793b”. Malfeil: “An error occurred when rendering a template.”

I can't seem to find what's making the template error, as my other templates works as normal and I receive these emails (so the email system and templates work when changing status for orders, just this template that does not send out the email).

Any help would be appreciated.

The template is the following code:

{% set order = craft.commerce.orders.number(order.number).first() %}

* { font-family: 'Helvetica', 'Arial', sans-serif; }

body {
  margin: 0;
  padding: 0;
  min-width: 100%;
}

#container{
  max-width: 700px;
  margin-top: auto;
  margin-right: auto;
  margin-bottom: auto;
  margin-left: auto;
}

h1{
  font-size: 28px;
}

h2{
  font-size: 22px;
}

p{
  font-size: 16px;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
  margin-bottom: 30px;
}

td,
th {
  padding: 5px;
  border: none;
  vertical-align: top;
  text-align: left;
}

table#order-summary td{
  border-bottom: 1px solid #ccc;
}

table#customer td{
  width: 50%;
}

{{"Ordrebekreftelse"|t}}

<p style="font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;">{{"Hei!"t}}<br style="font-family: 'Helvetica', 'Arial', sans-serif;">
{{"tusen takk for at du valgte å handle hos Vask&amp;sol!"|t}}</p>

<p style="font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;">{{"Nedenfor finner du en oppsummering av din ordre. Vennligst kontakt oss umiddelbart dersom noe ikke stemmer."|t}}</p>

<p style="font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;">{{"Referanse:"|t}} #{{order.id}}</p>
<p style="font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;">{{"Dato:"|t}} {{order.dateOrdered}}</p>
<p style="font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;">{{"Status:"|t}} {{order.orderStatus}}</p>

<h2 style="font-family: 'Helvetica', 'Arial', sans-serif;font-size: 22px;">{{"Oppsummering"|t}}</h2>
<table id="order-summary" style="font-family: 'Helvetica', 'Arial', sans-serif;border-collapse: collapse;border-spacing: 0;width: 100%;margin-bottom: 30px;">
  <tr style="font-family: 'Helvetica', 'Arial', sans-serif;">
    <th style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;">{{"Produkt"|t}}</th>
    <th style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;">{{"Pris"|t}}</th>
    <th style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;">{{"Antall"|t}}</th>
    <th style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;">{{"Totalt"|t}}</th>
  </tr>

  {% for item in order.lineItems %}
    <tr style="font-family: 'Helvetica', 'Arial', sans-serif;">
      <td style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">{{item.description}}
        <!-- SKU: {{item.sku}} -->
      </td>
      <td style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">
        {% if item.onSale %}
          <strike style="font-family: 'Helvetica', 'Arial', sans-serif;">{{item.price + formatNOK}} </strike> {{item.salePrice + formatNOK}} kr
        {% else %}
          {{item.price + formatNOK}} kr
        {% endif %}
      </td>
      <td style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">{{item.qty}}</td>
      <td class="text-right" style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">{{item.total + formatNOK}} kr</td>
    </tr>
  {% endfor %}

  <tr style="font-family: 'Helvetica', 'Arial', sans-serif;">
    <td colspan="3" style="text-transform: none; font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">{{"Frakt:"|t}} {% if order.shippingMethod.getName() == "" %}{{"Ikke valgt enda"|t}}{% else %}{{order.shippingMethod.getName()}}{% endif %}</td>
    <td style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">{{order.totalShippingCost + formatNOK}} kr</td>
  </tr>

  {% if order.totalDiscount != "" %}
  <tr style="font-family: 'Helvetica', 'Arial', sans-serif;">
    <td colspan="3" style="text-transform: none; font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">{{"Rabatt"|t}}</td>
    <td style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">{{order.totalDiscount + formatNOK}} kr</td>
  </tr>
  {% endif %}

  <tr style="font-family: 'Helvetica', 'Arial', sans-serif;">
    <td colspan="3" style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">{{"Totalt"|t}}</td>
    <td style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">{{order.totalPrice + formatNOK}} kr</td>
  </tr>

  <tr style="font-family: 'Helvetica', 'Arial', sans-serif;">
    <td colspan="3" style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">{{"Herav MVA (25%)"|t}}</td>
    <td style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">

{% set total_vat = order.totalTaxIncluded %} {% for adjustment in order.adjustments %} {% if adjustment.name == 'Shipping VAT' and adjustment.amount > 0 %} {% set total_vat = total_vat + adjustment.amount %} {% endif %} {% endfor %} {{total_vat + formatNOK}} kr

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

<table id="customer" style="font-family: 'Helvetica', 'Arial', sans-serif;border-collapse: collapse;border-spacing: 0;width: 100%;margin-bottom: 30px;">
  <tr style="font-family: 'Helvetica', 'Arial', sans-serif;">
    <td style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;width: 50%;">
      <h2 style="font-family: 'Helvetica', 'Arial', sans-serif;font-size: 22px;">{{"Leveringsadresse"|t}}</h2>
      {% if order.shippingAddress %}
        {% include '_includes/addresses/address' with { address: order.shippingAddress } %}
      {% endif %}
    </td>
    <td style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;width: 50%;">
      <h2 style="font-family: 'Helvetica', 'Arial', sans-serif;font-size: 22px;">{{"Fakturaadresse"|t}}</h2>
      {% if order.billingAddress %}
        {% include '_includes/addresses/address' with { address: order.billingAddress } %}
      {% endif %}
    </td>
  </tr>
</table>

<p style="font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;">Vask og sol AS<br style="font-family: 'Helvetica', 'Arial', sans-serif;">
Org. nr. 987654321<br>
<a href="http://vaskogsol.no" style="font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;">vaskogsol.no</a>

1

I don't know exactly why, but I copied the template from the other status and just changed the text differences, and it worked. There was minor differences as I put them side by side in https://www.diffchecker.com/ , so I assume it was some error in spacing or a missing comma somewhere (it works, so I'm happy), here is the new code that worked:

{% set order = craft.commerce.orders.number(order.number).first() %}

* { font-family: 'Helvetica', 'Arial', sans-serif; }

body {
  margin: 0;
  padding: 0;
  min-width: 100%;
}

#container{
  max-width: 700px;
  margin-top: auto;
  margin-right: auto;
  margin-bottom: auto;
  margin-left: auto;
}

h1{
  font-size: 28px;
}

h2{
  font-size: 22px;
}

p{
  font-size: 16px;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
  margin-bottom: 30px;
}

td,
th {
  padding: 5px;
  border: none;
  vertical-align: top;
  text-align: left;
}

table#order-summary td{
  border-bottom: 1px solid #ccc;
}

table#customer td{
  width: 50%;
}

{{"Ordrebekreftelse"|t}}

<p style="font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;">{{"Hei!"}}<br style="font-family: 'Helvetica', 'Arial', sans-serif;">
{{"tusen takk for at du valgte å handle hos Vaskogsol!"|t}}</p>

<p style="font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;">{{"Nedenfor finner du en oppsummering av din ordre. Vennligst kontakt oss umiddelbart dersom noe ikke stemmer."|t}}</p>

<p style="font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;">{{"Referanse:"|t}} #{{order.id}}</p>
<p style="font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;">{{"Dato:"|t}} {{order.dateOrdered}}</p>
<p style="font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;">{{"Status:"|t}} {{order.orderStatus}}</p>

<h2 style="font-family: 'Helvetica', 'Arial', sans-serif;font-size: 22px;">{{"Oppsummering"|t}}</h2>
<table id="order-summary" style="font-family: 'Helvetica', 'Arial', sans-serif;border-collapse: collapse;border-spacing: 0;width: 100%;margin-bottom: 30px;">
  <tr style="font-family: 'Helvetica', 'Arial', sans-serif;">
    <th style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;">{{"Produkt"|t}}</th>
    <th style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;">{{"Pris"|t}}</th>
    <th style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;">{{"Antall"|t}}</th>
    <th style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;">{{"Totalt"|t}}</th>
  </tr>

  {% for item in order.lineItems %}
    <tr style="font-family: 'Helvetica', 'Arial', sans-serif;">
      <td style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">{{item.description}}
        <!-- SKU: {{item.sku}} -->
      </td>
      <td style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">
        {% if item.onSale %}
          <strike style="font-family: 'Helvetica', 'Arial', sans-serif;">{{item.price + formatNOK}} </strike> {{item.salePrice + formatNOK}} kr
        {% else %}
          {{item.price + formatNOK}} kr
        {% endif %}
      </td>
      <td style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">{{item.qty}}</td>
      <td class="text-right" style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">{{item.total + formatNOK}} kr</td>
    </tr>
  {% endfor %}

  <tr style="font-family: 'Helvetica', 'Arial', sans-serif;">
    <td colspan="3" style="text-transform: none; font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">{{"Frakt:"|t}} {% if order.shippingMethod.getName() == "" %}{{"Ikke valgt enda"|t}}{% else %}{{order.shippingMethod.getName()}}{% endif %}</td>
    <td style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">{{order.totalShippingCost + formatNOK}} kr</td>
  </tr>

  {% if order.totalDiscount != "" %}
  <tr style="font-family: 'Helvetica', 'Arial', sans-serif;">
    <td colspan="3" style="text-transform: none; font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">{{"Rabatt"|t}}</td>
    <td style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">{{order.totalDiscount + formatNOK}} kr</td>
  </tr>
  {% endif %}

  <tr style="font-family: 'Helvetica', 'Arial', sans-serif;">
    <td colspan="3" style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">{{"Totalt"|t}}</td>
    <td style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">{{order.totalPrice + formatNOK}} kr</td>
  </tr>

  <tr style="font-family: 'Helvetica', 'Arial', sans-serif;">
    <td colspan="3" style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">{{"Herav MVA (25%)"|t}}</td>
    <td style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;border-bottom: 1px solid #ccc;">

{% set total_vat = order.totalTaxIncluded %} {% for adjustment in order.adjustments %} {% if adjustment.name == 'Shipping VAT' and adjustment.amount > 0 %} {% set total_vat = total_vat + adjustment.amount %} {% endif %} {% endfor %} {{total_vat + formatNOK}} kr

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

<table id="customer" style="font-family: 'Helvetica', 'Arial', sans-serif;border-collapse: collapse;border-spacing: 0;width: 100%;margin-bottom: 30px;">
  <tr style="font-family: 'Helvetica', 'Arial', sans-serif;">
    <td style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;width: 50%;">
      <h2 style="font-family: 'Helvetica', 'Arial', sans-serif;font-size: 22px;">{{"Leveringsadresse"|t}}</h2>
      {% if order.shippingAddress %}
        {% include '_includes/addresses/address' with { address: order.shippingAddress } %}
      {% endif %}
    </td>
    <td style="font-family: 'Helvetica', 'Arial', sans-serif;padding: 5px;border: none;vertical-align: top;text-align: left;width: 50%;">
      <h2 style="font-family: 'Helvetica', 'Arial', sans-serif;font-size: 22px;">{{"Fakturaadresse"|t}}</h2>
      {% if order.billingAddress %}
        {% include '_includes/addresses/address' with { address: order.billingAddress } %}
      {% endif %}
    </td>
  </tr>
</table>

<p style="font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;">Vask og Sol AS<br style="font-family: 'Helvetica', 'Arial', sans-serif;">
Org. nr. 876543219<br>
<a href="http://vaskogsol.no" style="font-family: 'Helvetica', 'Arial', sans-serif;font-size: 16px;">vaskogsol.no</a>
</p>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.