0

我正在使用 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 钩子的问题,这里是 1.7 的屏幕截图

在此处输入图像描述

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

谢谢。

4

2 回答 2

5

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

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

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

于 2016-11-22T15:03:45.593 回答
-1

简单的:

public function hookdisplayProductExtraContent($params)
{        
    $array = array();
    $array[] = (new PrestaShop\PrestaShop\Core\Product\ProductExtraContent())
            ->setTitle('tittle')
            ->setContent('content'));
    return $array;
}
于 2017-01-03T17:44:25.330 回答