如何在 magento 中添加 post var 作为模板标签的参数?
在模板 account_new_confirmation 中,这是用户创建新帐户后收到的确认邮件的模板,我需要在标签内添加一个参数,
{{store url="customer/account/confirm/" _query_id=$customer.id _query_key=$customer.confirmation _query_back_url=$back_url _query_myparam="TEST"}}
该参数适用于生成以下链接的字符串,该链接将写入确认邮件中:预期:
http://baseurl/customer/account/confirm/?id=12345&key=donkey&back_url=monkey&myparam=TEST
但我不知道如何用请求帖子中的参数值替换字符串 TEST。
我的意思是用户在填写通过 POST 操作发送的表单后到达这一点。在此表单中,我有一个名为 FOO 的复选框,我需要将其值(true 或 false)添加到上面示例中的 _query_myparam。
我尝试过使用
_query_param=$foo
和使用
_query_param=$this->getRequest()->getPost('foo')
,但它们都太容易工作了。
有人知道如何解决这个问题吗?
Inside the template account_new_confirmation, which is the template of the confirmation mail the user receives after he creates a new account, I need to add a param inside the tag
{{store url="customer/account/confirm/" _query_id=$customer.id _query_key=$customer.confirmation _query_back_url=$back_url _query_myparam="TEST"}}
this is working for a string producing the following link to be written inside the confirmation mail as expected:
http://baseurl/customer/account/confirm/?id=12345&key=donkey&back_url=monkey&myparam=TEST
but I cannot figure out how to replace the string TEST with the value of a param I have in request post.
I mean the user reach this point after having filled a form sent with POST action. Inside this form I have a checkbox named FOO and I need to add its value (true or false) to _query_myparam on my example above.
I tried with
_query_param=$foo
and with
_query_param=$this->getRequest()->getPost('foo')
but they both were too easy to work.
Anyone knows how to solve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我自己发现了它:D
您必须更改类
Mage_Customer_Model_Customer
的方法sendNewAccountEmail
,您可以在app/code/core/Mage/中找到它Customer/Model/Customer.php
您需要在模板内添加可用的新变量:
因此,根据您的需要,这将被更改为:
然后您可以将此变量添加到模板参数中,因为
这将产生以下链接:
当选中复选框 FOO 时。
谢谢
I found it myself :D
You have to change the method
sendNewAccountEmail
of the classMage_Customer_Model_Customer
which you can find inapp/code/core/Mage/Customer/Model/Customer.php
You need to add new variables available inside the template inside:
So for your need this would be changed in:
Then you can add this variable to the template param as
This will produce the following link:
when checkbox FOO is checked.
Thanks