1

In module i have a custom email template.

my code in config.xml

<template>
            <email>
                <general_notification translate="label" module="example">
                    <label>Notifications</label>
                    <file>notification.html</file>
                    <type>html</type>
                </general_notification>

            </email>
        </template>

Using this code i will get template name in system config

system.xml

    <notification>
    <label>Notification send to admin and customer</label>
        <frontend_type>select</frontend_type>


        <source_model>example/email_notification</source_model>
            <sort_order>90</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>

    </notification>

In model

class NameSpace_Example_Model_Email_Notification
{
    protected $_options;

    public function toOptionArray(){
        return array(
            array('value' => '', 'label'=>Mage::helper('example')->__('Do not send')),
            array('value' => 'general_notification', 'label'=>Mage::helper('example')->__('New Notification(default template from locale)')),
        );
    }
}

Now In System > Transaction Email I m add New template and save that template So now i want this Email template name in system configuration how to get that please help me

1 Answer 1

2

Once you created email template you can get with below default code of magento source model

    <notification>
                <label>Select Email Template </label>
                <comment>It is advisable to create a new email template for this purpose and then select it in this configuration. Make sure you add review URL in your template. For e.g., {{ReviewURL}} <![CDATA[ <br /><span style="color:#FFA500">NOTE:- Default template from locale should not be used. Make sure you add product Name in your template. For e.g., {{ProductName}} You can also use other variables like OrderNumber {{OrderNumber}}</span>]]></comment>
                <frontend_type>select</frontend_type>
                <backend_model>mcautoreviewreminderemail/Mcautoreviewreminderemailtemplate</backend_model>
                <source_model>adminhtml/system_config_source_email_template</source_model>
                <sort_order>4</sort_order>
                <show_in_default>1</show_in_default>
                <show_in_website>1</show_in_website>
                <show_in_store>1</show_in_store>
                <can_be_empty>1</can_be_empty>
   <notification>

i am sure it will work for you.

7
  • In backend_model what is 'mcautoreviewreminderemail' this. can you explain me? what should i write here?
    – ND17
    Commented Apr 15, 2015 at 11:36
  • you can ignore this, it was only for validation purpose for my used
    – liyakat
    Commented Apr 15, 2015 at 11:39
  • Using this source model i can get template name but email is empty there is no content display
    – ND17
    Commented Apr 15, 2015 at 11:41
  • email ? this source model will generate dropdown for available template insystem
    – liyakat
    Commented Apr 15, 2015 at 11:45
  • you want Email template name in system configuration. thats given by above code.
    – liyakat
    Commented Apr 15, 2015 at 11:46

Your Answer

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

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