Magento2 Email Templates – How to Get Dropdown in Stores Configuration

email-templatesmagento2

How to get Email Templates in stores configuration in custom Tab. Please find the below link
http://prntscr.com/fvi0og

can anyone help me on this.
thanks

Best Answer

You have to give like system.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <section id="paytrade" translate="label" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
            <group id="general" translate="label" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                <field id="paytrade_commission_template" translate="label" type="select" sortOrder="3" showInDefault="1" showInStore="1" showInWebsite="1">
                    <label>Test Tab Email Template</label>
                    <comment>Test tab email sent to xyz.</comment>        
                    <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model>
                </field>
            </group>
        </section>
    </system>
</config>

showInStore="1" is for show in storeview.

and another file at /app/code/vendor/modulename/etc/email_templates.xml have to like:

<?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Email/etc/email_templates.xsd">
    <template id="paytrade_general_paytrade_commission_template" label="Test Tab Email Template" file="test_tab_template_email.html" type="html" module="Ewall_Paytrade" area="frontend"/>
</config>

and Create email template file at like: /Ewall/Paytrade/view/frontend/email/test_tab_template_email.html

Related Topic