Jump to content

This module cannot be transplanted to this hook.


Recommended Posts

It is not an error. It means the module you are trying to transplant is not designed to be transplanted in the hook you are trying to transplant it. Not all hooks make sense for all modules. Explain what you are trying to do and someone may be able to help.

  • Like 1

Share this post


Link to post
Share on other sites

I am getting this error while trying to move the <<editorial>> block (Homepage editor) to the "Top of all pages" Hook. I need it to show on all the pages as a top menu, but I am getting this error and it is very frustrating. Any help is appreciated.

Share this post


Link to post
Share on other sites
  • 6 months later...
  • 1 month later...

I saw the same message to me and I am done in 2 simple steps:

1. removing the module from the block to the left (in my case)

2. moving it to the right

If not delete and create same way I will give that error (once again, it was to me)

Share this post


Link to post
Share on other sites

I am new to Prestashop and trying to add a 2nd Nivo Slider to the top of a category page. I've created the hook in the ps_hooks table and added code to the CategoryController.php file in the override folder. When I go to add the Nivo Slider module to the hook it tells me 'This module cannot be transplanted to this hook. ' What do I need to do to make the hook work with the slider?

Share this post


Link to post
Share on other sites
  • 2 months later...

hai me to having the same prblm..! i have created the hook and when i thought of transplant the modules to a Hook .iam getting an error saying that This module cannot be transplanted to this hook. i want a single module to be applied for different hooks.?what to do now...?any help would be appreciated...!

  • Like 1

Share this post


Link to post
Share on other sites

the thing what ever i did is. First i went to the localhostphpmyadmin--> the folder --> in database ps_hook--> i created a row by giving name as topheader and title as top2. then again went for ps_alias in db and created a row alias top2 and name as top header.

Later went for classes folder -->frontcontroller.php--> and created the hook like this

 

line number:472

'HOOK_HEADER' => Hook::exec('displayHeader'),

'HOOK_TOP' => Hook::exec('displayTop'),

'HOOK_TOP2' => Hook::exec('Topheader'), /* --this is what i created the hook---*/

'HOOK_LEFT_COLUMN' => ($this->display_column_left ? Hook::exec('displayLeftColumn') : ''),

'HOOK_RIGHT_COLUMN' => ($this->display_column_right ? Hook::exec('displayRightColumn', array('cart' => $this->context->cart)) : ''),

 

later on in 479 line

 

'HOOK_HEADER' => $hook_header,

'HOOK_TOP' => Hook::exec('displayTop'),

'HOOK_TOP2' => Hook::exec('Topheader'), /* --this is what i created the hook---*/

'HOOK_LEFT_COLUMN' => ($this->display_column_left ? Hook::exec('displayLeftColumn') : ''),

'HOOK_RIGHT_COLUMN' => ($this->display_column_right ? Hook::exec('displayRightColumn', array('cart' => $this->context->cart)) : ''),

'HOOK_FOOTER' => Hook::exec('displayFooter')

));

 

later on went to header .tpl file and added the code where i wanted it to appear and gave hook like this---

 

<div id="header" class="grid_9 alpha omega">

 

<a id="header_logo" href="{$base_dir}" title="{$shop_name|escape:'htmlall':'UTF-8'}">

<img class="logo" src="{$logo_url}" alt="{$shop_name|escape:'htmlall':'UTF-8'}" {if $logo_image_width}width="{$logo_image_width}"{/if} {if $logo_image_height}height="{$logo_image_height}" {/if} />

</a>

<div id="top2"> -------->start div..This div i created and gave the hook like this

{$Hook_TOP2}

</div> ->close div

<div id="header_right" class="grid_6 omega">

{$HOOK_TOP}

 

</div>

 

</div>

 

i can find the position in back office i.e modules--->positions.

 

later on i gave the modules to the position by editing the files i.e i want to give a cms block.

i went to modules---> block cms--->block cms.php .Their i gave a code

 

public function hookTopheader($params)

{

$this->context->controller->addCSS(($this->_path).'blockcms.css', 'all');

}

