gelöst CustomerInputValidator kein overload bei v4.7

Dieses Thema im Forum "PHP" wurde erstellt von Anonymous, 25. April 2023.

  1. Anonymous

    Anonymous Mitglied

    CustomerInputValidator.inc.php kein overload bei v4.7

    Leider bekomme ich keinen Overload bei der
    CustomerInputValidator.inc.php hin wollte die funktion
    validateStreet überladen.

    GXModules\Firma\CheckoutStreetNo\Shop\Overloads\CustomerInputValidator\
    enyNETCustomerInputValidator.php
    class enyNETCustomerInputValidator extends enyNETCustomerInputValidator_parent
    {
    public function validateStreet($p_street)
    {...}
    }
    Was mache ich hier falsch?
     
  2. Anonymous

    Anonymous Administrator Mitarbeiter

    @Engin enyNET Deine Datei heißt enyNETCustomerInputValidator.php es muss aber enyNETCustomerInputValidator.inc.php heißen.

    Bitte vergiss nicht den Modulcache im Gambio Admin zu leeren.
     
  3. Anonymous

    Anonymous Mitglied

    Leider funktioniert es so auch nicht (Caches manuell/backend geleert):
    GXModules\Firma\CheckoutStreetNo\Shop\Overloads\CustomerInputValidator\
    enyNETCustomerInputValidator.inc.php
    class enyNETCustomerInputValidator extends enyNETCustomerInputValidator_parent
    {
    /**
    * Checks if the entered street is valid.
    *
    * @param string $p_street Customer's street.
    *
    * @return bool Is valid?
    */
    public function validateStreet($p_street)
    {
    if ($this->strlenWrapper(trim((string)$p_street)) > $this->settings->getStreetMaxLength()) {
    $this->errorStatus = true;
    $this->errorMessageCollection->setValue('error_street', $this->settings->getInvalidInputErrorMessage());

    return false;
    }

    if ($this->strlenWrapper((string)$p_street) < $this->settings->getStreetMinLength()) {
    $this->errorStatus = true;
    $this->errorMessageCollection->setValue('error_street', $this->settings->getStreetErrorMessage());

    return false;
    }
    if (preg_match('~[0-9]+~', (string)$p_street)) {
    $words = explode(" ", trim((string)$p_street));
    if(is_array($words) && sizeof($words) > 1) {
    if (preg_match('~[0-9]+~', (string)$words[sizeof($words)-1])) {
    $this->errorStatus = true;
    $this->errorMessageCollection->setValue('error_street',
    $_SESSION['languages_id'] == 2 ? "Bitte Hausnummer getrennt eingeben!" : "Please enter house number separately!");
    return false;
    }
    }elseif(sizeof($words) > 1){
    $this->errorStatus = true;
    $this->errorMessageCollection->setValue('error_street',
    $_SESSION['languages_id'] == 2 ? "Bitte Hausnummer getrennt eingeben!" : "Please enter house number separately!");
    return false;
    }
    }
    }
    }
     
  4. Anonymous

    Anonymous Administrator Mitarbeiter

    @Engin enyNET Du musst leider eine andere Klasse überladen, die CustomerInputValidator selber kann man leider nicht direkt überladen, da diese Klasse bereits intern extended wird.
     

    Anhänge:

  5. Anonymous

    Anonymous Mitglied

    Danke für deine Mühe und schnelle Hilfe :) Jetzt hat es geklappt.