Prestashop: Error with hook displayAdminLogin

Created on 24 May 2019  路  4Comments  路  Source: PrestaShop/PrestaShop

BUG 1

Describe the bug
Hook displayAdminLogin is not in table ps_hook, so a module can not be hooked manually in this position unless you call registerHook function.

To Reproduce
Steps to reproduce the behavior:

  1. Install module dummymodule_v1.zip
    dummymodule_v1.zip
  2. Go to "Design -> Positions -> Insert a module"
  3. Can't be hooked to 'displayAdminLogin` because this position doesn't appear
  4. Uninstall and remove module
  5. Install module dummymodule_v2.zip
    dummymodule_v2.zip
  6. Go to "Design -> Positions"
  7. Module is hooked to displayAdminLogin. You can unhook and hook module because now position is at ps_hook table.

Hook displayAdminLogin should be inserted in ps_hook table in installation.

Additinnal information
PrestaShop version: 1.7.6

BUG 2

Describe the bug
Hook is linked with "multishop" and it shouldn't. It should be executed always, doesn't matter the shop context.

To Reproduce
Steps to reproduce the behavior:

  1. Create a multishop with 2 stores
  2. Go to "Modules -> Catalog manager"
  3. Select the store with ID 2 in the store selector
  4. Install module dummymodule_v2.zip
    dummymodule_v2.zip
  5. Open BO login page in an Incognito tab
  6. Hook displayAdminLogin is not executed
  7. Uninstall module
  8. Select the store with ID 1 in the store selector
  9. Install module dummymodule_v2.zip
  10. Reload the previous BO login page opened
  11. Hook displayAdminLogin is executed (appears a string Dummy module under the login box)

Hook is only executed if you install module in "All shops" context or in Multistore ID 1, while in BO login page there is not a shop context yet. Query that retrieves module hooks for hook displayAdminLogin should not take into consideration shop context.

Additional information
PrestaShop version: 1.7.6

1.7.5.2 1.7.6.0 BO Bug Fixed Minor Modules

All 4 comments

Hi @idnovate,

Thanks for your report.
First issue:
I manage to reproduce it with PS1.7.6.0beta1 & PS1.7.5.2
v1 of the module => NOK => displayAdminLogin doesn't exist
image
v2 of the module => OK => displayAdminLogin exist
image
Second issue:
I manage to reproduce it with PS1.7.6.0beta1 & PS1.7.5.2

if module installed when shop2 is selected => displayAdminLogin is not executed => NOK
image
if module installed when shop1 is selected => displayAdminLogin is executed => OK

image

PS: if shop1 / shop2 are selected & we install the module => it will be installed in all shops

I鈥檒l add this to the debug roadmap so that it鈥檚 fixed. If you have already fixed it on your end or if you think you can do it, please do send us a pull request!
Thanks!

Where are the installation and upgrade SQL scripts?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marionf picture marionf  路  3Comments

khouloudbelguith picture khouloudbelguith  路  3Comments

wikao2 picture wikao2  路  3Comments

vincent-dp picture vincent-dp  路  3Comments

itisco picture itisco  路  3Comments