Jump to content

Need help "change registration "


Recommended Posts

Image 002.bmpImage 003.bmp

 

I want to change registration as shown in the above graph and I encountered with such problem. 

 

Take nickname as example.

 

I know I should first add a line in classes\Customer.php and in the table called ps_customer.

 

public static $definition = array(

‘table’ => ‘customer’,
‘primary’ => ‘id_customer’,
‘fields’ => array(
‘secure_key’ => array(‘type’ => self::TYPE_STRING, ‘validate’ => ‘isMd5′, ‘copy_post’ => false),

‘nickname’ => array(‘type’ => self::TYPE_STRING, ‘validate’ => ‘isName’, required => true, ‘size’ => 64),

but I don't know how to save the inputted value in to the database.

Edited by ed0522 (see edit history)
Link to comment
Share on other sites

I write this ,

$nickname = Tools::getValue('nickname');
$email = Tools::getValue('email');
$passwd = Tools::getValue('passwd');
$inssertCustomer=array('nickname'=$nickname,'email'=$email,'passwd'=$passwd);
Db::getInstance()->insert(ps_Customer,$inssertCustomer);
 
but it make things worse, the page can't show now.
Link to comment
Share on other sites

Yes, I read the file and review the object model. But I still don't know how to override the authcontroller.php.

 

Should I add something in this class? ( I just copy all the authcontroller.php to override directory)

 

protected function processSubmitCreate()
{
 
$customer = new Customer();
$customer->email= Tools::getValue('email');
$customer->nickname = Tools::getValue('nickname');
$customer->passwd = Tools::getValue('passwd');
Hook::exec('actionBeforeSubmitAccount');
if (!Validate::isEmail($email = Tools::getValue('email_create')) || empty($email))
$this->errors[] = Tools::displayError('Invalid email address.');
elseif (Customer::customerExists($email))
{
$this->errors[] = Tools::displayError('An account using this email address has already been registered. Please enter a valid password or request a new one. ', false);
$_POST['email'] = Tools::getValue('email_create');
unset($_POST['email_create']);
}
else
{
$this->create_account = true;
$this->context->smarty->assign('email_create', Tools::safeOutput($email));
$_POST['email'] = $email;
 
}
 
}
 
I'm a new beginner. I would really appreciate if you could give me some guide. 
Edited by ed0522 (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...