Jump to content
trsakhilk

To call HOME hook in all other template files in prestashop

Recommended Posts

Hi guyzz...

 

So i got the banner module to work in the home hook in the index.tpl file....

So what i need is that i need to add this hook to the cms.tpl or any other tpl files for this matter..

 

I dont want the banner to show in certain pages so is there any way i can do this...

 

I tried adding the {$HOOK_HOME} in the tpl files but it seems this hook works only in the index.tpl page.

 

Please help me out guyzz...

Edited by trsakhilk (see edit history)

Share this post


Link to post
Share on other sites

Hi,

 

You need to execute the HOME hook in controller:

//1.4.x
self::$smarty->assign('HOOK_HOME', Module::hookExec('home'));
//1.5.x
$this->context->smarty->assign('HOOK_HOME', Hook::exec('displayHome'));

 

Regards

Share this post


Link to post
Share on other sites

Hi,

 

You need to execute the HOME hook in controller:

//1.4.x
self::$smarty->assign('HOOK_HOME', Module::hookExec('home'));
//1.5.x
$this->context->smarty->assign('HOOK_HOME', Hook::exec('displayHome'));

 

Regards

 

Once again you came to my rescue...

 

Thanks a lot...works like a charm...

Share this post


Link to post
Share on other sites

By the way how do you add the home hook to the wishlist block..

i want the banner to appear in mywishlist page..if its the same way then in which file do i add the code..

 

Please i am confused about it...

 

Thanks in advance..

Share this post


Link to post
Share on other sites

I think that the best way in your case is creating your own hook, instead of hook Home, becose when hook execute it run all modules register in that hook.

For cusomize "My wishlist page" you need to edit modules/blockwishlist/mywishlist.php.

 

Regards

Share this post


Link to post
Share on other sites

I think that the best way in your case is creating your own hook, instead of hook Home, becose when hook execute it run all modules register in that hook.

For cusomize "My wishlist page" you need to edit modules/blockwishlist/mywishlist.php.

 

Regards

 

Thats ok..i am using only a single module in the home hook...

 

Where in mywishlist.php should i add it...is the code different for it??

 

I tried adding the same code that you mentioned but it did not work...

Share this post


Link to post
Share on other sites

Where in mywishlist.php should i add it...is the code different for it??

I think it must be there (mywishlist.php):

if ($context->customer->isLogged())
{
...

Also you need to modify (mywishlist.tpl), where you may using {$HOOK_HOME}

Share this post


Link to post
Share on other sites

I am New in Prestashop i am created a php file and i want to call the Hook : updateQuantity in that file from my root directory.

Edited by sujeet (see edit history)

Share this post


Link to post
Share on other sites

Hi sujeet, you can try it:

 

Hook::exec('actionUpdateQuantity',
 array(
  'id_product' => $id_product,
  'id_product_attribute' => $id_product_attribute,
  'quantity' => $stock_available->quantity
 )
);

 

Regards

Edited by Alexander Simonchik (see edit history)

Share this post


Link to post
Share on other sites

Thanks for the reply ,

i used above code in my script and executed

but quantity not updated in database..

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More