claudiaIta Posted July 25, 2017 Share Posted July 25, 2017 I hope someone could help with this: after setting up Prestashop 1.7, i saw that diffrently from PS 1.6 ther's no "backoffice>customer> registration process type (standard account creation and address creation)", as in need customer fill its address already in the registration form. How can i merge the address form in the registration form?? Thanks! 2 Link to comment Share on other sites More sharing options...
quimetal Posted August 28, 2017 Share Posted August 28, 2017 I have the same problem, I need to customers who register on the website to enter all your data, including address. The version of prestashop 1.7 does not allow it. is there any way to perform a full data record? It should be as the record standard in prestashop 1.6 Link to comment Share on other sites More sharing options...
loupiloop Posted October 17, 2017 Share Posted October 17, 2017 Hello Have you find a solution please, I have the same problem, I would lke to have a complete register form with addresses fields; Thank you Link to comment Share on other sites More sharing options...
Snorreh Posted October 20, 2017 Share Posted October 20, 2017 This should be standard functionality. Really disappointed there is no way to easily add an address field in the registration form. Link to comment Share on other sites More sharing options...
rygar Posted July 19, 2018 Share Posted July 19, 2018 anybody managed to work this out? Link to comment Share on other sites More sharing options...
rygar Posted July 20, 2018 Share Posted July 20, 2018 Could anybody advice how I can redirect to add address page after registration if the registration is not done through checkout page? Link to comment Share on other sites More sharing options...
PrestaPros Posted August 1, 2018 Share Posted August 1, 2018 It is better to do it by module but if you need a quick solution we prepared short tutorial https://prestapros.com/en/blog/additional-fields-for-registration-form-prestashop-1-7 3 Link to comment Share on other sites More sharing options...
rygar Posted August 11, 2018 Share Posted August 11, 2018 @PrestaPros Thanks for this tutorial the only problem with it is how to disable these fields when the user is registering on the checkout page or when editing the identity Meaning these fields should be only displayed when the user is registering for the first time only! Link to comment Share on other sites More sharing options...
rygar Posted August 12, 2018 Share Posted August 12, 2018 I managed to find a solution by following your instruction but only changing the required to false in case the user wants to edit their personal information. then in the customer-form.tpl file inside the foreach I added this code {$address_fields = ['phone','address1','postcode','city']} {if $customer.is_logged OR $page.page_name == 'checkout'} {if in_array($field.name, $address_fields)} {continue} {/if} {else} {if in_array($field.name, $address_fields)} {$field.required = true} {/if} {/if} Link to comment Share on other sites More sharing options...
rygar Posted August 12, 2018 Share Posted August 12, 2018 (edited) hopefully with prestashop 1.7.5 we would have a real solution @PrestaPros Is it too complicated to add the country field? Edited August 12, 2018 by rygar (see edit history) Link to comment Share on other sites More sharing options...
rygar Posted August 12, 2018 Share Posted August 12, 2018 (edited) I managed to add the country field through smarty Make sure to change in the AuthController.php to $address->id_country = Tools::getValue('id_country'); {if $field.name == 'id_country'} {$field.type = 'countrySelect'} {assign var='countries' value=Country::getCountries((int)$language.id, true)} {foreach from=$countries key=k item=v} {$field.availableValues.$k = $v.name} {/foreach} {/if} Edited August 12, 2018 by rygar (see edit history) 1 Link to comment Share on other sites More sharing options...
rygar Posted August 12, 2018 Share Posted August 12, 2018 is there a way to use validate' => 'isPostCode' ? Link to comment Share on other sites More sharing options...
Thilak Posted October 28, 2018 Share Posted October 28, 2018 Hi, I am Thilak Developer. I have implemented this part for my one of the customer. $customer = new Customer(); $customer = $customer->getByEmail($this->getValue('email')); $address = new Address( null, $this->context->language->id ); $address->address1 = $this->getValue('address1'); $address->postcode = $this->getValue('postcode'); $address->city = $this->getValue('city'); $address->phone = $this->getValue('phone'); $address->firstname = $customer->firstname; $address->lastname = $customer->lastname; $address->id_customer = (int) $customer->id; $address->id_country = $this->getValue('id_country'); $address->id_state = 0; $address->alias = 'My Address'; $address->save(); I added the above code in ContactForm submit event. If i want to do this in your site please contact me. But you have to buy me. Thank you Link to comment Share on other sites More sharing options...
preoteasa Posted March 21, 2019 Share Posted March 21, 2019 Hello, Here it is a module that does exactly this: https://addons.prestashop.com/en/registration-ordering-process/44392-customer-address-at-registration.html The address is recorded in the address table, and when the country is changed, the form is updated with the corresponding states, if the new country has states. Link to comment Share on other sites More sharing options...
JayeshNaghera Posted September 6, 2019 Share Posted September 6, 2019 (edited) add this code in CustomerFormatter.php $format['phone'] = (new FormField) ->setName('phone') ->setLabel( $this->translator->trans( 'Phone', [], 'Shop.Forms.Labels' ) ) ->setRequired(true) ; $format['address1'] = (new FormField) ->setName('address1') ->setLabel( $this->translator->trans( 'Address', [], 'Shop.Forms.Labels' ) ) ->setRequired(true) ; $format['postcode'] = (new FormField) ->setName('postcode') ->setLabel( $this->translator->trans( 'Zip/Postal Code', [], 'Shop.Forms.Labels' ) ) ->setRequired(true) ; $format['city'] = (new FormField) ->setName('city') ->setLabel( $this->translator->trans( 'City', [], 'Shop.Forms.Labels' ) ) ->setRequired(true) ; $format['vat_number'] = (new FormField) ->setName('vat_number') ->setLabel( $this->translator->trans( 'Vat Number', [], 'Shop.Forms.Labels' ) ) ->setRequired(true) ; --> add this code in AuthController.php inside if($hookResult && $register_form->submit()) { //address saving $customer = new Customer(); $customer = $customer->getByEmail($register_form->getCustomer()->email); $address = new Address( null, $this->context->language->id ); $address->id_country = (int) Tools::getCountry(); $address->address1 = Tools::getValue('address1'); $address->postcode = Tools::getValue('postcode'); $address->city = Tools::getValue('city'); $address->phone = Tools::getValue('phone'); $address->vat_number = Tools::getValue('vat_number'); $address->firstname = $customer->firstname; $address->lastname = $customer->lastname; $address->id_customer = (int) $customer->id; $address->id_state = 0; $address->alias = $this->trans('My Address', [], 'Shop.Theme.Checkout'); if($address->save()){ $should_redirect = true; } else { $customer->delete(); $this->errors[] = $this->trans('Could not update your information, please check your data.', array(), 'Shop.Notifications.Error'); $this->redirectWithNotifications($this->getCurrentURL()); } // $should_redirect = true; for Better please visit link Edited September 6, 2019 by jayesh_naghera (see edit history) Link to comment Share on other sites More sharing options...
joanna Posted September 18, 2019 Share Posted September 18, 2019 Hi i'm having a problem with this code. I managed to make the address fields appear in the form but i can't get it to save them. I get a 500 error. Could you please see if i'm doing something wrong? Here is my AuthController.php override class AuthController extends AuthControllerCore { public $ssl = true; public $php_self = 'authentication'; public $auth = false; public function checkAccess() { if ($this->context->customer->isLogged() && !$this->ajax) { $this->redirect_after = ($this->authRedirection) ? urlencode($this->authRedirection) : 'my-account'; $this->redirect(); } return parent::checkAccess(); } public function initContent() { $should_redirect = false; if (Tools::isSubmit('submitCreate') || Tools::isSubmit('create_account')) { $register_form = $this ->makeCustomerForm() ->setGuestAllowed(false) ->fillWith(Tools::getAllValues()); if (Tools::isSubmit('submitCreate')) { $hookResult = array_reduce( Hook::exec('actionSubmitAccountBefore', array(), null, true), function ($carry, $item) { return $carry && $item; }, true ); if ($hookResult && $register_form->submit()) { //address saving $customer = new Customer(); $customer = $customer->getByEmail($register_form->getCustomer()->email); $address = new Address( null, $this->context->language->id ); $address->id_country = (int) Tools::getCountry(); $address->address1 = Tools::getValue('address1'); $address->postcode = Tools::getValue('postcode'); $address->city = Tools::getValue('city'); $address->phone = Tools::getValue('phone'); $address->firstname = $customer->firstname; $address->lastname = $customer->lastname; $address->id_customer = (int) $customer->id; $address->id_state = 0; $address->alias = $this->trans('My Address', [], 'Shop.Theme.Checkout'); if($address->save()){ $should_redirect = true; } else { $customer->delete(); $this->errors[] = $this->trans('Could not update your information, please check your data.', array(), 'Shop.Notifications.Error'); $this->redirectWithNotifications($this->getCurrentURL()); } } { $should_redirect = true; } } $this->context->smarty->assign([ 'register_form' => $register_form->getProxy(), 'hook_create_account_top' => Hook::exec('displayCustomerAccountFormTop'), ]); $this->setTemplate('customer/registration'); } else { $login_form = $this->makeLoginForm()->fillWith( Tools::getAllValues() ); if (Tools::isSubmit('submitLogin')) { if ($login_form->submit()) { $should_redirect = true; } } $this->context->smarty->assign([ 'login_form' => $login_form->getProxy(), ]); $this->setTemplate('customer/authentication'); } parent::initContent(); if ($should_redirect && !$this->ajax) { $back = urldecode(Tools::getValue('back')); if (Tools::urlBelongsToShop($back)) { // Checks to see if "back" is a fully qualified // URL that is on OUR domain, with the right protocol return $this->redirectWithNotifications($back); } // Well we're not redirecting to a URL, // so... if ($this->authRedirection) { // We may need to go there if defined return $this->redirectWithNotifications($this->authRedirection); } // go home return $this->redirectWithNotifications(__PS_BASE_URI__); } } } Link to comment Share on other sites More sharing options...
afshop Posted December 6, 2019 Share Posted December 6, 2019 On 8/12/2018 at 3:31 PM, rygar said: I managed to add the country field through smarty Make sure to change in the AuthController.php to $address->id_country = Tools::getValue('id_country'); {if $field.name == 'id_country'} {$field.type = 'countrySelect'} {assign var='countries' value=Country::getCountries((int)$language.id, true)} {foreach from=$countries key=k item=v} {$field.availableValues.$k = $v.name} {/foreach} {/if} Hello, how can I add also the state of the coutry in the registration form? thanks Angela Link to comment Share on other sites More sharing options...
Myles_UA Posted February 20, 2020 Share Posted February 20, 2020 On 9/18/2019 at 2:33 PM, joanna said: Hi i'm having a problem with this code. I managed to make the address fields appear in the form but i can't get it to save them. I get a 500 error. Could you please see if i'm doing something wrong? Here is my AuthController.php override class AuthController extends AuthControllerCore { public $ssl = true; public $php_self = 'authentication'; public $auth = false; public function checkAccess() { if ($this->context->customer->isLogged() && !$this->ajax) { $this->redirect_after = ($this->authRedirection) ? urlencode($this->authRedirection) : 'my-account'; $this->redirect(); } return parent::checkAccess(); } public function initContent() { $should_redirect = false; if (Tools::isSubmit('submitCreate') || Tools::isSubmit('create_account')) { $register_form = $this ->makeCustomerForm() ->setGuestAllowed(false) ->fillWith(Tools::getAllValues()); if (Tools::isSubmit('submitCreate')) { $hookResult = array_reduce( Hook::exec('actionSubmitAccountBefore', array(), null, true), function ($carry, $item) { return $carry && $item; }, true ); if ($hookResult && $register_form->submit()) { //address saving $customer = new Customer(); $customer = $customer->getByEmail($register_form->getCustomer()->email); $address = new Address( null, $this->context->language->id ); $address->id_country = (int) Tools::getCountry(); $address->address1 = Tools::getValue('address1'); $address->postcode = Tools::getValue('postcode'); $address->city = Tools::getValue('city'); $address->phone = Tools::getValue('phone'); $address->firstname = $customer->firstname; $address->lastname = $customer->lastname; $address->id_customer = (int) $customer->id; $address->id_state = 0; $address->alias = $this->trans('My Address', [], 'Shop.Theme.Checkout'); if($address->save()){ $should_redirect = true; } else { $customer->delete(); $this->errors[] = $this->trans('Could not update your information, please check your data.', array(), 'Shop.Notifications.Error'); $this->redirectWithNotifications($this->getCurrentURL()); } } { $should_redirect = true; } } $this->context->smarty->assign([ 'register_form' => $register_form->getProxy(), 'hook_create_account_top' => Hook::exec('displayCustomerAccountFormTop'), ]); $this->setTemplate('customer/registration'); } else { $login_form = $this->makeLoginForm()->fillWith( Tools::getAllValues() ); if (Tools::isSubmit('submitLogin')) { if ($login_form->submit()) { $should_redirect = true; } } $this->context->smarty->assign([ 'login_form' => $login_form->getProxy(), ]); $this->setTemplate('customer/authentication'); } parent::initContent(); if ($should_redirect && !$this->ajax) { $back = urldecode(Tools::getValue('back')); if (Tools::urlBelongsToShop($back)) { // Checks to see if "back" is a fully qualified // URL that is on OUR domain, with the right protocol return $this->redirectWithNotifications($back); } // Well we're not redirecting to a URL, // so... if ($this->authRedirection) { // We may need to go there if defined return $this->redirectWithNotifications($this->authRedirection); } // go home return $this->redirectWithNotifications(__PS_BASE_URI__); } } } same here. Did somone managed to achieve saving fields? Link to comment Share on other sites More sharing options...
Marc Bastarache Posted March 2, 2020 Share Posted March 2, 2020 (edited) CURRENT SOLUTION It seems like the initContent() function is NOT being executed when submitting the registration form in Prestashop 1.7.6.3... (perhaps above solutions worked in earlier 1.7.x versions?) Therefore, I was NOT able to apply the above address save logic within the AuthController.php file... HOWEVER - instead of adding to AuthController.php --- I'm able to update the ps_address file by updating override/classes/form/CustomerPersister.php (Clear cache after updating below code) 1) Within CustomerPersister.php -- find the 2nd occurrence of $ok = $customer->save(); 2) Directly below -- Add your Address Saving Code (slight variation of above solutions to allow same code to work within this logical position).. //address saving $address = new Address( null, $this->context->language->id ); $address->id_country = (int) Tools::getCountry(); $address->address1 = Tools::getValue('address1'); $address->postcode = Tools::getValue('postcode'); $address->city = Tools::getValue('city'); $address->phone = Tools::getValue('phone'); $address->vat_number = Tools::getValue('vat_number'); $address->firstname = $customer->firstname; $address->lastname = $customer->lastname; $address->id_customer = (int) $customer->id; $address->id_state = 0; $address->alias = 'My Address'; if($address->save()){ $should_redirect = true; } else { $customer->delete(); $this->errors[] = $this->trans('Could not update your information, please check your data.', array(), 'Shop.Notifications.Error'); $this->redirectWithNotifications($this->getCurrentURL()); } Edited March 2, 2020 by Marc Bastarache (see edit history) Link to comment Share on other sites More sharing options...
remyyyyy Posted April 1, 2020 Share Posted April 1, 2020 Bonjour, Je ne recommande pas la solution de @Marc Bastarache mais plutôt d'utiliser le hook "actionObjectCustomerUpdateAfter" dans un module personnalisé 😎 Testé en version Prestashop 1.7.4 avec succés. Cdt Link to comment Share on other sites More sharing options...
Alex Weiss Posted April 27, 2020 Share Posted April 27, 2020 On 3/2/2020 at 4:18 PM, Marc Bastarache said: CURRENT SOLUTION It seems like the initContent() function is NOT being executed when submitting the registration form in Prestashop 1.7.6.3... (perhaps above solutions worked in earlier 1.7.x versions?) Therefore, I was NOT able to apply the above address save logic within the AuthController.php file... HOWEVER - instead of adding to AuthController.php --- I'm able to update the ps_address file by updating override/classes/form/CustomerPersister.php (Clear cache after updating below code) 1) Within CustomerPersister.php -- find the 2nd occurrence of $ok = $customer->save(); 2) Directly below -- Add your Address Saving Code (slight variation of above solutions to allow same code to work within this logical position).. //address saving $address = new Address( null, $this->context->language->id ); $address->id_country = (int) Tools::getCountry(); $address->address1 = Tools::getValue('address1'); $address->postcode = Tools::getValue('postcode'); $address->city = Tools::getValue('city'); $address->phone = Tools::getValue('phone'); $address->vat_number = Tools::getValue('vat_number'); $address->firstname = $customer->firstname; $address->lastname = $customer->lastname; $address->id_customer = (int) $customer->id; $address->id_state = 0; $address->alias = 'My Address'; if($address->save()){ $should_redirect = true; } else { $customer->delete(); $this->errors[] = $this->trans('Could not update your information, please check your data.', array(), 'Shop.Notifications.Error'); $this->redirectWithNotifications($this->getCurrentURL()); } I managed to carry out all these tips above. however for me it is extremely necessary that you can save the "state" information. This is not happening. how can I do so that this information is saved? already tried several ways and ends up in error 500 Prestashop 1.7.6.1 Link to comment Share on other sites More sharing options...
erserpico Posted May 6, 2020 Share Posted May 6, 2020 On 1/4/2020 at 7:27 PM, remyyyyy dice: Bonjour, Je ne recommande pas la solution de @Marc Bastarache mais plutôt d'utiliser le hook "actionObjectCustomerUpdateAfter" dans un module personnalisé 😎 Testé en version Prestashop 1.7.4 avec succés. Cdt seriez-vous assez aimable pour me dire étape par étape comment le faire? Link to comment Share on other sites More sharing options...
remyyyyy Posted May 7, 2020 Share Posted May 7, 2020 Il y a 18 heures, erserpico a dit : seriez-vous assez aimable pour me dire étape par étape comment le faire? Bonjour, Pardonnez-moi mais pour le moment je suis over-booké. Peut-être ultérieurement.. Cdt Rémy Link to comment Share on other sites More sharing options...
erserpico Posted May 7, 2020 Share Posted May 7, 2020 5 minuti fa, remyyyyy dice: Bonjour, Pardonnez-moi mais pour le moment je suis over-booké. Peut-être ultérieurement.. Cdt Rémy ok thanks Link to comment Share on other sites More sharing options...
Myles_UA Posted May 14, 2020 Share Posted May 14, 2020 (edited) On 3/2/2020 at 9:18 PM, Marc Bastarache said: CURRENT SOLUTION It seems like the initContent() function is NOT being executed when submitting the registration form in Prestashop 1.7.6.3... (perhaps above solutions worked in earlier 1.7.x versions?) Therefore, I was NOT able to apply the above address save logic within the AuthController.php file... HOWEVER - instead of adding to AuthController.php --- I'm able to update the ps_address file by updating override/classes/form/CustomerPersister.php (Clear cache after updating below code) 1) Within CustomerPersister.php -- find the 2nd occurrence of $ok = $customer->save(); 2) Directly below -- Add your Address Saving Code (slight variation of above solutions to allow same code to work within this logical position).. //address saving $address = new Address( null, $this->context->language->id ); $address->id_country = (int) Tools::getCountry(); $address->address1 = Tools::getValue('address1'); $address->postcode = Tools::getValue('postcode'); $address->city = Tools::getValue('city'); $address->phone = Tools::getValue('phone'); $address->vat_number = Tools::getValue('vat_number'); $address->firstname = $customer->firstname; $address->lastname = $customer->lastname; $address->id_customer = (int) $customer->id; $address->id_state = 0; $address->alias = 'My Address'; if($address->save()){ $should_redirect = true; } else { $customer->delete(); $this->errors[] = $this->trans('Could not update your information, please check your data.', array(), 'Shop.Notifications.Error'); $this->redirectWithNotifications($this->getCurrentURL()); } how can i apply this solution to saving new address on identity page? When, for example, client updating his phone and name in my account, in identity section, not in address section Or perhaps how not to create new address, but update already existing address for same user Edited May 14, 2020 by Myles_UA (see edit history) Link to comment Share on other sites More sharing options...
Casparof Posted November 22, 2020 Share Posted November 22, 2020 I still have trouble adding “country” (and state) to the registration. I have seen the post about using something called “smarty” but don’t really understand it. Could someone maybe explain where I need to add what code. Would be really helpful. Thanx Link to comment Share on other sites More sharing options...
remyyyyy Posted February 26, 2021 Share Posted February 26, 2021 (edited) Le 06/05/2020 à 7:47 PM, erserpico a dit : seriez-vous assez aimable pour me dire étape par étape comment le faire? Bonjour, Chose promise, chose due, après tout ce temps, je prends "enfin" le temps de vous mettre un exemple : public function hookActionObjectCustomerAddAfter($params) { if ( $this->context->controller->php_self == 'authentication' || $this->context->controller instanceof AdminCustomersController ) { if(!empty($params['object']->mon_champ_perso)) { $this->updateCustomerMonChampPerso($params); } } } Au lieu de surcharger AuthController, le hookActionObjectCustomerAddAfter permet de mettre à jour le champ personnalisé par le client ou l'administrateur directement à partir de notre module.. Bien cordialement Edited February 26, 2021 by remyyyyy (see edit history) Link to comment Share on other sites More sharing options...
AleAlejandro Posted June 10, 2021 Share Posted June 10, 2021 Podrían añadir los campos al formulario de registro y crear un disparador en la base de Datos para que después de cada registrops_customer mueva los datos de dirección a la tabla de dirección ps_address Link to comment Share on other sites More sharing options...
wegorz23 Posted February 22, 2022 Share Posted February 22, 2022 On 3/2/2020 at 8:18 PM, Marc Bastarache said: CURRENT SOLUTION It seems like the initContent() function is NOT being executed when submitting the registration form in Prestashop 1.7.6.3... (perhaps above solutions worked in earlier 1.7.x versions?) Therefore, I was NOT able to apply the above address save logic within the AuthController.php file... HOWEVER - instead of adding to AuthController.php --- I'm able to update the ps_address file by updating override/classes/form/CustomerPersister.php (Clear cache after updating below code) 1) Within CustomerPersister.php -- find the 2nd occurrence of $ok = $customer->save(); 2) Directly below -- Add your Address Saving Code (slight variation of above solutions to allow same code to work within this logical position).. //address saving $address = new Address( null, $this->context->language->id ); $address->id_country = (int) Tools::getCountry(); $address->address1 = Tools::getValue('address1'); $address->postcode = Tools::getValue('postcode'); $address->city = Tools::getValue('city'); $address->phone = Tools::getValue('phone'); $address->vat_number = Tools::getValue('vat_number'); $address->firstname = $customer->firstname; $address->lastname = $customer->lastname; $address->id_customer = (int) $customer->id; $address->id_state = 0; $address->alias = 'My Address'; if($address->save()){ $should_redirect = true; } else { $customer->delete(); $this->errors[] = $this->trans('Could not update your information, please check your data.', array(), 'Shop.Notifications.Error'); $this->redirectWithNotifications($this->getCurrentURL()); } Add code inside CustomerPersister.php is good solution. But if you want add County field, add this code in file override/classes/form/CustomerFormatter.php : $countries = Country::getCountries((int)$this->language->id, true, false, false); if (count($countries) > 0) { $countryField = (new FormField) ->setName('id_country') ->setType('countrySelect') ->setLabel($this->translator->trans('Country', [], 'Shop.Forms.Labels')) ->setRequired(true); foreach ($countries as $country) { $countryField->addAvailableValue( $country['id_country'], $country['country'] ); } $format[$countryField->getName()] = $countryField; } and this code in file override/classes/form/CustomerPersister.php: //$address->id_country = (int) Tools::getCountry(); $address->id_country = (int)Tools::getValue('id_country') > 0 ? Tools::getValue('id_country') : (int) Tools::getCountry(); 1 Link to comment Share on other sites More sharing options...
Welele Posted September 6, 2022 Share Posted September 6, 2022 (edited) this post would be perfect and it would be solved if the state field problem was solved. Is anyone capable??? Thanks in advance Edited September 7, 2022 by Welele (see edit history) Link to comment Share on other sites More sharing options...
Welele Posted September 9, 2022 Share Posted September 9, 2022 (edited) This was my solution: Thinking about how to solve the problem: forcing customer to register his address in customer registration process, I thought of something that is much easier, just redirect customer to the address register just after customer registration. The solution was using the actionCustomerAccountAdd hook, in CustomerPersister.php if ($ok) { $this->context->updateCustomer($customer); $this->context->cart->update(); $this->sendConfirmationMail($customer); Hook::exec('actionCustomerAccountAdd', [ 'newCustomer' => $customer, Tools::redirect('index.php?controller=address') //Redirect after registration ]); } Regards Edited September 9, 2022 by Welele (see edit history) 3 Link to comment Share on other sites More sharing options...
Maha Zahid Posted February 7, 2023 Share Posted February 7, 2023 Is there any way I can redirect to the add address page after,registration if I don't register through the checkout process? Link to comment Share on other sites More sharing options...
Track Posted August 17, 2023 Share Posted August 17, 2023 (edited) On 9/9/2022 at 9:33 AM, Welele said: This was my solution: Thinking about how to solve the problem: forcing customer to register his address in customer registration process, I thought of something that is much easier, just redirect customer to the address register just after customer registration. The solution was using the actionCustomerAccountAdd hook, in CustomerPersister.php if ($ok) { $this->context->updateCustomer($customer); $this->context->cart->update(); $this->sendConfirmationMail($customer); Hook::exec('actionCustomerAccountAdd', [ 'newCustomer' => $customer, Tools::redirect('index.php?controller=address') //Redirect after registration ]); } Regards I tried this and got an immediate Error 500 when tried to open an account. Could you give me an idea as to what went wrong please? For reference, I added this line- Tools::redirect('index.php?controller=address') //Redirect after registration -in the appropriate place as shown. Edited August 17, 2023 by Track (see edit history) 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