Question

system.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <section id="test" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
            <label>Tender Module</label>
            <tab>general</tab>
            <resource>FM_Tender::quick</resource>
            <group id="option" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Options For RFQ</label>
                <field id="enabled" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Enable RFQ</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>                    
                </field>
                <field id="date" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Estimated Days Required To Reply</label>
                    <validate>validate-number</validate>                                         
                </field>
            </group>
            <group id="email" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Email Options</label>
                <field id="recipient" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Send Emails To</label>
                    <validate>validate-email</validate>
                </field>
                <field id="sender" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Email Sender</label>
                    <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model>
                </field>
                <field id="template" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Email 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>
            </group>
            <group id="email_reply" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Reply To Customer</label>
                    <field id="subject" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                        <label>Subject</label>
                        <comment>Enter The Subject Of The Email</comment>
                    </field>
                    <field id="body" translate="label" type="textarea" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                        <label>Message</label>
                        <comment>Enter The Body Of The Email</comment>
                    </field>
            </group>
            <group id="upload" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Upload Restrictions For RFQ</label>
                    <field id="allow" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                        <label>Allowed File Extensions Only</label>
                        <comment><![CDATA[Please Enter the extensions you allow customer to upload files with.<br/>
                         <b>Note:</b>Empty field means disable this feature<br/>
                         Please use comma's to separate  each extension (example:<b> jpg <font color=red>,</font>flv<font color=red>,</font>txt</b>)]]>                         
                        </comment>
                    </field>
            </group>
            <group id="google_options" translate="label"  type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Google Captcha Keys</label>
                <field id="captchastatus" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Enable</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>                    
                </field>

                <field id="googleprivatekey" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Google Captcha Secret Key</label>
                    <validate>required-entry</validate>  
                    <comment>Get Key From https://www.google.com/recaptcha/admin</comment>
                    <depends>
                        <field id="captchastatus">1</field>
                    </depends>
                </field>
                <field id="googlepublickey" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Google Captcha Site Key</label>
                    <validate>required-entry</validate>  
                    <comment>Get Key From https://www.google.com/recaptcha/admin</comment>
                    <depends>
                        <field id="captchastatus">1</field>
                    </depends>
                </field>
            </group>
        </section>
    </system>
</config>

email_templates.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Email:etc/email_templates.xsd">
    <template id="tender_email_template2" label="Quick Form" file="quick_form2.html" type="html" module="FM_Tender" area="frontend"/>

    <template id="tender_email_requirement2" label="Requirement Form" file="quick_requirement2.html" type="html" module="FM_Tender" area="frontend"/>


</config>

config.xml

<?xml version="1.0"?>
    <!--
    /**
     * Copyright © 2015 Magento. All rights reserved.
     * See COPYING.txt for license details.
     */
    -->
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
        <default>
            <tender>
                <option>
                    <enabled>1</enabled>
                    <date>5</date>
                </option>
                <email>
                    <recipient>
                        <![CDATA[hello@example.com]]>
                    </recipient>
                    <sender>custom2</sender>
                    <template2>tender_email_template2</template2>
                    <requirement2>tender_email_requirement2</requirement2>
                </email>

                <!--<email>-->
                    <!--<send_email>quick_requirement_template</send_email>-->
                <!--</email>-->

                <!--<email>-->
                    <!--<recipient>-->
                        <!--<![CDATA[hello@example.com]]>-->
                    <!--</recipient>-->
                    <!--<sender>custom2</sender>-->
                    <!--<template>quick_requirement_template</template>-->
                <!--</email>-->
                <email_reply>
                    <subject>Quick RFQ</subject>
                    <body>Quote Received ...</body>
                </email_reply>
                <upload>
                    <allow>jpg,jpeg,png,gif</allow>
                </upload>
            </tender>
        </default>
    </config>

Email template 'test_email_template' is not defined in magento 2 admin

how i can solve this???

Was it helpful?

Solution

I had the same problem and its resolved by following change.

If you check your system.xml file you can find that you path for system config for email template field is test_email_template because test is the section id and email is the group id and template is the field id so basically Magento takes it as section_group_field as email template id.

You need to change the template ID in email_templates.xml from

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Email:etc/email_templates.xsd">
    <template id="tender_email_template2" label="Quick Form" file="quick_form2.html" type="html" module="FM_Tender" area="frontend"/>
    <template id="tender_email_requirement2" label="Requirement Form" file="quick_requirement2.html" type="html" module="FM_Tender" area="frontend"/>
</config>

to this:

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Email:etc/email_templates.xsd">
    <template id="test_email_template" label="Quick Form" file="quick_form2.html" type="html" module="FM_Tender" area="frontend"/>
    <template id="tender_email_requirement2" label="Requirement Form" file="quick_requirement2.html" type="html" module="FM_Tender" area="frontend"/>
</config>

OTHER TIPS

Actually i put wrong value for

XML_PATH_EMAIL_TEMPLATE 

so that that error is showing ...

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