I am trying to deploy Magento 1.9.2.1. 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.
UPDATE 2:
print_r($this->getRequest()->getPost('lastname'));
print_r($this->getRequest()->getPost('firstname'));
These lines gives the posted data as expected.
Firstname
vs.FirstName
).public function createPostAction()
, within which there is a$customer = $this->_getCustomer();
, and theprotected function _getCustomer()
involves some$customer = $this->_getFromRegistry('current_customer');
. I can hardly see how the posted data is processed._getCustomerErrors()
but ain't got my debugging equipment at hand right now.