2

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.

3

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 *.

| improve this answer | |
  • 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 – Lucky Dhillon May 22 '16 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 – Arunendra May 22 '16 at 16:28
0

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.