dpjw67160
2016-11-22 06:49
浏览 43
已采纳

Prestashop 1.7 hookDisplayAdminProductsExtra不工作?

I'm using the hookDisplayAdminProductsExtra hook. It's work 1.6 prestashop version. But for 1.7 don't work.

Here is the my codes

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

This codes working for prestshop 1.6 here is a screenshoot from 1.6 enter image description here

But when i install the my plugin prestashop version 1.7 i have a some problems about Admin Products Extra hook here is a screenshot from 1.7

enter image description here

New tab is come to module options name and its not hear the product options menu. hookDisplayAdminProductsExtra is changed new version? How can i fix

Thanks.

图片转代码服务由CSDN问答提供 功能建议

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

这是我的代码

 公共函数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); 
 
 $ currency = $ this-> getDefaultRates();  
 $ this-> smarty-> assign('currency',$ currency); 
 
返回$ this-> display(__ FILE __,'/ views / template / admin / productcurrency.tpl'); \  n} 
   
 
 

此处为prestshop 1.6工作的代码是1.6 \ n

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

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

谢谢。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • doufeinai6081 2016-11-22 15:03
    已采纳

    In PrestaShop 1.7 they have changed the logic for hookDisplayAdminProductsExtra hook, now all the modules using this hook will be displayed in a single tab named 'Module Options' instead of a separate tab for each module. That means you can't show a separate tab for your module in PrestaShop 1.7

    For more details about the hooks in PrestaShop you can visit the following link:

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

    已采纳该答案
    打赏 评论
  • dongtun1872 2017-01-03 17:44

    Simple:

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

相关推荐 更多相似问题