Jump to content

Edit History

BrutalVisualStudio

BrutalVisualStudio

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

 

BrutalVisualStudio

BrutalVisualStudio

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.. nd has it seems.. this hook works only on address submission..

 

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

 

Thanks..

Cesar

 

×
×
  • Create New...