1

I'm looking for explanation about email template in admin.

As you can see, this button will send an email to my gmail account.

enter image description here And as far as i know, magento use order_new.html to render html to email, but even when i changed it, the html is still the same, am i missing something here?

C:\xampp\htdocs\magento\vendor\magento\module-sales\view\frontend\email\order_new.html

<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<!--@subject {{trans "Your %store_name order confirmation" store_name=$store.getFrontendName()}} @-->
<!--@vars {
"var formattedBillingAddress|raw":"Billing Address",
"var order.getEmailCustomerNote()":"Email Order Note",
"var order.increment_id":"Order Id",
"layout handle=\"sales_email_order_items\" order=$order area=\"frontend\"":"Order Items Grid",
"var payment_html|raw":"Payment Details",
"var formattedShippingAddress|raw":"Shipping Address",
"var order.getShippingDescription()":"Shipping Description",
"var shipping_msg":"Shipping message"
} @-->

{{template config_path="design/email/header_template"}}

<table>
    <tr class="email-intro">
        <td>
            <p class="greeting">{{trans "%customer_name," customer_name=$order.getCustomerName()}}</p>
            <p>
                {{trans "Thank you for your order from %store_name." store_name=$store.getFrontendName()}}
                {{trans "Once your package ships we will send you a tracking number."}}
                {{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
            </p>
            <p>
                {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}.
                {{depend store_hours}}
                    {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}}
                {{/depend}}
            </p>
        </td>
    </tr>
    <tr class="email-summary">
        <td>
            <h1>{{trans 'Your Order <span class="no-link">#%increment_id</span>' increment_id=$order.increment_id |raw}}</h1>
            <p>{{trans 'Placed on <span class="no-link">%created_at</span>' created_at=$order.getCreatedAtFormatted(2) |raw}}</p>
        </td>
    </tr>
    <tr class="email-information">
        <td>
            {{depend order.getEmailCustomerNote()}}
            <table class="message-info">
                <tr>
                    <td>
                        {{var order.getEmailCustomerNote()|escape|nl2br}}
                    </td>
                </tr>
            </table>
            {{/depend}}
            <table class="order-details">
                <tr>
                    <td class="address-details">
                        <h3>{{trans "Billing Info"}}</h3>
                        <p>{{var formattedBillingAddress|raw}}</p>
                    </td>
                    {{depend order.getIsNotVirtual()}}
                    <td class="address-details">
                        <h3>{{trans "Shipping Info"}}</h3>
                        <p>{{var formattedShippingAddress|raw}}</p>
                    </td>
                    {{/depend}}
                </tr>
                <tr>
                    <td class="method-info">
                        <h3>{{trans "Payment Method"}}</h3>
                        {{var payment_html|raw}}
                    </td>
                    {{depend order.getIsNotVirtual()}}
                    <td class="method-info">
                        <h3>{{trans "Shipping Method"}}</h3>
                        <p>{{var order.getShippingDescription()}}</p>
                        {{if shipping_msg}}
                        <p>{{var shipping_msg}}</p>
                        {{/if}}
                    </td>
                    {{/depend}}
                </tr>
            </table>
            {{layout handle="sales_email_order_items" order=$order area="frontend"}}
        </td>
    </tr>
</table>

{{template config_path="design/email/footer_template"}}

enter image description here

0

Customize email templates using the Magento Admin :

  1. In the Magento Admin, navigate to MARKETING > Communications > Email Templates
  2. Click Add New Template.
  3. If you want to use a default template as a starting point, in the Load default template section, choose the template and click Load Template. The path to the configuration settings for each default template displays in the Currently Used For field in the Template Information section.
    Make note of this path because you will need it later when you configure this new template to be used instead of the default template.

  4. In Template Name, enter a name to identify the template in the Magento Admin.
  5. In Template Subject, add plain text to use as the Subject of the emails sent using the template you create. This field can contain system variables.
  6. Customize template content. For details, see the section on customizing content.
  7. In Template Styles, optionally add CSS styles for the template. These styles are added inside of a <style> tag in the <head> of the email. Typically, you’ll use the LESS files to make style changes to emails because some email clients don’t support styles in <style> tags.
  8. Click Save Template.
  9. Now that you have created a template, you must configure that template to be used:

    1. If you haven’t done so already, log in to the Magento Admin as an administrator.
    2. Click STORES > Settings > Configuration > SALES > Sales Emails.
    3. In the left pane, locate the section that contains the template you want to override. This is the section referenced by Currently Used For in your new template. (See step 3 earlier in this section.)
      For example, if you created a “New Order” template, the configuration section is Order as the following figure shows.
    4. Select your newly created template from the list.
    5. Click Save Config.
  • Oh, thanks for reply :) But i wanna custom email template programmatically, but as far as i know, i've to override this order_new.html. But what've i change is not working. – fudu Oct 1 '18 at 11:11
  • i give you example :- In this case the path to default email template will be – ..\vendor\magento\{module}\view\frontend\email\email_template.html. For example: ..\vendor\magento\module-sales\view\frontend\email\order_new.html. ---> php bin/magento setup:upgrade php bin/magento setup:static-content:deploy – Divyesh Oct 1 '18 at 11:18
  • i've change content in that file and run deploy already, but it doesn't change .. – fudu Oct 1 '18 at 11:23
  • have you override template in your theme folder ? – Divyesh Oct 1 '18 at 11:25
  • No, i want to test in this order_new.html first. Just to make sure this is the correct template that i need to override. – fudu Oct 1 '18 at 11:29

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.