.later on in the back office athe module is created. but the problem is iam able to see only the div but iam unable to see the modules in it..! i have disable cache and force compiled too but no use of it..! The one who help will be appreciated ..! make others to comment so that we can solve many issues..! we can help the prestashop starters..

Edited by cool and charming (see edit history)

Share this post


Link to post
Share on other sites

the thing what ever i did is. First i went to the localhostphpmyadmin--> the folder --> in database ps_hook--> i created a row by giving name as topheader and title as top2. then again went for ps_alias in db and created a row alias top2 and name as top header.

Later went for classes folder -->frontcontroller.php--> and created the hook like this

 

line number:472

'HOOK_HEADER' => Hook::exec('displayHeader'),

'HOOK_TOP' => Hook::exec('displayTop'),

'HOOK_TOP2' => Hook::exec('Topheader'), /* --this is what i created the hook---*/

'HOOK_LEFT_COLUMN' => ($this->display_column_left ? Hook::exec('displayLeftColumn') : ''),

'HOOK_RIGHT_COLUMN' => ($this->display_column_right ? Hook::exec('displayRightColumn', array('cart' => $this->context->cart)) : ''),

 

later on in 479 line

 

'HOOK_HEADER' => $hook_header,

'HOOK_TOP' => Hook::exec('displayTop'),

'HOOK_TOP2' => Hook::exec('Topheader'), /* --this is what i created the hook---*/

'HOOK_LEFT_COLUMN' => ($this->display_column_left ? Hook::exec('displayLeftColumn') : ''),

'HOOK_RIGHT_COLUMN' => ($this->display_column_right ? Hook::exec('displayRightColumn', array('cart' => $this->context->cart)) : ''),

'HOOK_FOOTER' => Hook::exec('displayFooter')

));

 

later on went to header .tpl file and added the code where i wanted it to appear and gave hook like this---

 

<div id="header" class="grid_9 alpha omega">

 

<a id="header_logo" href="{$base_dir}" title="{$shop_name|escape:'htmlall':'UTF-8'}">

<img class="logo" src="{$logo_url}" alt="{$shop_name|escape:'htmlall':'UTF-8'}" {if $logo_image_width}width="{$logo_image_width}"{/if} {if $logo_image_height}height="{$logo_image_height}" {/if} />

</a>

<div id="top2"> -------->start div..This div i created and gave the hook like this

{$Hook_TOP2}

</div> ->close div

<div id="header_right" class="grid_6 omega">

{$HOOK_TOP}

 

</div>

 

</div>

 

i can find the position in back office i.e modules--->positions.

 

later on i gave the modules to the position by editing the files i.e i want to give a cms block.

i went to modules---> block cms--->block cms.php .Their i gave a code

 

public function hookTopheader($params)

{

$this->context->controller->addCSS(($this->_path).'blockcms.css', 'all');

}

.later on in the back office athe module is created. but the problem is iam able to see only the div but iam unable to see the modules in it..! i have disable cache and force compiled too but no use of it..! The one who help will be appreciated ..! make others to comment so that we can solve many issues..! we can help the prestashop starters..

Share this post


Link to post
Share on other sites
  • 1 year later...
Hi,

I am new prestashop user and I have same problem. i transplant that modules to any hook but  I am getting an error saying that This module cannot be transplanted to this hook. i want a single module to be applied for different hooks.?what  should i do?any help would be appreciated...! 

Share this post


Link to post
Share on other sites

I'm having the same problem, but reviewing the forums it looks like if a module was designed for the home page, for example, then it cannot be hooked into the header, footer, right column, or left column.  I suspect it is because of room - modules that are designed to take up 100% of the space may not be able to be put in with other components, so can't be moved. 

 

At least by those of us who don't want to go in and start programming.

 

Bummer.

CJ

Share this post


Link to post
Share on other sites
  • 2 months later...
  • 1 month later...

I did some research in to code as to why I was receiving the error "This module cannot be transplanted to this hook.".  In my case, I had created a new module position displayTopMainMenu.  It did not work because the block I was trying to transplant did not have a function called displayTopMainMenu.  So I had 2 options:

1) add the function to the module and then transplant it

2) create a new custom module with function displayTopMainMenu which just calls the original module

 

I went with option 2.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

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