xander1644 Posted January 19 Share Posted January 19 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 More sharing options...
Prestashop Addict Posted January 22 Share Posted January 22 Check required fields in customers 1 Link to comment Share on other sites More sharing options...
AddWeb Solution Posted January 23 Share Posted January 23 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! 1 Link to comment Share on other sites More sharing options...
Knowband Plugins Posted January 24 Share Posted January 24 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. 1 Link to comment Share on other sites More sharing options...
xander1644 Posted January 24 Author Share Posted January 24 Thanks guys. That fixes the issue!! 1 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