创建客户时获取用户信息

时间:2019-06-20 16:14:02

标签: hook prestashop-1.7

我正在尝试创建一个Prestashop模块,当创建用户时,我可以使用<style>自动获得他的所有信息,此事件返回(ActionCustomerAccountAdd),但是我不知道获取所需数据的对象参数的结构

我试图创建$params来获取参数,我只能获取客户hookActionCustomerAccountAdd的电子邮件,但是我无法获得名字,姓氏和密码

$params['newCustomer']->email

我希望得到我需要的所有数据,例如名字,姓氏,但我不知道// Will be executed each times actionCustomerAccountAdd is triggered public function hookActionCustomerAccountAdd($params) { // $params is an array set by PrestaShop which contains the // hook data (here, the customer details $this->CustomerAdd($params['newCustomer']->email); /* $json_output = json_decode($params,true); var_dump($json_output) ; echo "Works"; */ } public function CustomerAdd($mail){ $myObj->userx->UserID = 0; $myObj->userx->Username = "NameUser"; $myObj->userx->Password ="Password"; $myObj->userx->Fname ="Fname"; $myObj->userx->Lname= "Lname"; $myObj->userx->Mail= $mail; $myObj->username= "evdokimosk"; $myObj->password="123425"; }

中的内容

1 个答案:

答案 0 :(得分:2)

$ params ['newCustomer']是客户端的对象,因此您可以检索客户信息::

$firstname = $params['newCustomer']->firstname;
$lastname = $params['newCustomer']->lastname;
....

致谢