Jump to content

500 error after logging into new customer account


xander1644

Recommended Posts

When creating a new customer account I get a 500 error immediately after customer creation, when logged in.

 

debug:

[PrestaShopException]

Eigenschap Customer->optin is leeg.
at line 1104 in file classes/ObjectModel.php

1099. } 1100. 1101. $message = $this->validateField($field, $this->$field); 1102. if ($message !== true) { 1103. if ($die) { 1104. throw new PrestaShopException($message); 1105. } 1106. 1107. return $error_return ? $message : false; 1108. } 1109. }

ObjectModelCore->validateFields - [line 319 - classes/ObjectModel.php]

ObjectModelCore->getFields - [line 622 - classes/ObjectModel.php]

ObjectModelCore->add - [line 269 - classes/Customer.php]

CustomerCore->add - [line 576 - classes/ObjectModel.php]

ObjectModelCore->save - [line 232 - classes/form/CustomerPersister.php]

CustomerPersisterCore->create - [line 69 - classes/form/CustomerPersister.php]

CustomerPersisterCore->save - [line 262 - classes/form/CustomerForm.php]

CustomerFormCore->submit - [line 64 - controllers/front/RegistrationController.php]

RegistrationControllerCore->initContent - [line 319 - classes/controller/Controller.php]

ControllerCore->run - [line 510 - classes/Dispatcher.php]

DispatcherCore->dispatch - [line 28 - index.php]

 

Link to comment
Share on other sites

On 1/19/2024 at 8:02 PM, xander1644 said:

When creating a new customer account I get a 500 error immediately after customer creation, when logged in.

 

debug:

[PrestaShopException]

Eigenschap Customer->optin is leeg.
at line 1104 in file classes/ObjectModel.php

1099. } 1100. 1101. $message = $this->validateField($field, $this->$field); 1102. if ($message !== true) { 1103. if ($die) { 1104. throw new PrestaShopException($message); 1105. } 1106. 1107. return $error_return ? $message : false; 1108. } 1109. }

ObjectModelCore->validateFields - [line 319 - classes/ObjectModel.php]

ObjectModelCore->getFields - [line 622 - classes/ObjectModel.php]

ObjectModelCore->add - [line 269 - classes/Customer.php]

CustomerCore->add - [line 576 - classes/ObjectModel.php]

ObjectModelCore->save - [line 232 - classes/form/CustomerPersister.php]

CustomerPersisterCore->create - [line 69 - classes/form/CustomerPersister.php]

CustomerPersisterCore->save - [line 262 - classes/form/CustomerForm.php]

CustomerFormCore->submit - [line 64 - controllers/front/RegistrationController.php]

RegistrationControllerCore->initContent - [line 319 - classes/controller/Controller.php]

ControllerCore->run - [line 510 - classes/Dispatcher.php]

DispatcherCore->dispatch - [line 28 - index.php]

 

Hi,

The error is related to a missing value for the "optin" property of the Customer object. The error message indicates that the property "Customer->optin" is empty when it shouldn't be.

Thanks!

  • Thanks 1
Link to comment
Share on other sites

Hi xander1644, 

The error message you're encountering, "Eigenschap Customer->optin is leeg," suggests that there's an issue with the optin property of the Customer object in PrestaShop.
This property is typically used to store the customer's choice regarding marketing communications (like newsletters).
The error is thrown because this property is empty when it's expected to have a value.

Check the registration form template (themes/YOUR_THEME/templates/customer/_partials/customer-form.tpl) for the optin field.
In the registration controller (controllers/front/RegistrationController.php), ensure that this data is being processed correctly.

As a workaround, you could set a default value for optin in the Customer class constructor. This ensures it's never empty.

  • Thanks 1
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...