Magento创建自定义的职业表格,并从CMS页面调用

Magento create custom career form and call from CMS page

本文关键字:CMS 并从 调用 表格 自定义 创建 Magento      更新时间:2023-09-26

如何创建自定义表单并从中调用职业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函数发送邮件。

感谢