JERRY777 Posted March 17, 2016 Share Posted March 17, 2016 (edited) When a customer or user register I want to capture the address details in one click and save that in ps_address table , ie when he clicks on the register button his address details must be also saved , how to do thisI have managed to customize the registration form and able to plug the address details form to my registration form as shown in the attached image : Now what I am stuck with is : when am clicking on the Register button ,the address field details are not saved in the database and I am getting server error What i tried to do is ,I created a new function called processPostAddress and calling that function from Authcontroller.php page from $this->processPostAddress(); //// custom function call after a customer is created and before redirecting Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account')); Below is the custom function which i created public function processPostAddress() { if($this->context->customer->id_customer!=''){ $address = new Address(); $address->id_customer = 40; $address->firstname = trim(Tools::getValue('firstname')); $address->lastname = trim(Tools::getValue('lastname')); $address->address1 = trim(Tools::getValue('address1')); $address->address2 = trim(Tools::getValue('address2')); $address->postcode = trim(Tools::getValue('postcode')); $address->city = trim(Tools::getValue('city')); $address->country = trim(Tools::getValue('country')); $address->state = trim(Tools::getValue('state')); $address->phone = trim(Tools::getValue('phone')); $address->phone_mobile = trim(Tools::getValue('phone_mobile')); $address->add(); // This must add the address to the addresss table when customer registers first time } } Please help me or tell me if am doing anything wrong Edited March 17, 2016 by JERRY777 (see edit history) Link to comment Share on other sites More sharing options...
girl_dev Posted August 26, 2016 Share Posted August 26, 2016 Hello, how you added the addresses in the registration form please? Link to comment Share on other sites More sharing options...
rocky Posted August 27, 2016 Share Posted August 27, 2016 Assuming you're using the default theme, you can go to Preferences > Customers and change "Registration process type" to "Standard (account creation and address creation). 1 Link to comment Share on other sites More sharing options...
girl_dev Posted August 27, 2016 Share Posted August 27, 2016 thanks very much 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