It's just part of Magento's architecture to use a first name and a last name.
Your question asks why this is the case. Presumably, Magento has added the firstname
and lastname
attributes (along with even an optional middlename
one is defined as default but not displayed) to provide as much flexibility as possible for the merchant. This is a departure from other more established sites, as you noted, but Magento has to cater for a range of possible merchants, and tries to be as non-specific as possible.
However, like all of Magento, nothing is set in stone, and it can be changed, however this is a coding exercise, and as a result can be quite a complicated procedure. To enable this, you'd need to do a few different things. I'll try and detail the steps I'd take below.
1. Add Full Name Attribute
The full name needs to be added as an attribute to a customer. You can create a module to handle this, but essentially, you'll need to run an installer script to install fullname
as an attribute against the customer attribute set.
There are lots of useful tutorials about this around the web. Excellence Magento has a great one (code partially shown below, edited to your requirements)
$setup->addAttribute('customer', 'fullname', array(
'type' => 'text',
'input' => 'text',
'label' => 'Full Name',
'global' => 1,
'visible' => 1,
'required' => 1,
'user_defined' => 1,
'default' => '0',
'visible_on_front' => 1
));
2. Add your new attribute in your templates
You'd now need to go through and add the field for your new attribute to all relevant templates; thereby allowing the user input of it.
You can remove the First Name and Last Name fields in the process, wherever they are applicable.
3. Adjust the firstname and lastname attributes
First Name and Last Name are required attributes in the database, so you won't be able to do much until you remove their required
status from the attributes themselves.
You'll need to write a single-use script to adjust the settings; the code should resemble the following:
$attributeId = Mage::getResourceModel('eav/entity_attribute')->getIdByCode('customer','firstname');
if ($attributeId) {
$attribute = Mage::getModel('catalog/resource_eav_attribute')->load($attributeId);
$attribute->setIsRequired(false)->save();
}
$attributeId = Mage::getResourceModel('eav/entity_attribute')->getIdByCode('customer','lastname');
if ($attributeId) {
$attribute = Mage::getModel('catalog/resource_eav_attribute')->load($attributeId);
$attribute->setIsRequired(false)->save();
}
After that, you should have successfully transferred firstname
and lastname
into a single fullname
field.
If you have any existing customers, you'll be able to write a script that will combine the firstname
and lastname
fields into the fullname
one.