如何在PrestaShop中创建帐户后添加新流程?

问题描述 投票:0回答:1

我需要使用其API将我安装的PrestaShop链接到另一个Web应用程序。此新流程必须在创建帐户或确认后(通过发送电子邮件)完成。由于我没有在开发PrestaShop上做任何事情,我不熟悉它的文件夹,文件,控制器及其方法。我在controller/front/AuthController.php找到了一些东西,但我不确定它是否正确? 请您帮我找一下插入新代码的确切位置?

php mysql prestashop
1个回答
1
投票

如果您只想在Front Office中创建帐户时执行某些操作,则可以使用hook actionCustomerAccountAdd。在帐户创建时,它将执行:

Hook::exec('actionCustomerAccountAdd', array(
                            '_POST' => $_POST,
                            'newCustomer' => $customer
                        ));

因此,您可以创建一个使用此信息的模块,例如blocknewsletter模块:

public function hookActionCustomerAccountAdd($params)
{
    // do something
}

如果要在后台添加客户时要执行,则需要覆盖Customer类。使用以下命令在override / classes / Customer.php中创建一个文件:

class Customer extends CustomerCore 
{
     public function add($autodate = true, $null_values = true)
     {
           $res = parent::add($autodate, $null_values);
           if($res){
                  // customer is added -> do something
           }
     }
}
© www.soinside.com 2019 - 2024. All rights reserved.