我建立一个的PrestaShop网站的Prestashop添加额外的字段登记表
的企业买家不能要查看的产品,除非他们可以输入一个有效的EIN号码或注册一个有效邓& Brandstreet号的账号注册。
如何让它成为可能?
还有任何其他的电子商务软件,可以帮助我通过切换到解决这个问题?
我建立一个的PrestaShop网站的Prestashop添加额外的字段登记表
的企业买家不能要查看的产品,除非他们可以输入一个有效的EIN号码或注册一个有效邓& Brandstreet号的账号注册。
如何让它成为可能?
还有任何其他的电子商务软件,可以帮助我通过切换到解决这个问题?
您真正需要做的就是将该字段添加到模板中,然后用其他代码替代AuthController
来处理新字段。例如
<?php
class AuthController extends AuthControllerCore
{
public function preProcess()
{
// Additional pre-processing for the new form field
if (Tools::isSubmit('submitAccount'))
{
if (!MyDBNumberValidationClass::verifyvalidnumber(Tools::getValue('db_number_field', 0)))
$this->errors[] = Tools::displayError('The Dun and Bradstreet number you entered is invalid.');
}
parent::preProcess();
}
}
我假设你正在做的这就是为什么MyDBNumberValidationClass::verifyvalidnumber()
的静态调用是在上述的一些复杂的验证,但它同样可以通过任何简单的测试或附加功能在您AuthController
覆盖上面验证的类定义。如果您添加两个字段(即EIN编号),则仅在两个均无效时才更改逻辑以处理生成错误;表单验证的成功基于$this->errors
为空。
这只是通用解决方案的一部分,因为它只处理验证额外的字段。如果您需要真正对输入的数据做些什么,那么最好的方法是编写一个小处理程序模块,它可以自行安装在hookCreateAccount
public function hookCreateAccount($params)
{
// Get the field data entered on the form
$DB_number = $params['_POST']['db_number_field'];
// Your custom processing...
}
注意,有没有办法从这里回退帐户创建的,所以你将要添加的代码通过电子邮件发送给店老板应该有一个问题。