Since upgrading to the latest version of Magento, I noticed that a new entry has appeared on the checkout page asking for the customers middle name/initial.
How do I remove the entry "Middle name/initial" from the checkout page?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityI had the same issue when updating to Magento CE 1.9.2.1 from Magento CE 1.9.2.0. The update caused Middle Name to display, but when I checked the admin System > Configuration > Customers > Customer Configuration > Name and Address Options
the "Show Middle Name (initial)" setting was already displaying "No" — which is what I wanted.
I changed the setting to "Yes" and then back to "No" before clicking "Save Config", and this immediately removed Middle Name/Initial from Checkout when I refreshed the page.
In my case, I am working on updating a store from Magento 1.8.x to Magento 1.9.x. It is in my development environment that I updated from 1.9.2.0 to 1.9.2.1. In order to get the live site up-to-date when we launch the upgrade from 1.8.x to 1.9.x, we will need to update many of the admin settings, which we plan on doing directly in the database with a query. In the database, you can see how Magento changes the Middle Name setting.
The table `core_config_data` handles the admin setting for "Show Middle Name (initial) with the record where `core_config_data`.`path`='customer/address/middlename_show'
.
This record holds the setting in the `value` field (0="No", 1="Yes"). This field is not changed when the middle name appears by upgrading to Magento CE 1.9.2.1. If you save a change to the "Show Middle Name (initial)" in the admin settings after Magento makes changes during the update to 1.9.2.1, it will change the `core_config_data` value here.
The update to 1.9.2.1 did not change the record on `core_config_data`, and therefore what is displayed in the admin settings. But, the update does change a different record of a different table.
In my many dev instances of Magento, the table `eav_attribute` has 2 "middle name" `attribute_code`(s), the `attribute_id`(s) being 6 and 21. The `customer_eav_attribute` table sets the visibility of the attribute with a field `is_visible`.
`is_visible` = 0
. `is_visible` = 1
.`is_visible`=0
again and the Middle Name/Initial field disappeared from Checkout.The Magento CE 1.9.2.1 update flipped the Middle Name setting in the `customer_eav_attribute` table without affecting what is displayed in the Magento admin under the "Show Middle Name (Initial)" setting. You can fix it the way the setting is normally adjusted in the admin, without making far-reaching template adjustments, by toggling the "Show Middle Name (Initial)" setting.
If for some reason you need to transfer this admin setting across multiple copies of a store, or in a batch of admin updates, like while upgrading a store to match a dev environment... You can use the following SQL statement for this setting (provided you know that "middle name" is `attribute_id` 6 and 21 in your store. This is standard to Magento, but to be safe, double-check your `eav_attribute` table first.).
UPDATE customer_eav_attribute SET is_visible = 0 WHERE attribute_id IN (6, 21);
The system config option has got a backend model (Mage_Adminhtml_Model_System_Config_Backend_Customer_Show_Customer
) whose _afterSave
method makes the same change in the customer EAV attribute (table: customer_eav_attribute
).
The system config option value and the EAV attribute is_visible
value might not necessarily be in sync (either because of a Magento upgrade, or if the config option was changed programmatically, or any other reason).
Flipping the switch a couple of times will fix it, or, if you're like me and use install/upgrade scripts for everything, you can do the following :
Mage::getModel('core/config')
->saveConfig('customer/address/middlename_show', 0);
try {
$attribute = Mage::getSingleton('eav/config')
->getAttribute('customer', 'middlename')
->setIsVisible(0)
->save();
$attribute = Mage::getSingleton('eav/config')
->getAttribute('customer_address', 'middlename')
->setIsVisible(0)
->save();
} catch (Exception $e) {
Mage::logException($e);
throw $e;
}
$attribute = Mage::getSingleton('eav/config') ->getAttribute('customer_address', 'middlename') ->setIsVisible(0) ->save();
Dec 16, 2015 at 9:08
The easiest way:
Magento ver. 1.9.2.1
System > Configuration > Customers > Customer configuration > Name and Address Options
Show Middle Name (initial)
= No
Removing {{depend middlename}}{{var middlename}}
like @sr_magento suggests in his answer actually does not remove remove the Show Middle Name (initial)
field from the checkout page itself. It only removes it from the areas where the customer address info is rendered/printed, like in the admin area, PDF's and email templates.
There is no need for removing the field from the email templates. This is overkill and you would have to add those entries to the email templates again in case you decide to enable the Show Middle Name(initial)
in the future.
I have noticed this glitch too, after updating from Magento CE 1.9.2.0 to Magento CE 1.9.2.1 using the Magento downloader. The update seems to adjust the setting for Show Middle Name (initial)
under
System > Configuration > Customers > Customer Configuration > Name and Address Options
from "No" to "Yes". It happened to me in several stores on different servers.
To undo this simply set it back to "No" and save config. The Show Middle Name (initial)
field will no longer be displayed on the checkout page.
Address Templates
like you suggest does not change the Checkout Page input fields in the frontend of the store. It only effects the templates for printing addresses. Please read the following documentation. You're right about the customer areas in the admin panel. I will rephrase this part of my answer.
Aug 25, 2015 at 7:59
If you want to remove directly from file then
Open following file
app=> design=> frontend=> base=> default=> template=> customer=> widget=> name.phtml
search for if ($this->showMiddlename())
comment out or remove that complete if statement