Magento创建自定义的职业表格,并从CMS页面调用
Magento create custom career form and call from CMS page
如何创建自定义表单并从中调用职业cms页面?目前我正在创建一个cms职业页面和一个核心模板文件,并用调用它
{{block type="core/template" name="careerform" template="careerform/career_form.phtml"}}
我打电话很好,我的career_form
是
<form action="<?php echo $this->getUrl('contacts/index/post'); ?>" id="contactForm" method="post" name="contact_form">
<div class="fieldset">
<h2 class="legend"><?php echo Mage::helper('contacts')->__('Contact Information') ?></h2>
<ul class="form-list">
<li class="fields">
<div class="field">
<label for="name" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Name') ?></label>
<div class="input-box">
<input name="name" id="name" title="<?php echo Mage::helper('contacts')->__('Name') ?>" value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserName()) ?>" class="input-text required-entry" type="text" />
</div>
</div>
<div class="field">
<label for="telephone"><?php echo Mage::helper('contacts')->__('Phone') ?></label>
<div class="input-box">
<input name="telephone" id="telephone" title="<?php echo Mage::helper('contacts')->__('Phone') ?>" value="" class="input-text" type="text" />
</div>
</div>
<div class="field">
<label for="email" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Email') ?></label>
<div class="input-box">
<input name="email" id="email" title="<?php echo Mage::helper('contacts')->__('Email') ?>" value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserEmail()) ?>" class="input-text required-entry validate-email" type="text" />
</div>
</div>
</li>
<li class="wide">
<label for="comment" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Your Details') ?></label>
<div class="input-box">
<textarea name="comment" id="comment" title="<?php echo Mage::helper('contacts')->__('Your Details') ?>" class="required-entry input-text" cols="5" rows="3"></textarea>
</div>
</li>
<li>
<label for="subject"><?php echo Mage::helper('contacts')->__('Which store?') ?> <span class="required">*</span></label>
<div class="input-box"><input name="subject" id="subject" title="<?php echo Mage::helper('contacts')->__('Which store? ') ?>" value="" class="required-entry input-text" type="text"/>
</div>
</li>
</ul>
</div>
<div class="buttons-set">
<p class="required"><?php echo Mage::helper('contacts')->__('* Required Fields') ?></p>
<input type="text" name="hideit" id="hideit" value="" style="display:none !important;" />
<button type="submit" title="<?php echo Mage::helper('contacts')->__('Submit') ?>" class="button"><span><span><?php echo Mage::helper('contacts')->__('Submit') ?></span></span></button>
</div>
</form>
<script type="text/javascript">
//<![CDATA[
var contactForm = new VarienForm('contactForm', true);
//]]>
</script>
问题是这是重定向到联系我们页面我想问,有人知道如何实现职业形式吗?感谢
您已经正确分配了显示carrer表单的文件,即career_form.phtml。现在您只需要在此文件中创建简单的HTML表单,其中包含所需的字段。
<form action="<?php echo $this->getUrl(''); ?>" id="carrer" method="post" name="carrer_form">
// Add the fields according to your requirement.
</form>
以上是创建表单后您需要更改表单的操作的表单。在以前的表单中,即联系表单中,表单的操作指向
<?php echo $this->getUrl('contacts/index/post'); ?>
这提供了url
www.your_domain.com/index.php/contacts/index/post
这是处理从表单发送的信息的模块/控制器/操作的位置。您应该根据控制器的操作进行更改。
希望这会有所帮助。
最后创建了一个模块,并创建了控制器操作,从phtml文件中获取所有post值,使用magento-mail函数发送邮件。
感谢
相关文章:
- 使用ASP.NET将谷歌地图添加到项目中,并从数据库中检索位置
- 使用javascript提交表单并从字段/单选框/复选框/文本区域获取数据
- Magento创建自定义的职业表格,并从CMS页面调用
- 如何将数据传递给 jsp 并从 servlet 在新窗口中打开它
- JavaScript:在XML中搜索节点并从该节点获取数组
- Jquery 停止提交并从表单中获取数据
- 动态插入并从数组中检索键值对 - Javascript
- JavaScript-在数组中查找元素,并从用户提示中处理null
- 获取文件并从rest api下载
- 提交youtube播放列表id并从id加载播放列表
- 设置会话变量并从Jquery更改页面
- 在jquery中使用.split并从数组中提取第一个项
- Javascript不起作用,但当放置断点并从chrome调试器工具中单击文件时,它可以正常工作
- 如何访问Bokeh's数据并从外部触发前端上的事件
- 有效地串行化(并从nodejs读取)int数组
- 移动|克隆元素并从原始位置移除
- 如何调用父窗口的函数sb(frm)并从子窗口传递父窗体
- 如何在另一个页面中查找元素,并从当前页面上的元素中输入值
- 最佳实现:将图像文件上传到数据库,并从数据库中读取图像
- 查找任何未定义的变量并从url字符串中隐藏