Magento电子邮件模板:从adminhtml呈现的块 [英] Magento Email Templates: Blocks not rendering from adminhtml

查看:222
本文介绍了Magento电子邮件模板:从adminhtml呈现的块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我害怕我已经陷入未知的Magento地区。我已经用尽了我的谷歌技能剩下的东西,而且已经很少了,所以我以为我会在这里试试我的运气。



我们的平台是Magento Enterprise 1.9.1.1。



我们使用通过ODBC读取订单的古老打印解决方案。因此,我们不能直接从Magento的MySQL数据库中读取(由于变更的可能性很高)。我所做的是扩展Mage_Sales_Model_Order以在返回parent :: _ beforeSave()之前拦截直接SQL查询到另一个数据库的_beforeSave()函数。可能有更好的方法来做到这一点,但是现在已经完成了功能,而不管我的问题在哪里。



如果抛出任何SQL错误,更新回滚,错误&订单数据被传递到发送电子邮件到具有错误信息的邮件列表的功能。电子邮件模板文件在/ locale / en_US / template / email /中调用.phtml文件来处理数据数组,如下所示:

  {{block type ='core / template'area ='frontend'template ='/ email / errors / order / beforesave.phtml'orderdata = $ orderdata errors = $ errors}} 

这是从/locale/en_US/template/email/sales/shipment_new.phtml借来的​​功能。这也是我打我路障的地方。如果用户正在处理订单时遇到错误,则电子邮件将从前端发送。如果您从adminhtml进行订单更改,则发送电子邮件,但没有上述阻止。



我在块调用中尝试使用和没有area ='frontend' ,而且脚本表现出相同的行为。



我认为这个问题可能在我的XML中,虽然它发现模板本身就从admin和frontend都很好并且此块不需要在我的XML中定义)。我也不能在Magento自己的文件或互联网上的任何地方找到任何这样的例子。



任何帮助都将不胜感激。这是我的头!




  • Mike


解决方案

可能重复的在magento中的前端和后端(admin或adminhtml)之间共享模板



不要重启一个死亡的问题;只是结束了松散的结局。



@ColinM:我的想法和你的想法是一样的,但是某种方式对我来说并不奏效。也许我不明白setDesignConfig()的目的。无论如何,上面的链接在与原始海报相同的情况下对我来说完美。


I fear I've stumbled into unknown Magento territory. I have exhausted what's left of my Googling abilities and have come up short, so I thought I'd try my luck here.

Our platform is Magento Enterprise 1.9.1.1.

We use an archaic print solution that reads orders via ODBC. As such, we can't have it read from Magento's MySQL database directly (thanks to the high likelihood of change). What I've done is extend Mage_Sales_Model_Order to intercept the _beforeSave() function with direct SQL queries to another database, before returning parent::_beforeSave(). There are likely better ways to have done this, but it's done now, and functional, and regardless it is not where my problem lies.

If any SQL errors are thrown, updates are rolled back and the errors & order data are passed to a function that sends an email to a mailing list with the error information. The email template file in /locale/en_US/template/email/ calls on a .phtml file to process the arrays of data like so:

{{block type='core/template' area='frontend' template='/email/errors/order/beforesave.phtml' orderdata=$orderdata errors=$errors}} 

This is functionality I borrowed from /locale/en_US/template/email/sales/shipment_new.phtml. And this is also where I hit my roadblock. The email fires fine from the front end, if errors are encountered when the user is processing an order. If you make order changes from adminhtml, the email is sent, but without the above mentioned block.

I have tried with and without area='frontend' in the block call, and the script exhibits the same behaviour regardless.

I think that the problem may be in my XML, though it finds the template itself just fine from both admin and frontend (and this block is not required to be defined in my XML anywhere). I can also not find any examples of this within Magento's own files, or anywhere on the internet.

Any help would be more than greatly appreciated. This is doing my head in!

  • Mike

解决方案

Possible duplicate of sharing template between frontend and backend (admin or adminhtml) in magento.

Don't mean to revive a dead question; just tying up the loose end.

@ColinM: My thoughts were the same as yours, but that somehow didn't work for me. Maybe I don't understand the purpose of setDesignConfig(). Anyhow, the link above worked perfectly for me, in the same scenario as that of the original poster.

这篇关于Magento电子邮件模板:从adminhtml呈现的块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