Custom forms in Magento(Magento 中的自定义表单)
问题描述
任何人都可以提供有关如何在 Magento 中创建将数据发布到控制器操作的前端表单的虚拟指南代码片段.
我正在尝试编写与我们联系的变体.(我知道修改联系我们表格很容易,如此处所述).我还尝试创建一个包含其他字段的反馈表单.
给定这个基本形式:
<form action="<?php echo $this->getFormAction(); ?>"id="feedbackForm" method="post"><div class="input-box"><label for="name"><?php echo Mage::helper('contacts')->__('Name') ?><span class="required">*</span></label><br/><input name="name" id="name" title="<?php echo Mage::helper('contacts')->__('Name') ?>"value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserName()) ?>"class="required-entry input-text" type="text"/><div class="button-set"><p class="required"><?php echo Mage::helper('contacts')->__('*必填字段') ?></p><button class="form-button" type="submit"><span><?php echo Mage::helper('contacts')->__('Submit') ?></跨度></button>
</表单>
将输入的名称输入到控制器操作进行处理需要采取哪些基本步骤?
如果有人感兴趣,我通过构建自己的模块解决了这个问题,该模块很大程度上基于 Magento_Contacts
模块.
这里有一些帮助我解决问题的链接.
http://www.magentocommerce.com/wiki/custom_module_with_custom_database_table
http://inchoo.net/ecommerce/magento/magento-custom-电子邮件/
Can anyone provide a dummy guide code snippets on how to create a front end form in Magento that posts data to a controller action.
Im trying to write a variant of the contact us from. (I know its easy to modify the contact us form, as outlined here). I'm trying to also create a feedback form with additional fields.
Given this basic form:
<form action="<?php echo $this->getFormAction(); ?>" id="feedbackForm" method="post">
<div class="input-box">
<label for="name"><?php echo Mage::helper('contacts')->__('Name') ?> <span class="required">*</span></label><br />
<input name="name" id="name" title="<?php echo Mage::helper('contacts')->__('Name') ?>" value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserName()) ?>" class="required-entry input-text" type="text" />
</div>
<div class="button-set">
<p class="required"><?php echo Mage::helper('contacts')->__('* Required Fields') ?></p>
<button class="form-button" type="submit"><span><?php echo Mage::helper('contacts')->__('Submit') ?></span></button>
</div>
</form>
What are the basic step I need to take to get inputted name to a controller action for processing?
If any one is interested, I solved this by building my own module which was heavily based on the Magento_Contacts
module.
Here are some links that helped me figure things out.
http://www.magentocommerce.com/wiki/custom_module_with_custom_database_table
http://inchoo.net/ecommerce/magento/magento-custom-emails/
这篇关于Magento 中的自定义表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Magento 中的自定义表单
基础教程推荐
- Doctrine 2 - 在多对多关系中记录更改 2022-01-01
- 找不到类“AppHttpControllersDB",我也无法使用新模型 2022-01-01
- 如何在 XAMPP 上启用 mysqli? 2021-01-01
- phpmyadmin 错误“#1062 - 密钥 1 的重复条目‘1’" 2022-01-01
- PHP 守护进程/worker 环境 2022-01-01
- 使用 PDO 转义列名 2021-01-01
- HTTP 与 FTP 上传 2021-01-01
- 在 CakePHP 2.0 中使用 Html Helper 时未定义的变量 2021-01-01
- 如何在 Symfony 和 Doctrine 中实现多对多和一对多? 2022-01-01
- 在 yii2 中迁移时出现异常“找不到驱动程序" 2022-01-01