Magento – Where does the validation for onepage billing.phtml take place

checkoutform-validationonepage-checkout

I'm looking for the validation of billing.phtml for onepage so that I can remove a field from being 'required'

I've tried the Abstract.php file and a copy of it I made but no change as of yet

Best Answer

The client side validation is done via javascript in the template. Enable the template path hints to see the template used.
The server side validation is done eventually in Mage_Customer_Model_Address_Abstract::validate following this stack trace:

  • Mage_Checkout_OnepageController::saveBillingAction
  • Mage_Checkout_Model_Type_Onepage::saveBilling
  • Mage_Customer_Model_Address_Abstract::validate

That's just part of the validation.
An other part is done in Mage_Checkout_Model_Type_Onepage::_validateCustomerData. This validates address attributes based on the validation rules set in the table customer_eav_attribute.
You may need to change the validate_rules field for the attribute in question.