nonozone.net

冷眼旁观互联网


Magento邮件模板无法预览

Magento内置很丰富强大邮件模板功能,一般新建一个magento站点需要根据自己的需要修改模板,这个时候会经常用到模板预览的功能,如下

magento邮件模板无法预览

在System—Transactional Emails创建模板的时候右上角有个Preview Template一般点击这个按钮就可以预览当前加载的邮件模板了。但是今天在操作的时候发现有个问题,每次点击预览模板的时候总是调到管理后台首页,研究了下,发现这应该是Magento 1.6x的一个小bug,解决方法如下:

打开app/code/core/Mage/Adminhtml/Block/System/Email/Template/Preview.php编辑,找到下面的一段代码注释掉:

$template->setTemplateText(
$this->escapeHtml($template->getTemplateText())
);

完整的样子应该如下:

class Mage_Adminhtml_Block_System_Email_Template_Preview extends Mage_Adminhtml_Block_Widget
 35 {
 36
 37     protected function _toHtml()
 38     {
 39         $template = Mage::getModel('core/email_template');
 40         if($id = (int)$this->getRequest()->getParam('id')) {
 41             $template->load($id);
 42         } else {
 43             $template->setTemplateType($this->getRequest()->getParam('type'));
 44             $template->setTemplateText($this->getRequest()->getParam('text'));
 45             $template->setTemplateStyles($this->getRequest()->getParam('styles'));
 46         }
 47 //        $template->setTemplateText(
 48 //            $this->escapeHtml($template->getTemplateText())
 49 //        );
 50 //
 51         Varien_Profiler::start("email_template_proccessing");
 52         $vars = array();
 53
 54         $templateProcessed = $template->getProcessedTemplate($vars, true);
 55
 56         if($template->isPlain()) {
 57             $templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>";
 58         }
 59
 60         Varien_Profiler::stop("email_template_proccessing");
 61
 62         return $templateProcessed;
 63     }
 64
 65 }
                   

这样就没问题了。

Related Posts

  • Magento常用SQL语句实用篇 (0)
    如果网站更换域名或base_url网址后,导致本地测试打不开网站,可以执行以下语句设为默认值{{base_url}} //网站默认URL UPDATE […]
  • 如何删除Magento页脚链接 (0)
    在安装好Magento之后,页脚会有两部分链接需要修改如图: 上面的一行About us和Customer […]
  • Magento侧栏显示产品分类方法 (0)
    这篇文章主要是介绍如何在Magento侧栏包括首页侧栏显示产品分类的方法。在安装好Magento以后,一般除了在网站导航栏显示产品分类以外,我们常用的方法是直接在首页侧栏显示产品 […]
  • 批量删除Magento所有产品和分类 (0)
    最近在研究Magento,就把一些经常需要的操作记录下来做个笔记。 虽然Mageno后台也有这个功能,依次进入后台Catalog//Manage Products […]
  • 跳槽,你准备好了吗? (4)
    你想跳槽吗?或者正坐在office抱怨公司这里不好,哪里不对,管理层过得悠哉悠哉,对创造利润的一线团队却支持甚少?或者公司总是有这样或者那样的培训,天天开会却又感觉没啥用?或者公 […]


Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha Code