ed0522 Posted July 28, 2015 Share Posted July 28, 2015 (edited) 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 July 28, 2015 by ed0522 (see edit history) Link to comment Share on other sites More sharing options...
ed0522 Posted July 28, 2015 Author Share Posted July 28, 2015 It's easy to add a field in the " create an account' form (may be what called Authentication). But when I want to add new filed on the page left to the login form, it reminds me mistakes. Link to comment Share on other sites More sharing options...
ed0522 Posted July 28, 2015 Author Share Posted July 28, 2015 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 More sharing options...
NemoPS Posted July 29, 2015 Share Posted July 29, 2015 The syntax there is all wrong, I'd suggest reading more about arrays firsthttp://php.net/manual/it/language.types.array.phpas for the insert:http://nemops.com/essential-prestashop-functions-2/#.VbiVhPnzrmg Link to comment Share on other sites More sharing options...
ed0522 Posted August 2, 2015 Author Share Posted August 2, 2015 (edited) 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 August 2, 2015 by ed0522 (see edit history) Link to comment Share on other sites More sharing options...
ed0522 Posted August 2, 2015 Author Share Posted August 2, 2015 Now prestashop seems the best one in China, but the lack of Chinese reference makes PS less popular. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now