[MODULE] Hook Manager - Free Modules & Themes - PrestaShop

Jump to content

Photo

[MODULE] Hook Manager

hook hooks manager

#1

Posted 07 January 2014 - 05:41 PM

vblanch

    PrestaShop Enthusiast

  • Members
  • PipPip
  • 138 Active Posts

Hi everyone.

Together with a partner, we recently developed a new theme for an online store. To do this we needed to introduce new hooks in the store, design themes . While programming it , we realized that the hooks in PrestaShop is highly dependent on modules (eg calling the function "registerHook" , restart the module, etc... ) And also sometimes you have to touch the database if you want the new hooks to display in "Positions" and be able to associate modules to them.

So I developed a module that lets you create, edit and remove hooks in an easy way from the control panel of Prestashop. This module also allows you to show or hide the hooks in positions.
 

The module is completely free and is released under the GPL2 license.
 

It has been developed for Prestashop 1.5.x version, I didn't try it on a 1.4.x, if I see that people are interested I may do the adaptation to these versions.

 

*EDIT: I addapted the code so now it's compatible with 1.4.x and even maybe with 1.3.x (didn't try), just download v1.0.3 of the module or higher*

The module is multilingual.

If this module really makes your life easier and you want to support my work you can make a donation, in the configure screen of the module it's specified how.
 

Thank you!

Installation and use :

1. Put the "hookmanager" folder in "modules" .

2. Enable the module in Modules (control panel) .

3. In Modules, click the "Configure" button on the Hooks Manager module.

4. Create, modify or delete hooks.

Note : You can leave the module activated once done (it's status does not affect the hooks you've created / modified / deleted).

 

You can alse see the code or fork it in GitHub: https://github.com/v...nager_ps_module

 

Version History:

1.0.0-1.0.1: Initial release/some typos fixed.

Update 1.0.2: Changed "Create" for "New Hook" and the german translation is now correct, thanks to eleazar!

1.0.3 Added compatibility with Prestashop 1.4.x, maybe 1.3.x but I didn't try, you are free to test it. Also hooks are sorted alphabetically now. Some debug code removed, some typos in comments fixed.

1.0.4 Removed translations that I'm unable to keep updated, and added compatibility with Prestashop 1.6.x. Now it's possible to set the title and the description of the hook!

Attached Files


Edited by vblanch, 29 July 2014 - 02:22 PM.


#2

Posted 07 January 2014 - 07:41 PM

vekia

    PrestaShop Legend

  • Ambassadors
  • 53131 Active Posts

thank you for this contribution!

i added it to the pinned topic: free modules list

if you don't want to share it there, just let me know i will remove link


free tutorials, free templates, free addons, responsive prestashop modules MndfRK4.png


#3

Posted 08 January 2014 - 11:43 PM

vblanch

    PrestaShop Enthusiast

  • Members
  • PipPip
  • 138 Active Posts

Thanks to you vekia :-)

Glad to see my module in the list!

Cheers



#4

Posted 12 January 2014 - 08:19 PM

pqvuanh

    PrestaShop Newbie

  • Members
  • Pip
  • 1 Active Posts

thank you, that is good module, good share :) thanks



#5

Posted 13 January 2014 - 01:17 AM

vblanch

    PrestaShop Enthusiast

  • Members
  • PipPip
  • 138 Active Posts

thank you, that is good module, good share :) thanks

 

You are welcome ^_^ Thanks for the feedback.



#6

Posted 13 January 2014 - 11:56 AM

abondares

    PrestaShop Apprentice

  • Members
  • PipPip
  • 27 Active Posts

Well this is an excelent module. Just what I was looking for. If it does what i think it does :)

 

Going to install it right now.

Thx for making the module free.


Presta amateur

www.mojaljekarna.hr


#7

Posted 13 January 2014 - 12:01 PM

vblanch

    PrestaShop Enthusiast

  • Members
  • PipPip
  • 138 Active Posts

Well this is an excelent module. Just what I was looking for. If it does what i think it does :)

 

Going to install it right now.

Thx for making the module free.

 

Hi there abondares,

you are welcome. Hope it's useful for you.

If you have any suggestions to improve it just tell me ;)



#8

Posted 16 January 2014 - 02:06 PM

mdouka

    PrestaShop Newbie

  • Members
  • Pip
  • 10 Active Posts

Hello,

 

I am interested in this module too. Is it possible to make the changes and adapt it to PS 1.4.x ?

 

Kind regards,

 

Marianna



#9

Posted 16 January 2014 - 08:53 PM

vblanch

    PrestaShop Enthusiast

  • Members
  • PipPip
  • 138 Active Posts

Hello,

 

I am interested in this module too. Is it possible to make the changes and adapt it to PS 1.4.x ?

 

Kind regards,

 

Marianna

 

Hi Marianna,

I just added compatibility with 1.4.x.

Give it a try, it should work.

Regards



#10

Posted 23 January 2014 - 01:59 AM

houin

    PrestaShop Enthusiast

  • Members
  • PipPip
  • 211 Active Posts

Bonjour et merci pour ce module. depuis une mise à niveau en 1.5.6.2 depuis 1.5.6.1 j' ai ce bug.

 

! ) Notice: Undefined variable: html in C:\wamp\www\monsite\modules\hookmanager\hookmanager.php on line 153 Call Stack # Time Memory Function Location 1 0.0014 403168 {main}( ) ..\index.php:0 2 0.1737 7560312 DispatcherCore->dispatch( ) ..\index.php:53 3 0.2995 12824840 ControllerCore->run( ) ..\Dispatcher.php:348 4 0.8000 15937248 AdminModulesControllerCore->postProcess( ) ..\Controller.php:158 5 0.8001 15938848 AdminModulesControllerCore->postProcessCallback( ) ..\AdminModulesController.php:811 6 0.8099 16066264 HookManager->getContent( ) ..\AdminModulesController.php:685 7 0.8099 16066400 HookManager->displayForm( ) ..\hookmanager.php:139

 

