繁体   English   中英

Magento交易电子邮件模板

[英]Magento Transactional Email Template

我目前正在最后确定一个定制控制器以接受Ajax请求报价形式的过程。 我已经能够成功设置所有内容,并且发送正确。 我的问题与将交易电子邮件模板从CMS链接到我设置的控制器的方法有关。

我在Magento安装的语言环境中有一个模板,并且已经能够将其加载到后端的事务电子邮件管理器中。 我如何能够获取该模板的ID并将其加载到邮件对象中? 我尝试使用简单的数字ID,但这似乎不起作用。

config.xml中

    <global>
    <template>
        <email>
            <custom_quote>
                <label>Custom Quote Form</label>
                <file>custom-quote.html</file>
                <type>html</type>
            </custom_quote>
            <trade_printer>
                <label>Trade Printer Form</label>
                <file>trade-printer.html</file>
                <type>html</type>
            </trade_printer>
        </email>
    </template>
    </global>

这是使用电子邮件模板发送电子邮件的示例代码

$emailTemplate  = Mage::getModel('core/email_template')
                        ->loadDefault('custom_quote');                                  


$emailTemplateVariables = array();
$emailTemplateVariables['myvar1'] = 'Branko';
$emailTemplateVariables['myvar2'] = 'Ajzele';
$emailTemplateVariables['myvar3'] = 'ActiveCodeline';
$processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);
$emailTemplate->send('john@someemail.com','John Doe', $emailTemplateVariables,$storeId=null);

参考

阅读了可用的方法之后,我发现loadDefault()总是会从区域设置代码库中加载模板。 使用在Transactional Email编辑器中指定的名称的loadByCode()将加载自定义模板。

最终密码

$emailTemplate = Mage::getModel('core/email_template')->loadByCode('Template Name Here');

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM