Jump to content

Bug displayError Pretashop 1.7


Recommended Posts

Hello,

je suis entrain de rendre mes modules compatibles ps1.7 et j'ai rencontré un bug en utilisant la fonction Tools::displayError.

 

Voici mon code:

$this->errors[] = Tools::displayError($this->l('An error occured'));

J'avais parfois une page blanche et parfois un message avec une erreur allowed memory..

 

Voici ce que j'ai fait pour résoudre le problème:

 

J'ai créé une fonction pour assurer la compatibilité:

public function displayError($string) {
            if (_PS_VERSION_ >= '1.7') 
                return $this->trans($string, array(), 'Shop.Notifications.Error');
            else 
                return Tools::displayError($this->l($string));
        }

Et ensuite j'affiche mes erreurs comme ça:

$this->errors[] = $this->displayError('You have to specify your firstname');

Voila,

j'espère que ça vous aidera :)

  • Like 2
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...