0

I'm designing template from

"Magento_Sales/templates/email/order_update/statusinfo_guest.phtml"

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

{{trans "%order_status" order_status=$order.getFrontendStatusLabel() |raw}}

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

and i called in backend like

 {{block class='Magento\\Framework\\View\\Element\\Template' area='frontend' template='Magento_Sales::email/order_update/statusinfo_guest.phtml'  order=$order}} 

When i change sales order status i'm getting email like enter image description here

What i do wrong? Please let me know

2 Answers 2

3

you can call .phtml for email template by doing this: first you have to load .phtml file into html file with following script

{{block class='Magento\\Framework\\View\\Element\\Template' area='adminhtml' template='Vendor_Modulename::email/xyz.phtml'}}

Note: Please don't forget to pass correct file path inside template(template='Vendor_Modulename::email/xyz.phtml').

2
  • i used a correct file path, so only i'm getting email like same as in my .phtml file.
    – Priya
    Jul 8, 2019 at 12:32
  • @mohana Ok then it might be other issue. Jul 8, 2019 at 12:36
0

etc/email_templates.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Email/etc/email_templates.xsd">
    <template id="statusinfo_guest" label="Email Form" file="statusinfo_guest.html" type="html" module="Vendor_Module" area="frontend"/>

</config>

write this code in

view/frontend/email/statusinfo_guest.html

Note: remember file type is "html"

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

    {{trans "%order_status" order_status=$order.getFrontendStatusLabel() |raw}}

    {{layout handle="email_sample_layout" order=$order area="frontend"}}

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

now add layout file "email_sample_layout.xml" in view/frontend/layout and add below code in it

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Email Product List" design_abstraction="custom">

    <body>
        <block class="Magento\Framework\View\Element\Template" name="status_info" template="Magento_Sales::email/order_update/statusinfo_guest.phtml"/>
    </body>
</page>

Now write what you want to show in your phtml file "statusinfo_guest.phtml"

Hope it works.

12
  • No, it's not working again i'm getting same "prntscr.com/oc3ul6"
    – Priya
    Jul 8, 2019 at 12:42
  • could you please share the screenshot of your template file
    – ASQ
    Jul 8, 2019 at 12:46
  • Actually i like to use more content, but i tested for with few sample prntscr.com/oc3zar
    – Priya
    Jul 8, 2019 at 12:48
  • actually, you are writing code in the wrong file, see my updated answer
    – ASQ
    Jul 8, 2019 at 12:52
  • "view/frontend/email/statusinfo_guest.html" or else "view/frontend/email/order_update/statusinfo_guest.html"
    – Priya
    Jul 8, 2019 at 12:56

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.