1

I need to get custom email template in admin system configuration.

system.xml

This is my email template field code.

<email_template>
    <label>Email Template</label>
    <show_in_default>1</show_in_default>
    <show_in_website>1</show_in_website>
    <show_in_store>1</show_in_store>
    <sort_order>5</sort_order>
    <frontend_type>select</frontend_type>
    <source_model>adminhtml/system_config_source_email_template</source_model>
</email_template>

config.xml

<template>
    <email>
    <custom_email_template translate="label" module="eztestimonial">
    <label>Custom Email Template</label>
    <file>mymodule/custom_email.html</file>
    <type>html</type>
    </custom_email_template>
    </email>
</template>
<default>
    <mymodulesettings>
      <email>
          <email_template>custom_email_template</email_template>
      </email>
    </mymodulesettings>
</default>

And i have added email.html file in locale/en_US/template/email/mymodule/ path Now i got a outut like this enter image description here

But i need to show my custom email name in that dropdown. like:enter image description here I refer AW Blog Extension for this.

1 Answer 1

5

In your config.xml you should have your template declared inside the global tag and have a label on it.

<global>
...
    <template>
        <email>
            <custom_email_template translate="label" module="eztestimonial">
                <label>Custom Email Template</label><!-- this should be shown in the config dropdown-->
                <file>mymodule/custom_email.html</file>
                <type>html</type>
            </custom_email_template>
        </email>
    </template>
...
</global>

Right now you have this outside the global tag.

[EDIT]
And in order to work, the path of your system.xml field must match the name of the template with _ instead of /. In your case custom_email_template.

So your system.xml should look like this:

<sections>
    <custom ...>
       ....
       <groups>
           <email ....>
              ...
              <template>
                  <label>Email Template</label>
                  <show_in_default>1</show_in_default>
                  <show_in_website>1</show_in_website>
                  <show_in_store>1</show_in_store>
                  <sort_order>5</sort_order>
                  <frontend_type>select</frontend_type>
                  <source_model>adminhtml/system_config_source_email_template</source_model>
              </template>
           </email>
       </groups>
    </custom>
</sections>

And the <default> tag in config.xml should be

<default>
    <custom>
      <email>
          <template>custom_email_template</template>
      </email>
    </custom> 
</default>
4
  • i give that inside the global tag,but i cant get that email template label in system configuration. Sep 23, 2013 at 11:01
  • @MeenakshiSundaramR. Did you clear the cache?
    – Marius
    Sep 23, 2013 at 11:26
  • yes,i clear the cache many time.I getting same response Sep 23, 2013 at 11:30
  • I've edited the answer. Maybe that works.
    – Marius
    Sep 23, 2013 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.