Quelqu'un pourrait il m'aider .Merci



#11

Posted 21 April 2014 - 07:01 PM

sagaryadav

    PrestaShop Newbie

  • Members
  • Pip
  • 20 Active Posts

Does it work in Prestashop 1.6 ?



#12

Posted 27 April 2014 - 09:21 PM

dioniz

    PrestaShop Fanatic

  • Global Moderators
  • 2062 Active Posts

It would be great if it works in 1.6


Wear a smile and have friends; wear a scowl and have wrinkles :)

#13

Posted 28 April 2014 - 10:43 PM

vblanch

    PrestaShop Enthusiast

  • Members
  • PipPip
  • 138 Active Posts

Does it work in Prestashop 1.6 ?

 

It would be great if it works in 1.6

 

Give it a try, it should work now in PS 1.6!

 

Donations are highly appreciated :-)



#14

Posted 29 April 2014 - 09:33 PM

dioniz

    PrestaShop Fanatic

  • Global Moderators
  • 2062 Active Posts

Thanks a lot :)


Wear a smile and have friends; wear a scowl and have wrinkles :)

#15

Posted 29 April 2014 - 10:04 PM

vblanch

    PrestaShop Enthusiast

  • Members
  • PipPip
  • 138 Active Posts

You are Welcome dioniz, I also added the capacity to set a title and description for the hook. 

 

I love your avatar btw :D

 

Cheers



#16

Posted 28 July 2014 - 10:41 AM

Mª Victoria

    PrestaShop Apprentice

  • Members
  • PipPip
  • 25 Active Posts

Thank you so much!!! Someone recommend me your module and I solved my problem!!! :lol:  :lol:  :lol:  :lol:

 

I am very grateful with you  :D  :D  :D  :D  :D



#17

Posted 29 July 2014 - 01:43 AM

Dimar

    PrestaShop Enthusiast

  • Members
  • PipPip
  • 413 Active Posts

Hi, Greetings

I am having an error installing the module and when to I want to edit. Here a screenshot of the error:

Is an updated PS 1.5 to 1.6.0.8 store, the store works well. Install a clean version in PS 1.6.0.8 and this not get the bug. Any idea what It could be?

 

Attached Files



#18

Posted 29 July 2014 - 09:08 AM

HaCos

    PrestaShop Enthusiast

  • Members
  • PipPip
  • 202 Active Posts

Hi, Greetings

I am having an error installing the module and when to I want to edit. Here a screenshot of the error:

Is an updated PS 1.5 to 1.6.0.8 store, the store works well. Install a clean version in PS 1.6.0.8 and this not get the bug. Any idea what It could be?

 

I get the same error. I am on fresh PS 1.6.0.8 install.

 

edit:

I think this is caused because $html variable has a Concatenation assignment (.=) in both if cases (either line 162 or 165). 

 

I initialized $html on line 160 by setting $html = null; and the message is gone.

 


Edited by HaCos, 29 July 2014 - 09:15 AM.


#19

Posted 29 July 2014 - 09:24 AM

HaCos

    PrestaShop Enthusiast

  • Members
  • PipPip
  • 202 Active Posts

Give it a try, it should work now in PS 1.6!

 

Donations are highly appreciated :-)

 

Can you explain how exacly does it work?

I created a a new hook and it is succefully listed in positions. I face 2 issues: 

1. No matter which module i try to transplant to this hook, it doesnt work. I get the error msg : This module cannot be transplanted to this hook.

2. How will this hook show up in template? Dont we need to add the hook name in the .tpl files in order to get loaded there?

 

Regards,

C



#20

Posted 29 July 2014 - 10:19 AM

vblanch

    PrestaShop Enthusiast

  • Members
  • PipPip
  • 138 Active Posts

Hi, Greetings

I am having an error installing the module and when to I want to edit. Here a screenshot of the error:

Is an updated PS 1.5 to 1.6.0.8 store, the store works well. Install a clean version in PS 1.6.0.8 and this not get the bug. Any idea what It could be?

 

Hi there,

first of all, thanks for using it and for the feedback. Do not worry about the "Notice" messages. They are more like warnings, no real errors.

 

I get the same error. I am on fresh PS 1.6.0.8 install.

 

edit:

I think this is caused because $html variable has a Concatenation assignment (.=) in both if cases (either line 162 or 165). 

 

I initialized $html on line 160 by setting $html = null; and the message is gone.

 

You are right, initializing the variable will fix the notice. I will push that change into the next version.

 

Can you explain how exacly does it work?

I created a a new hook and it is succefully listed in positions. I face 2 issues: 

1. No matter which module i try to transplant to this hook, it doesnt work. I get the error msg : This module cannot be transplanted to this hook.

2. How will this hook show up in template? Dont we need to add the hook name in the .tpl files in order to get loaded there?

 

Regards,

C

 

1. You create the hook for the modules, however you must add extra code to the modules themselves in order to be able to be added to this hook. For instance, if your hook is called "test", you must have a function in the module you want to add to the hook called "hookTest". You can copy the inner workings of that function from another on the same module (for example if it has a hookTop function or similar).

 

2. Hook will show in template if you call it. There's special smarty code in order to "call" a hook. Please take a look at the header.tpl or footer.tpl in your theme, you should find something like "{$HOOK_HEADER}". In order to call the hook, you must add other extra code too. Here is an example: http://www.prestasho...-in-prestashop/

 

I hope this all clarifies things a bit :)

 

Cheers





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cookies help us deliver our services. By using our services, you agree to use our cookies.     Learn more