Prestashop 1.7:显示模块通知

Prestashop 1.7: Display Modules notifications

我想显示我的后端模块的通知。我找不到该主题的文档。

我想在模块 > 通知中显示通知。 我想显示的通知类型:'You need enter your customer name to use this module' 或类似的东西。

谢谢!

我在 ps_wirepayment 模块中找到了解决方案。我们需要使用:

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

示例:

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');
    }
}