Jump to content

hookDisplayAdminProductsExtra won't load


DanielaPetkova

Recommended Posts

Hi all,

I have installed and assigned 3 modules to that hook. I'm seeing in the database all modules are assigned to the hook. The problem is that there is no way i can load the hook in products tab and to show that Modules tab with the options. 

I'm with v.1.7.3.3 , PHP 7.3 .

So far i tested.
 - All cache off. BO , the server everything.

- Disabled all none PS modules and overrides

- Switch PHP versions.

- Different hacks in Hook.php

- Many other things

 In  debug mode i see only 5 hooks loading in Product.
 

Quote

moduleRoutes,   displayBackOfficeHeader, actionAdminControllerSetMedia,  displayAdminNavBarBeforeEnd,  displayAdminAfterHeader

 

Here is the database query what i use for the check and is all good there - it returns that i have modules attached .

SELECT * FROM `ps4e_hook_module` hm INNER join ps4e_hook h on hm.id_hook = h.id_hook WHERE h.name like 'displayAdminProductsExtra';


Here is one of the modules that i use for testing.
 


Any ideas how to continue debugging would be appreciated.

belvg_samplemodule.zip

Edited by DanielaPetkova (see edit history)
Link to comment
Share on other sites

src\PrestaShopBundle\Resources\views\Admin\Product\form.html.

{% if hookcount('displayAdminProductsExtra') > 0 %}

{% set hooks = renderhooksarray('displayAdminProductsExtra', { 'id_product': id_product }) %}

Doesn't return anything even tho displayAdminProductsExtra has assigned modules to it in the datebase. 

I'm lost.

Link to comment
Share on other sites

Applied that fix from the link adobe to

src/PrestashopBundle/Service/HookDispatcher.php 
/src/Adapter/LegacyHookSubscriber.php

Removed the If clause from src\PrestaShopBundle\Resources\views\Admin\Product\form.html.

The hook displayAdminProductsExtra still not loading it's content from the database. I'm not dev but still digging for solutions to this. 

Edit: Why is hidden ?

Edited by DanielaPetkova (see edit history)
Link to comment
Share on other sites

FINALLY A BRAKE:

In LegacyHookSubscriber i had previously added that empty condition for another bug:

$hooks = Hook::getHooks();

        if (empty(is_array($hooks)))) {
            foreach ($hooks as $hook) {
                $name = strtolower($hook['name']);
                $id = $hook['id_hook'];

 So i decided to dig deeper in that and found that issue is from having empty hook in ps_hook what exactly i had.  https://tinyurl.com/sp3ohq3

Why is that and for solution you have to check here https://github.com/PrestaShop/PrestaShop/pull/8463

Applied the fix and it seems to work. 

        // If hook_name is given, just get list of modules for this hook
        if (null !== $hook_name) {
            $retro_hook_name = strtolower(Hook::getRetroHookName($hook_name));
            $hook_name = strtolower($hook_name);


The only problem left is that i had changed form.html

{% if hookcount('displayAdminProductsExtra') >= 0 %}

Don't know why displayAdminProductsExtra is not > 0 when everything shows the opposite. But it work so i'm fine for now.

Thanks for the support.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...