Jump to content

Newbie question... about address validation


Recommended Posts

On CustomerAddressForm.php we find this code 

Quote

    public function validate()
    {
        $is_valid = true;

        if (($postcode = $this->getField('postcode'))) {
            if ($postcode->isRequired()) {
                $country = $this->formatter->getCountry();
                if (!$country->checkZipCode($postcode->getValue())) {
                    $postcode->addError($this->translator->trans(
                        'Invalid postcode - should look like "%zipcode%"',
                        array('%zipcode%' => $country->zip_code_format),
                        'Shop.Forms.Errors'
                    ));
                    $is_valid = false;
                }
            }
        }

        if (($hookReturn = Hook::exec('actionValidateCustomerAddressForm', array('form' => $this))) !== '') {
            $is_valid &= (bool) $hookReturn;
        }

        return $is_valid && parent::validate();
    }

 

.. for the argument sake, i have a plugin that needs to revalidate the selected address on the multiple-address-selection checkout step. How would i call this function to (re)validate the selected address after the address-selection step?

(this is needed because "the plugin in question" uses the actionValidateCustomerAddressForm hook and I need it to trigger again after the address selection point on checkout.. in order to make some internal database changes that are address dependable.. and as it seems.. this hook works only on address submission..

 

Any master out there that can shine some light on this ? :)

 

Thanks..

Cesar

 

Edited by BrutalVisualStudio (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...