Magento - 自定义表单
我有一个表单,目前是一个简单的基于 HTML 的表单,它不执行任何操作。
不过,我想要做的是能够在提交表单后发送电子邮件并将数据保存到数据库中。
问题来了,随着电子邮件的发送。在表单中,有一个下拉菜单。菜单项是我的供应商模型/模块中的项目,其中有名称和电子邮件地址。
因此,当我选择供应商 A 时,表单通过了验证,它需要向供应商 A 发送一封电子邮件并保存详细信息(这应该不会太难)。
我只是不确定如何获得电子邮件地址。
我是否需要将某种参数传递给自定义 sendEmail() 方法?
感谢所有帮助。
谢谢
更新:
好的,所以在我做电子邮件部分之前,我想将数据存储在名为测试驱动的表中。
我已经在管理中创建了该模块,并创建了一个表单来从前端提交数据。
但我似乎无法插入数据。
欢迎所有帮助
谢谢
I have a form, which at the moment is a simple HTML based one, that doesn't do anything.
What I'm looking to do though, is to be able to send an email once the form has been submitted and also save the data to the database.
The problem comes, with the email sending. In the form, there is a drop down menu. The menu items are items in my suppliers model/module, which have a name and email address.
So, when I select Supplier A, the form passes validation, it needs to send Supplier A an email and save the details (this shouldn't be too hard).
I'm just not sure how I'd get the email address.
Would I need to pass some kind of parameter to a custom sendEmail() method?
All help appreciated.
Thanks
UPDATE:
Ok, so before I do the email part, I'd like to store the data in the table, named test drive.
I've created the module in the admin and a form to submit data from on the frontend end.
But I cannot seem to get the data to insert.
All help is welcome
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要发送电子邮件,请参阅此
Mage_Contacts_IndexController::postAction()
操作或Mage_Sales_Model_Order::sendNewOrderEmail()
如果您使用模型创建了模块,您可以获取该模型的实例,插入数据然后保存它,或者您可以创建
ResourceModel
然后执行 SQL 。For sending email see this
Mage_Contacts_IndexController::postAction()
action orMage_Sales_Model_Order::sendNewOrderEmail()
If You created module with model, you can get instance of that model, insert data and then save it or You can create
ResourceModel
and then execute SQL.