且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Magento:自定义模块中的多个默认事务电子邮件

更新时间:2023-11-29 22:50:22

无效的电子邮件代码。
这意味着你没有指定要使用哪个模板。
您必须在config.xml中定义它:

 < default> 
< reservation>
< senderinfo>
< trans_email_id> reservation_senderinfo_trans_email_id< / trans_email_id>
< confirm_email> reservation_senderinfo_confirm_email< / confirm_email>
< reject_email> reservation_senderinfo_reject_email< / reject_email>
< senderinfo>
< / reservation>
< / default>


HI I am trying to make a transactional email for my custom module. My module needs to have three default emails.One to notify the reservation request is sent for moderation and two others for sucess and failure. When i tried to send the email for reservation request it is sent sucess fully but when i tried to do it for sucess or failure it showed me following error: Invalid transactional email code: Array

here is mysource code for config.xml

<global><template>
        <email>
            <reservation_senderinfo_trans_email_id translate="label" module="reservation">
            <label>Store Reservation</label>
            <file>vantage/reservation/store_reservation.html</file>
            <type>html</type>
            </reservation_senderinfo_trans_email_id>
            <reservation_senderinfo_confirm_email translate="label"  module="reservation">
            <label>Store Reservation sucess</label>
            <file>vantage/reservation/success.html</file>
            <type>html</type>
            </reservation_senderinfo_confirm_email>
            <reservation_senderinfo_reject_email translate="label"  module="reservation">
            <label>Store Reservation Reject</label>
            <file>vantage/reservation/reject.html</file>
            <type>html</type>
            </reservation_senderinfo_reject_email>
        </email>
    </template><global>

And Here is my system.xml file

  <?xml version="1.0"?>
<config>

  <sections>
    <reservation translate="label" module="reservation">
      <class>separator-top</class>
      <label>Reservation</label>
      <tab>vantage</tab>
      <frontend_type>text</frontend_type>
      <sort_order>300</sort_order>
      <show_in_default>1</show_in_default>
      <show_in_website>1</show_in_website>
      <show_in_store>1</show_in_store>
      <groups>
        <senderinfo translate="label">
          <label>Sender Information</label>
          <frontend_type>text</frontend_type>
          <sort_order>1</sort_order>
          <show_in_default>1</show_in_default>
          <show_in_website>1</show_in_website>
          <show_in_store>1</show_in_store>
           <fields>
                <sender_name translate="label">
                    <label>Name</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>1</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                </sender_name>
                <email_add translate="label">
                    <label>Email Address</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>2</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                </email_add>
                <trans_email_id translate="label">              
                    <label>Reservation Template</label>
                    <frontend_type>select</frontend_type>
                    <source_model>adminhtml/system_config_source_email_template</source_model>
                    <sort_order>30</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>                    
                </trans_email_id>
                <confirm_email translate="label">               
                    <label>Confirmation Template</label>
                    <frontend_type>select</frontend_type>
                    <source_model>adminhtml/system_config_source_email_template</source_model>
                    <sort_order>30</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>                    
                </confirm_email>
                <reject_email translate="label">                
                    <label>Reject Template</label>
                    <frontend_type>select</frontend_type>
                    <source_model>adminhtml/system_config_source_email_template</source_model>
                    <sort_order>30</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>                    
                </reject_email>
                        <trans_email_bcc translate="label">
                    <label>BCC</label>
                    <frontend_type>text</frontend_type>
                    <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>
                </trans_email_bcc>
                <trans_email_cc translate="label">
                    <label>CC</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>3</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                </trans_email_cc>

              </fields>
        </senderinfo>   
      </groups>
    </reservation>
  </sections>
</config>

Any help will be appreciated

Invalid transactional email code. It means you haven't specify which template you're going to use. You have to define it in your config.xml:

<default>
    <reservation>
        <senderinfo>
            <trans_email_id>reservation_senderinfo_trans_email_id</trans_email_id>
            <confirm_email>reservation_senderinfo_confirm_email</confirm_email>
            <reject_email>reservation_senderinfo_reject_email</reject_email>
        <senderinfo>
    </reservation>
</default>