我正在验证手机号码并检索客户电子邮件地址并允许客户更改该表单中的电子邮件地址,现在我需要更新电子邮件地址如何从我的自定义控制器执行此操作,即如何调用客户类并更新我的电子邮件prestashop 中的地址
elseif (Tools::isSubmit('update_email')) {
$otp_mobile_num = trim(Tools::getValue('otp_mobile_num'));
$update_email = Tools::getValue('update_email_address');
$old_email = Tools::getValue('old_email_address');
//d($otp_mobile_num);
if($old_email!= $update_email) {
//d($update_email);
// Checked the email address is already in use, in case he changed his email address
if (Validate::isEmail($update_email) && !empty($update_email)) {
if (Customer::customerExists($update_email)) {
$this->errors[] = Tools::displayError('An account using this email address :('.$update_email.') has already been registered.', false);
}
}
} else {
$this->errors[] = Tools::displayError('You must change the email address!');
}
}
以下是我的单独表格: