Jump to content

Marc Bastarache

New Members
  • Posts

    1
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Marc Bastarache's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. 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()); }
×
×
  • Create New...