在我的opencart模板中,我需要创建一个类似于联系表单的表单,其中包含姓名,电子邮件和手机号码.我已经在我的联系我们页面中使用了默认的联系我们表单.我需要创建这个新表单另一页的表单.是否有免费的扩展名?否则我们如何实现自己的表单?
In my opencart template i need to create a form which is similar to contact form with the fields Name,Email and Mobile number.I have already used the default contact us form in my contact us page.I need to create this new form for another page.Is there any free extension available?Or else how can we implement our own form?
推荐答案我不会推荐任何扩展名(这不是这样做的地方),但是我可以告诉您一些与联系人重复的步骤.
I am not going to recommend any extension (this is not the place to do so) but i can tell you some steps duplicate the contact from.
首先,您需要在各自的目录中复制三个文件
First you need to duplicate three files in their respective directories
并将其命名为form.php,form.tpl,form.php
此后的所有更改将仅在这些文件上执行
All changes after this point will be performed on these files only
现在将您的控制器类名称更改为ControllerInformationForm 除此之外,您还必须在控制器文件中编辑一些内容,例如将contact.tpl更改为form.tpl,使用$this->language->load('information/form');
now change you controller class name to ControllerInformationForm other than this you will have to edit several things in controller file like change contact.tpl to form.tpl , load correct language file using $this->language->load('information/form');
对控制器文件进行必要的更改后,可以使用website/index.php?route=information/form
after making necessary changes to controller file, your new form can be accessed using website/index.php?route=information/form
现在为其他字段添加一个现有字段,如name,并使用新字段在这3个文件中完成name的所有操作
now for additional field take one existing field like name and do all things which are done for name in these 3 files with your new field
注意不要为您执行$mail->setSender($this->request->post['name']);新字段(与其他字段不同)
Note don't do $mail->setSender($this->request->post['name']); for you new field its different
现在在tpl中让您在tpl中有这样的新字段
now lets in tpl you have new field in tpl like this
<input type="text" name="city" value="<?php echo $city; ?>" />然后在控制器中更改以下行
then in your controller change following line
$mail->setText(strip_tags(html_entity_decode($this->request->post['enquiry'], ENT_QUOTES, 'UTF-8')));到
$mail->setText(strip_tags(html_entity_decode($this->request->post['enquiry'] . " " . $this->request->post['city'], ENT_QUOTES, 'UTF-8')));免责声明:这不是一整套说明,但这足以让您开始并提出更好的问题,如果您遇到任何问题
Disclaimer : This not a full set of instruction but this is enough for you to start and to ask better question if you face any problem
更多推荐
如何为默认的opencart创建副本与其他字段联系我们表格
发布评论