如何为默认的opencart创建副本与其他字段联系我们表格

编程入门 行业动态 更新时间:2024-10-27 12:35:22
本文介绍了如何为默认的opencart创建副本与其他字段联系我们表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在我的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

  • catalog\language\english\information\contact.php
  • catalog\view\theme\default\template\information\contact.tpl
  • catalog\controller\information\contact.php
  • catalog\language\english\information\contact.php
  • catalog\view\theme\default\template\information\contact.tpl
  • catalog\controller\information\contact.php
  • 并将其命名为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创建副本与其他字段联系我们表格

    本文发布于:2023-11-09 16:06:24,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1572820.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:副本   字段   何为   表格   与其他

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!