Jump to content

[Solved] Can't Add New Customers


Fady S. Ghatas

Recommended Posts

Hello,

I've a problem after upgrading from Prestashop 1.7.1.1 to 1.7.6.2; I can't add new customers through the BO. I get this error message:

"An unexpected error occurred. [PrestaShop\PrestaShop\Core\Domain\Customer\Exception\CustomerException code 0]"

 

Steps to reproduce

  1. Upgrade from 1.7.1 to 1.7.6
  2. Go to the "Add New Customer" form in the backoffice. 
  3. Fill all fields
  4. You will get the error message mentioned above.

 

I've tried several solutions but none worked:

  1. Enable/Disable phone and phone_mobile in Customers>Addresses>Set required fields for this section.
  2. Add/Remove phone field in address format in Translations>Locations>[COUNTRY]>Address format.

 

Debugging

I tried to debug the problem further, so I've added var_dump in /src/Adapter/Customer/CommandHandler/AddCustomerHandler.php after assertRequiredFieldsAreNotMissing and got the following result; the form wants a value of 'phone':

object(Customer)#4148 (61) {
  ...
  ["phone"]=>
  NULL
  ...
  ["fieldsRequired":protected]=>
  array(6) {
    [0]=>
    string(8) "lastname"
    [1]=>
    string(9) "firstname"
    [2]=>
    string(5) "email"
    [3]=>
    string(5) "phone"
    [4]=>
    string(6) "passwd"
    [5]=>
    string(8) "birthday"
  }
  ["fieldsSize":protected]=>
  array(7) {
    ["lastname"]=>
    int(255)
    ["firstname"]=>
    int(255)
    ["email"]=>
    int(128)
    ["phone"]=>
    int(32)
    ["passwd"]=>
    int(60)
    ["note"]=>
    int(65000)
    ["reset_password_token"]=>
    int(40)
  }
  ["fieldsValidate":protected]=>
  array(29) {
    ...
    ["phone"]=>
    string(13) "isPhoneNumber"
    ...
  }
  ["def":protected]=>
  array(4) {
    ["table"]=>
    string(8) "customer"
    ["primary"]=>
    string(11) "id_customer"
    ["fields"]=>
    array(33) {
      ...
      ["phone"]=>
      array(4) {
        ["type"]=>
        int(3)
        ["validate"]=>
        string(13) "isPhoneNumber"
        ["size"]=>
        int(32)
        ["required"]=>
        bool(true)
      }
      ...
    }
    ["classname"]=>
    string(8) "Customer"
  }
  ["update_fields":protected]=>
  NULL
  ["force_id"]=>
  bool(false)
}

Also, when I tried to debug the CustomerException, I got that the form has invalid field values. 

 

Any suggestions?

 

Thank you

Edited by Fady S. Ghatas (see edit history)
Link to comment
Share on other sites

On 12/30/2019 at 1:17 AM, luishuaymana said:

Deleted

I've tried both methods, 1-Click upgrade and the manual method! Both gave the same results. 

Before upgrading to 1.7.6, we had the phone field visible in the "Add New Customer" form, which is ideally what we want to achieve. But for now, we just need to get this form to work and then we can add the phone field later. 

Hope this clarifies the problem a bit more. 

Edited by Fady S. Ghatas (see edit history)
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...