Question

I have create one module for my custom use. now i want to list the mail template in store config in magento 2. i have try some code but its not working for me.

 <field id="pickup_template" translate="label comment" type="select" sortOrder="3" showInDefault="2" showInWebsite="0" showInStore="0">
    <label>mail template</label>
    <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment>
    <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model>
 </field>

With above code i have no luck to display mail template in store config.

Was it helpful?

Solution

Create system.xml file in following path (Naming convention is as per youer module)

app/code/Vendor/module/etc/adminhtml/system.xml

<?xml version="1.0"?>
  <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Magento/Config/etc/system_file.xsd">
      <system> 
         <tab id="jute" translate="label" sortOrder="11">
         <label>Jute</label> </tab>
            <section id="jute_ecommerce" translate="label" type="text" sortOrder="22" showInDefault="1" showInWebsite="1" showInStore="1">
            <label>Tab 1</label> <tab>jute</tab>
            <resource>Jute_Ecommerce::jute_ecommerce</resource>
            <group id="email" translate="label" type="select" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="1">
              <label>Show All the Email template</label>
              <field id="show_email_template" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                 <label>Show all the Email template</label>
                 <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model>
              </field>
            </group>
           </section> 
</system></config>

You can use this code to create config Reference

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top