2017-06-09 2 views
0

Je souhaite afficher les notifications pour mon module principal. Je ne peux pas trouver de documentation pour ce sujet.Prestashop 1.7: Notifications des modules d'affichage

Je veux afficher les notifications sur les Modules> Notifications. Le type de notification que je souhaite afficher: "Vous devez entrer votre nom de client pour utiliser ce module" ou quelque chose de similaire.

Merci!

Répondre

0

J'ai trouvé la solution dans le module ps_wirepayment. Nous devons utiliser:

$this->warning = $this->trans('Account owner and account details must be configured before using this module.', array(), 'Modules.Wirepayment.Admin'); 

Exemple:

public function __construct() 
{ 
    $this->name = 'ps_wirepayment'; 

    ... 

    parent::__construct(); 

    ... 

    $config = Configuration::getMultiple(array('BANK_WIRE_DETAILS', 'BANK_WIRE_OWNER', 'BANK_WIRE_ADDRESS', 'BANK_WIRE_RESERVATION_DAYS')); 

    if (!empty($config['BANK_WIRE_OWNER'])) { 
     $this->owner = $config['BANK_WIRE_OWNER']; 
    } 
    if (!empty($config['BANK_WIRE_DETAILS'])) { 
     $this->details = $config['BANK_WIRE_DETAILS']; 
    } 
    if (!empty($config['BANK_WIRE_ADDRESS'])) { 
     $this->address = $config['BANK_WIRE_ADDRESS']; 
    } 
    if (!empty($config['BANK_WIRE_RESERVATION_DAYS'])) { 
     $this->reservation_days = $config['BANK_WIRE_RESERVATION_DAYS']; 
    } 


    if (!isset($this->owner) || !isset($this->details) || !isset($this->address)) { 
     $this->warning = $this->trans('Account owner and account details must be configured before using this module.', array(), 'Modules.Wirepayment.Admin'); 
    } 
    if (!count(Currency::checkPaymentCurrencies($this->id))) { 
     $this->warning = $this->trans('No currency has been set for this module.', array(), 'Modules.Wirepayment.Admin'); 
    } 
}