Jump to content
  • 0

[Presta 1.7.6.4] Zamiana na wielkie litery, problem z override


Michał S.

Question

Cześć, 

nie mogę poradzić sobie z problemem zamiany pól formularza adresowego na wielkie litery, ale tylko przy dodawaniu nowego adresu. Przy jego aktualizacji kod działa poprawnie.

Dodatkowo, ten sam kod na środowisku DEV działa poprawnie, zarówno dla dodania nowego adresu jak i jego aktualizacji.

Cashe czyściłem z poziomu zaplecza -> wydajność -> wyczyśc cache, jak i usuwając postała zawartość w katalogu var. 

Modyfikuje to przez override/classes/Address.php, update działa, ale add już nie (kolejność funkcji w pliku nie robi różnicy) :  

class Address extends AddressCore
{

  public function update($null_values = false)
  {
    // Empty related caches
    if (isset(self::$_idCountries[$this->id])) {
        unset(self::$_idCountries[$this->id]);
    }
    if (isset(self::$_idZones[$this->id])) {
        unset(self::$_idZones[$this->id]);
    }

    // Capitalize the first name
    $this->firstname = ucfirst($this->firstname);

    // Capitalize the last name
    $this->lastname = ucfirst($this->lastname);

    // Capitalize the address fields
    $this->address1 = ucfirst($this->address1);
    $this->address2 = ucfirst($this->address2);
	$this->city = ucfirst($this->city);

    if (Validate::isUnsignedId($this->id_customer)) {
        Customer::resetAddressCache($this->id_customer, $this->id);
    }

    return parent::update($null_values);
  }

  public function add($autodate = true, $null_values = false)
  {
    if (!parent::add($autodate, $null_values)) {
        return false;
    }

    // Capitalize the first name
    $this->firstname = ucfirst($this->firstname);

    // Capitalize the last name
    $this->lastname = ucfirst($this->lastname);

    // Capitalize the address fields
    $this->address1 = ucfirst($this->address1);
    $this->address2 = ucfirst($this->address2);
	$this->city = ucfirst($this->city);

    if (Validate::isUnsignedId($this->id_customer)) {
        Customer::resetAddressCache($this->id_customer, $this->id);
    }
    return true;
  }
}

Help!

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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...