Prestashop 1.7 hookDisplayAdminProductsExtra 不工作?

Prestashop 1.7 hookDisplayAdminProductsExtra is not working?

我正在使用 hookDisplayAdminProductsExtra 挂钩。它的工作 1.6 prestashop 版本。但是对于 1.7 不起作用。

这是我的代码

public function hookDisplayAdminProductsExtra($params)
{
    $this->smarty;

    $id_product  = Tools::getValue('id_product');

    $get_values = $this->getProductCurrencyRow($id_product);
    $this->smarty->assign('get_values',$get_values);
    $this->smarty->assign('id_product',$id_product);

    $currencies = $this->getDefaultRates();
    $this->smarty->assign('currencies',$currencies);

    return $this->display(__FILE__, '/views/templates/admin/productcurrency.tpl');
}

此适用于 prestshop 1.6 的代码是 1.6 的屏幕截图

但是当我安装我的插件 prestashop 版本 1.7 时,我有一些关于 Admin Products Extra hook 的问题这里是 1.7 的截图

模块选项名称出现了新选项卡,它听不到产品选项菜单。 hookDisplayAdminProductsExtra 是否更改为新版本?我该如何解决

谢谢。

在 PrestaShop 1.7 中,他们更改了 hookDisplayAdminProductsExtra 挂钩的逻辑,现在使用此挂钩的所有模块都将显示在名为 'Module Options' 的单个选项卡中,而不是每个模块单独的选项卡。这意味着您无法在 PrestaShop 1.7

中为您的模块显示单独的选项卡

有关 PrestaShop 中挂钩的更多详细信息,您可以访问以下内容link:

http://build.prestashop.com/news/module-development-changes-in-17/

简单:

public function hookdisplayProductExtraContent($params)
{        
    $array = array();
    $array[] = (new PrestaShop\PrestaShop\Core\Product\ProductExtraContent())
            ->setTitle('tittle')
            ->setContent('content'));
    return $array;
}