0

I am migrating my website from M1 to M2, but I need to copy the exact order email template of my M1 site to my M2 site. I tried copying the order template code from Magento 1 admin panel to Magento 2, but it didn't work.

Code for M1 order email from admin dashboard is mentioned below.

{{template config_path="design/email/header"}}
{{inlinecss file="email-inline.css"}}
<div class="email-heading">
    <p>Thank you for placing an order with {{var store.getFrontendName()}} on {{var order.getCreatedAtFormated('long')}}</p>
    <p>Your order no is <span class="no-link">#{{var order.increment_id}}</span>.</p>

        {{block type='core/template' area='frontend' template='myemail/orderemail.phtml' order=$order}}
        <p>Please find below your order summary.</p>
</div>
<table>   
    <tr class="order-information">
        <td>
            {{if order.getEmailCustomerNote()}}
            <table cellspacing="0" cellpadding="0" class="message-container">
                <tr>
                    <td>{{var order.getEmailCustomerNote()}}</td>
                </tr>
            </table>
            {{/if}}
            {{layout handle="sales_email_order_items" order=$order}}
            <table cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td class="address-details">
                        <h6>Bill to:</h6>
                        <p><span class="no-link">{{var order.getBillingAddress().format('html')}}</span></p>
                    </td>
                    {{depend order.getIsNotVirtual()}}
                    <td class="address-details">
                        <h6>Ship to:</h6>
                        <p><span class="no-link">{{var order.getShippingAddress().format('html')}}</span></p>
                    </td>
                    {{/depend}}
                </tr>
                <tr>
                    {{depend order.getIsNotVirtual()}}
                    <td class="method-info">
                        <h6>Shipping method:</h6>
                        <p>{{var order.shipping_description}}</p>
                    </td>
                    {{/depend}}
                    <td class="method-info">
                        <h6>Payment method:</h6>
                        {{var payment_html}}
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
<p>Trust you enjoyed shopping on KIABZA.</p>
<p>If you have any questions, please feel free to mail us at <a href="mailto:{{var store_email}}">{{var store_email}}</a> {{depend store_phone}} or contact us on phone / whatsapp at  <a href="tel:{{var phone}}">{{var store_phone}}</a>{{/depend}}  between 10 am to 7 pm, Monday to Friday and 10 am to 3 pm on Saturdays.</p>
{{template config_path="design/email/footer"}}

Code for M2 order email from admin dashboard is mentioned below.

{{template config_path="design/email/header_template"}}
{{inlinecss file="email-inline.css"}}
<div class="email-heading">
    <p>Thank you for placing an order with {{var store.getFrontendName()}} on {{var order.getCreatedAtFormated('long')}}</p>
    <p>Your order no is <span class="no-link">#{{var order.increment_id}}</span>.</p>

        {{block type='core/template' area='frontend' template='myemail/orderemail.phtml' order=$order}}
        <p>Please find below your order summary.</p>
</div>
<table>   
    <tr class="order-information">
        <td>
            {{if order.getEmailCustomerNote()}}
            <table cellspacing="0" cellpadding="0" class="message-container">
                <tr>
                    <td>{{var order.getEmailCustomerNote()}}</td>
                </tr>
            </table>
            {{/if}}
            {{layout handle="sales_email_order_items" order=$order}}
            <table cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td class="address-details">
                        <h6>Bill to:</h6>
                        <p><span class="no-link">{{var order.getBillingAddress().format('html')}}</span></p>
                    </td>
                    {{depend order.getIsNotVirtual()}}
                    <td class="address-details">
                        <h6>Ship to:</h6>
                        <p><span class="no-link">{{var order.getShippingAddress().format('html')}}</span></p>
                    </td>
                    {{/depend}}
                </tr>
                <tr>
                    {{depend order.getIsNotVirtual()}}
                    <td class="method-info">
                        <h6>Shipping method:</h6>
                        <p>{{var order.shipping_description}}</p>
                    </td>
                    {{/depend}}
                    <td class="method-info">
                        <h6>Payment method:</h6>
                        {{var payment_html}}
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
<p>Trust you enjoyed shopping on KIABZA.</p>
<p>If you have any questions, please feel free to mail us at <a href="mailto:{{var store_email}}">{{var store_email}}</a> {{depend store_phone}} or contact us on phone / whatsapp at  <a href="tel:{{var phone}}">{{var store_phone}}</a>{{/depend}}  between 10 am to 7 pm, Monday to Friday and 10 am to 3 pm on Saturdays.</p>
{{template config_path="design/email/footer_template"}}

Can anyone please guide me on how can I do this?

0

2 Answers 2

0

enter image description hereTried with your magento2 email template on luma theme and seems contents loading fine. Check your inline css and other custom variables if included any. find the screen shot. I didn't added store details, so that you can see some of the data are not fetched.

Note : Always add line by line and check with preview if you are adding/updating templates, you can find the issues and can consume the time as well.

0

With the below links, you can create and customize your email template in Magento 2.x.If you have added the phtml file in an email so you have to again specify the file with the correct path.

Email templates

Variable Reference

How to Pass Dynamic Data in Email Template

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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