devdocs icon indicating copy to clipboard operation
devdocs copied to clipboard

Information missing - How to include custom template from theme?

Open Eddcapone opened this issue 4 years ago • 5 comments

General issue

Description:

https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/templates/template-email.html

I have a custom template in THEME/Magento_Email/email/usp_block.html

How can I include it in another template?

I tried it with {{template config_path="design/email/usp_block_template"}} and {{template config_path="design/email/usp_block"}} but it says Email template '' is not defined.

Please add the missing information. Thx.

Possible solutions:

Additional information:

Eddcapone avatar Mar 15 '21 09:03 Eddcapone

Hi @Eddcapone. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


m2-assistant[bot] avatar Mar 15 '21 09:03 m2-assistant[bot]

Easy way Maybe you don't have to do that (include external template). Include block in your email I think the suitable way is create custom template email and call it inside admin. Modify later and add your content you want. Add content, variables.v.v

<PATH> equals the XPATH to the system configuration value that contains the value of the template.

Here is where magento define template config.xml https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Email/etc/config.xml#L12

define template email https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Email/etc/email_templates.xml#L9

So make sure you have define custom template in THEME/Magento_Email/email/usp_block.html in xml file email_templates.xml too

Screenshot from 2021-03-25 09-31-12

Then in your template just try to call block template {{template config_path="your/path/usp_block"}}

mrtuvn avatar Mar 22 '21 06:03 mrtuvn

@Eddcapone What do you think of the suggestion from @mrtuvn ?

dobooth avatar Jun 02 '21 17:06 dobooth

I don't have the time to try it out at the moment unfortunatelly. I will report back asap. Thx!

Eddcapone avatar Jun 07 '21 07:06 Eddcapone

@Eddcapone Is this still an issue? If you still need assistance, please create a ticket in the new repo: https://github.com/AdobeDocs/commerce-frontend-core/pulls

This page is now located at: https://developer.adobe.com/commerce/frontend-core/guide/templates/email/

jhadobe avatar Oct 27 '22 13:10 jhadobe