简体   繁体   中英

Prestashop 1.7 hookDisplayAdminProductsExtra is not working?

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 在此处输入图片说明

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

在此处输入图片说明

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.

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/

Simple:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM