Search code examples
magentocontrolleraccount

Create Account - Last name required, even when value given


Magento ver. 1.7.0.2

When creating an account (/customer/account/create) I get the error "The last name cannot be empty." even though I entered a last name.

In the controller...

/app/code/core/Mage/Customer/controllers/AccountController.php

..I added a var_dump() at line 277 (createPostAction)

// die(var_dump($_POST));
// result

array(7) { 
["success_url"]=> string(0) "" 
["error_url"]=> string(0) "" 
["firstname"]=> string(3) "Jon" 
["lastname"]=> string(8) "Chambers" 
["email"]=> string(21) "[email protected]" 
["password"]=> string(8) "password" 
["confirmation"]=> string(8) "password" 
}

The "lastname" is being passed in the $_POST but it is not being added to $customerData.

// die(var_dump($customerData));
// Result

array(2) { 
["firstname"]=> string(3) "Jon" 
["email"]=> string(21) "[email protected]" 
}

Has anyone run into this before or know a workaround for it?

Thanks.

Edit:

It was a long road... thanks to Slayer Birden who got me started in the right direction. From there I saw that lastname did not register in any inputs (create account, customer info, etc).

I ended replacing all the [database]_customer_... tables. That got me back on track and it's all working again, phew!


Solution

  • If you check method Mage_Eav_Model_Form::extractData you'll see that it iterates the entity attributes and tries to set data for them.

    So you need to check if you have all your customer attributes in place.