If you plan to make the second field mandatory for the checkout, you should make it mandatory in the customer add/edit address form for consistency.
For the client side validation you need to edit each template that holds an address for and add required-entry class on the second row.
Here are the templates I found for this:
customer/form/address.phtml
customer/address/edit.phtml
persistent/customer/form/register.phtml
customer/form/register.phtml
checkout/onepage/billing.phtml
checkout/onepage/shipping.phtml
paypal/express/review/address.phtml
persistent/checkout/onepage/billing.phtml
As for server side validation you need to copy the file
app/code/core/Mage/Customer/Model/Address.php to the local folder /app/code/local/Mage/Customer/Model/Address.php. You cannot extend this class because the class is never instantiated.
And you need to add something in the validate method.
After this section:
if (!Zend_Validate::is($this->getStreet(1), 'NotEmpty')) {
$errors[] = Mage::helper('customer')->__('Please enter the street.');
}
Add the validation for the second row
if (!Zend_Validate::is($this->getStreet(2), 'NotEmpty')) {
$errors[] = Mage::helper('customer')->__('Please enter the correct street.');
}
The easiest would be to add a new entity where the values for your cities are stored. In the frontend, just change the input type to dropdown and load the list of cities. When a user selects a field from the dropdown, store the text value (as it is now). You could even do a check if the selected city is a valid one from your city list before storing the data.
This way you don't have to change a lot.
A more advanced approach (if needed) would be to also add relations to the directory_country and/or directory_country_region tables to only show cities which belong to the specific country or region selected in the checkout.
Best Answer
Run this query in database
this will remove required.