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="Jmx0Oz9waHAgZWNobyBNYWdlOjpoZWxwZXIo"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="Jmx0Oz9waHAgZWNobyBNYWdlOjpoZWxwZXIo"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 中的自定义表单


- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- PHP - if 语句中的倒序 2021-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01