How can I remove the validation from city field which says, "Please use letters only (a-z or A-Z) in this field". I have checked the extension files but I can't find anything there.
2 Answers
Find below mentioned file If they are not already exist within your theme copy the following files from the base/default theme to your theme:
template/customer/address/edit.phtml
template/checkout/onepage/shipping.phtml
template/checkout/onepage/billing.phtml
In each of these files, look for the <input>
that defines the city field and remove the required class from the label, remove the required-attribute class from the input and make sure to remove the *.
-
Hi, it causes another issue with my dashboard. After implementing the above method, I can't see order details in admin. Customer names disappeared. here it is link May 22, 2016 at 14:31
-
I believe that it can't make any issue, Please check your code again and also check errors log file. Or Roll back the changes and see what happened May 22, 2016 at 16:28
1- Remove the required class from following files in your theme folder.
checkout/onepage/shipping.phtml
checkout/onepage/billing.phtml
persistent/checkout/onepage/billing.phtml
<!--<label for="shipping:city" class="required"><em>*</em><?php echo $this->__('city') ?></label>-->
<label for="shipping:city"><?php echo $this->__('city') ?></label>
also remove classes from input field as-well
<?php //echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>
2- copy this core class to your local and remove following lines app/code/core/Mage/Customer/Model/Address/Abstract.php
/*if (!Zend_Validate::is($this->getcity(), 'NotEmpty')) {
$this->addError(Mage::helper('customer')->__('Please enter the city number.'));
}*/
3- Change the attribute is_required in DB
update eav_attribute set is_required=0 where attribute_code='city';
Note: step three is a dirty hack, correct way would be creating an setup file in your custom extension.