3

So as my title suggests..

I'm familiar with how to do this in billing on the one page checkout (

  1. make attributes as not required in eav attributes table in the database,
  2. copy the Customer/Model/Address.php file editing out the relevant validation in the method 'validate').

However this has not helped in the paypal express review page and it will not allow the user to checkout stating:

"Incorrect billing address. CITY field is required"

There must be a similar file (to Abstract.php) that validates the data before submission but I just cannot track it down. Anyone who can or already knows please heed the call - the community may well benefit from this as well as myself. Any further info neede let me know. Thanks

2
  • Has anyone got anything to add on this? - strange no one has run into this considering how many people have modified their billing on checkout_ Commented Jan 10, 2014 at 19:23
  • I can't neither find the string "Incorrect billing address" nor "field is required" Commented Feb 25, 2014 at 23:41

1 Answer 1

0

I hate posting answers to my own questions but it seems that as the one who has need of it most pressingly I have gone the distance here.. as is too often the case..

So after trying numerous techniques including:

1) making attributes as not required in the eav attributes table in the database;

2) programatically adding these required fields to the database upon billing update (with event)

The best that I have come up with that works (very well) is to create hidden fields for any fields that are required but not relevant - in my case city, region and postcode - and include them inside the form. The easiest way to do this I believe is to create a function for this in a custom module file like so (changing $inputFields_arr to correspond to the required fields you wish to ignore):

public function getRequiredNotRequestedInputs($prefix) { // fill in input values required but not wanted
    $value = 'NOT REQUESTED';
    $inputFields_arr = array('city', 'region', 'postcode'); // required fields that we don't need/request
    foreach($inputFields_arr as $inputField) {
        $return_arr[] = '<input type="hidden" name="'.$prefix.'['.$inputField.']" id="'.$prefix.':'.$inputField.'" value="'.$value.'" />';
    }
    return implode('',$return_arr);
}

Then call this like this:

<?php echo $moduleFile->getRequiredNotRequestedInputs('billing'); // set city, postcode, etc ?>

..from whatever point you want (where $moduleFile is the file you stored the above function in). In my case I've called this in:

app/design/frontend/default/YOUR-TEMPLATE/template/YOUR-CUSTOM-LAYOUT/checkout/billing.phtml

I know that there are those out there that will want to do this the quick and nasty way (and that is your perogative) by putting the hidden fields directly into a local front-end file (and overriding the core) but after learning to use custom modules with all that you can it will not only help you to update (a well-heard sermon) it will keep things tidy and for me that is more than half the battle. Hope this is helpful to others.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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