I am trying to deploy Magento I used the package from the official site.

But a strange thing happened to me. Among all the instances I deploy, it fails at any page that requires validation of a customer information (registration, etc.). It returns the error 'Last name cannot be empty'. But even stranger, there were 1 or 2 times of success before the errors. That is, the error only happens after I have created 1 or 2 accounts.

I found that the validation method is in the model, as:

if (!Zend_Validate::is( trim($this->getLastname()) , 'NotEmpty')) {
            $errors[] = Mage::helper('customer')->__('The last name cannot be empty.');

So I added some lines before it.

$errors[] = Mage::helper('customer')->__('The first name cannot be empty.');
$errors[] = Mage::helper('customer')->__($this->getFirstName());
$errors[] = Mage::helper('customer')->__($this->getLastName());
$errors[] = Mage::helper('customer')->__($this->getEmail());

This time there are 5 errors displayed at the registration page. As expected, the first is 'The first name cannot be empty.'. But the second and third are all empty. The fourth is the email address I typed in.

Here comes another problem. The validation of the first name comes before that of the last name. Were they all empty, how could the error message be only 'The last name cannot be empty.'?

And more substantially, why can I register at the very beginning? What is the substantial problem?

UPDATE: If I comment the validation for the two names, there are no more errors. But the account created has its last name empty, while first name as I typed in.



These lines gives the posted data as expected.

  • Are the names included in the POST data when submitting the registration form? Are the parameter keys correct (firstname, lastname)? Your error message will not include the names because you misspelled the accessors (Firstname vs. FirstName).
    – mam08ixo
    Commented Aug 12, 2015 at 10:01
  • @mam08ixo, thanks. I fixed the accessors, I got the last name empty while the first name normal. The post data looks normal. So the problem is in the middle I guess. But.I don't quite understand the getregistry thing and something else which I suppose is how magento process the data posted. Are there any good explanations on this?
    – Colliot
    Commented Aug 12, 2015 at 18:02
  • I guess it starts with the public function createPostAction(), within which there is a $customer = $this->_getCustomer();, and the protected function _getCustomer() involves some $customer = $this->_getFromRegistry('current_customer');. I can hardly see how the posted data is processed.
    – Colliot
    Commented Aug 12, 2015 at 18:05
  • I am pretty sure the magic happens at _getCustomerErrors() but ain't got my debugging equipment at hand right now.
    – mam08ixo
    Commented Aug 12, 2015 at 21:03
  • @mam08ixo, well I now think that it maybe the problem of the middle name. In the template given to me, the middle name is.removed. I guess they did not adjust the model, so the posted last name was fed to the middle name, thus the last name empty. How can I check my hypothesis?
    – Colliot
    Commented Aug 13, 2015 at 12:33

1 Answer 1


Check if lastname attribute is present in your customer_form_attribute table for checkout_register form and other forms.

To list available fields on checkout_register form, use:

SELECT `main_table`.*, ea.attribute_code
FROM `customer_form_attribute` AS `main_table`
inner join eav_attribute ea on main_table.attribute_id = ea.attribute_id
WHERE (`main_table`.`form_code` = 'checkout_register')

in my case it was missing firstname

Note the solution above is for registering customer on checkout form only. To get a list of available forms do SELECT * FROM customer_form_attribute.

Possible causes

In my case the problem happened after editing the attribute in admin, using a module that ignored the existence of checkout_register form (Clarion_Customerattribute).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.