- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要知道如何自定义我的联系方式和注册表单。如何添加新字段(和)并使这些字段中的信息为必填或不需要。
我需要知道我必须为这些表单编辑哪些文件...
我使用 prestashop 1.4.7.0
最佳答案
这实际上是两个独立的问题,因为您处理每种情况的方式存在重大差异。
答案 1
对于注册表单,您可以编写一个包含两个钩子(Hook)处理函数的模块。这些将是:
public function hookCreateAccountForm() {}
public function hookCreateAccount($params) {}
authentication.tpl
,尽管您可以将它们作为一个单独的组移动到其他地方)。它应该只返回您需要的附加表单 html。
AuthController
以在
preProcess()
成员函数中执行您自己的身份验证)。在我自己的网站自定义模块之一中,我有以下内容,例如:
public function hookCreateAccount($params)
{
$id_lang = (int)Configuration::get('PS_LANG_DEFAULT');
$customer = $params['newCustomer'];
$address = new Address(Address::getFirstCustomerAddressId((int)$customer->id));
$membership_number = $params['_POST']['membership_number'];
....
....
}
$params['newCustomer']
是数组中的标准 Prestashop 元素,包含新创建的客户对象。您的字段将位于
$params['_POST']
数组 - 在我的例子中,它是一个名为
membership_number
的输入字段.
contact-form.tpl
中硬编码您的附加字段。 .
ContactController.php
的文件来为 Controller 创建覆盖。在
/<web-root>/<your-optional-ps-folder>/override/controller
包含类似的东西:
<?php
class ContactController extends ContactControllerCore {
function preProcess()
{
if (Tools::isSubmit('submitMessage'))
{
// The form has been submitted so your field validation code goes in here.
// Get the entered values for your fields using Tools::getValue('<field-name>')
// Flag errors by adding a message to $this->errors e.g.
$this->errors[] = Tools::displayError('I haven't even bothered to check!');
}
parent::preProcess();
if (Tools::isSubmit('submitMessage') && is_empty($this->errors))
{
// Success so now perform any addition required actions
// Note that the only indication of success is that $this->errors is empty
}
}
}
controllers\ContactController
复制整个 preProcess 函数。然后破解它,直到它完成你想要的......
关于forms - 如何在 PrestaShop 中自定义注册表和联系表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10320382/
我想使用位于 prestashop 文件夹外但仍在同一服务器上的 php 脚本 (external_script.php) 中的 prestashop 应用程序。 我可以使用 Magento 做到这一
我是 PrestaShop 的新手。我遇到了一个问题,无法在 PrestaShop 从库存中减去商品的代码中找到。 当客户创建订单并选择付款时,商品将从库存中减去,但如果客户不付款并返回,则商品不会退
我正在开发一个必须列出现有产品列表的 prestashop 模块。 对于模块的配置面板,使用 renderForm() 和 getContent(),我试图复制“附件”功能,从这里开始编写输入产品的一
Closed. This question needs to be more focused。它当前不接受答案。 想改善这个问题吗?更新问题,使其仅通过editing this post专注于一个问题
没有模块安装线路UPS,但仍然出现错误。 错误: **发现错误:CData 部分未完成 UPS 模块可以通过 must_have_module_list.xml 文件中的 UPS Ge 处理运输。 发
我创建了一个名为“blockallproducts”的模块,它也在主页和分页中显示所有产品。但是如何将 paginaton 页面值的值传递给模块?或者我需要再创建一个 Controller 吗?任何人
这是我的代码。文件 mymodule.php: class Mymodule extends Module { public function __construct() {
我正在为 prestashop 开发一个非常简单的(对于新手用户)后端,我想知道在哪里可以找到上传的产品图片名称.. 我知道它们在“img/p”目录中。但我不知道: 1.它们在哪个数据库表中..链接
我试图在 prestashop 中有一个静态页面作为主页。我能想到的唯一方法是创建一个新页面(即shop.php),然后将主页中当前 Hook 的模型 Hook 到新的shop.php。 我试着关注这
function get_user_id() { global $cookie; $userid = NULL; if (isset($cookie->id_customer)
我已将我的 prestashop 1.5.6 电子商务站点迁移到新服务器, 我所做的过程只是将文件上传到新服务器并导入数据库。 我清理了 Cache/smarty/compile 和 Cache/sm
我想在 prestashop 模块中显示一个表单,并想将该值存储在数据库中。这怎么可能??有prestashop专家吗?? 最佳答案 您可以使用自定义 HTML block 并在其中添加您的表单代码。
我想更改订单确认电子邮件模板的内容,前提是已订购了特定产品。有什么解决办法吗? 最佳答案 您可以在mails/language/order_conf.(html/txt)中找到电子邮件订单确认的通用模
我想在 prestashop 模块中显示一个表单,并想将该值存储在数据库中。这怎么可能??有prestashop专家吗?? 最佳答案 您可以使用自定义 HTML block 并在其中添加您的表单代码。
我正在尝试从模块中获取管理员 url 和管理员目录。 你能举个例子,从一个模块 php 页面中找到 admin url 和 admin dir 吗? getAdminLink('AdminTest',
我使用以下代码尝试在 prestashop 中获取当前用户 ID。 我将此代码放在我的模块目录中的另一个 php 文件中,并通过模块文件调用它。 $id = $this->context->cust
Prestashop 我遇到了一个关于 cookie 的问题。在 prestashop 1.4.7 中,我使用 setcookie 创建了一个自定义 cookie 变量,但是当我尝试在前端 Contr
我是 prestashop 的新手。 2 天前,我在我的本地主机上安装了 prestashop Version 1.6.1.6。但现在我忘记了它的管理面板 URL。有什么办法可以找出网址。任何人都请帮
是否可以在不直接注入(inject)模板 smarty 的情况下将 javascript 集成到模块中? 最佳答案 已解决, 我在我的模块目录中添加了一个 Js 文件(例如:mymodule/view
我正在尝试从 prestashop 获取当前的购物车 ID: $cookie->id_cart; 但在我将产品添加到购物车之前,它是空白的。 是否有任何选项可以创建该购物车以便我获取 ID? 谢谢。
我是一名优秀的程序员,十分优秀!