Customer address details are stored in EAV structure in Magento database. First you need to find the attribute_id
for the attribute postcode
Go to table eav_attribute
and search for attribute_code=postcode
. This will give you the attribute code for postcode
field in your database.
Now go to table customer_address_entity_varchar
and search for attribute_id=YOUR_ATTRIBUTE_ID
. This will give you postcode data of all customer addresses.
You can create a query to remove N/A
or NA
from the table.
Below script may help you, its not tested so test it on a dummy database first. This is just a sample script, you can update as required.
<?php
require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app();
$addressesCollection = Mage::getModel("customer/address")->getCollection();
$addressesCollection->addAttributeToSelect('*');
$addressesCollection->addFieldToFilter('country_id','IE');
foreach ($addressesCollection as $address) {
if($address->getPostcode() == 'NA' || $address->getPostcode() == 'N/A'){
$address->setPostcode(NULL)->save();
}
}