PrestaShop Forums: Create new hooks - PrestaShop Forums

Jump to content


Welcome to the PrestaShop Forum! We hope you'll share your comments and suggestions with us. We ask that you please post in English to the main sections of the PrestaShop Forum. If you want to write in another language, please post in the corresponding PrestaShop Community section below.

Please note that PrestaShop Community sections are largely self-moderated. PrestaShop team members may or may not participate in non-English sections. To improve the chances of receiving feedback to your question or comment, please post it in English to the main sections of our Forum.

NYC

Vous parlez français ? par ici !


Create new hooks


Create new hooks

#1 meiosdecomunicacao

    PrestaShop Newbie

  • 22 May 2008
  • Members
  • Pip
  • 1 posts

Posted 02 September 2008 - 08:18 PM

How can i create and associate new hooks on my new theme.

This is the way i'm doing it, but it's not working

a) Create the new hook on table 'hook'


| ID | NAME | TITLE | DESCRIPTION | POSITION |
--------------------------------------------
| 32 | test | Test | Test Hook | 1 |


b) Add a hookTest function to the module and create the tpl file if necessary


function hookTest($params)
{
...
}


c) Transplant the module to the hook i've just created.
d) Add the {$HOOK_TEST} in the theme.
c) Test it.

Result: Nothing happens.

#2

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 02 September 2008 - 08:57 PM

Hi,

{$HOOK_TEST} must be assigned from the php file which has called the tpl.
If you want this in product.tpl for example, you have to add the following line in product.php :
$smarty->assign('HOOK_TEST', Module::hookExec('test'));

(Something like that at least ^^)

#3

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 20 January 2009 - 02:56 AM

Hello all can anybody guide me in the right direction on how to make a simple hook I have try what Damien says but have no idea where to add the code or what do I need to do to make it work!!

I will appreciated very much if anybody helps me out.

Thank you very much!

#4

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 20 January 2009 - 03:28 AM

I need a hook anybody? :lol:

#5

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 21 January 2009 - 12:23 AM

Sweet!! made my first Hook %-P

Attached File(s)



#6

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 21 January 2009 - 02:20 AM

From 1232493800:

Sweet!! made my first Hook %-P


lol :-)

#7

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 22 January 2009 - 01:58 AM

lol now he is hooked!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users