Jump to content

This module cannot be transplanted to this hook


Recommended Posts

  • 3 weeks later...

it's easy to fix, here is the full solution 

modified blocklink.php  http://pastebin.com/66j9JfxB

 

paste this code into your blocklink.php file (/modules/blocklink/blocklink.php)

and then try to transplant module to footer section

 

Hi there, I'm new to prestashop and have the same error message as the OP when trying to transplant a module to the page header. Do I just copy and paste  http://pastebin.com/66j9JfxB code to blocklink.php too? 

Link to comment
Share on other sites

pageHeader hook is called in header.tpl just before closing the <head> tag. Module developers usually use this hook to inject javascript, CSS and meta tags that go in between the <head> tags.

 

May I ask you what module you are trying to transplant to which hook ?

Link to comment
Share on other sites

Hi there,

 

I am trying to transplant a Mega Category module to the displayHeader

 

pageHeader hook is called in header.tpl just before closing the <head> tag. Module developers usually use this hook to inject javascript, CSS and meta tags that go in between the <head> tags.

 

May I ask you what module you are trying to transplant to which hook ?

Link to comment
Share on other sites

Open your module class file (which ends with .php) and search for function hookDisplayHeader(). If you do not find this word , then your module cannot be hooked to header.

 

I'm sorry, where do I locate the module class file? 

Link to comment
Share on other sites

Got it! Thanks for your patience and help. 

 

There is no function hookdisplayheader() in the file. What is the correct code syntax to add the function? 

 

I've more newbie questions if you don't mind. 

 

The purchased theme do not work with themeinstaller. If the displayheader is an invisible hook, is it bad practice to hook modules to it manually? The theme's author has many own developed modules. I have run into same issues with other modules where I have the error message "this module cannot be transplanted to this hook". Does it reflect anything on the quality of the theme in terms of the backend development? 

Edited by twiggs (see edit history)
Link to comment
Share on other sites

In your theme file there is a file header.tpl. If you open it up you will find {$HOOK_HEADER} in most cases it is within the <head> tag (thats why it is an invisible hook). You don't see in the page the code that is within the <head> tag.

 

The purpose of $HOOK_HEADER is to allow module developers to add code that they want within the <head> tag. Usually it is javascript files, css files and meta tags. Other than these reasons a module developer will not be using displayHeader hook. A module may or may not require to be hooked to displayHeader. So without taking a look at the code I cannot really say whether we need to hook it to displayHeader or not.

 

If the purchased theme does not work with theme installer then it is simply that the theme developer does not choose to support installation via theme installer. Its an extra step that theme developer would take to make things easy for the buyer. 

Link to comment
Share on other sites

Thanks ibndawood for the help. Not sure if it is the case for Prestashop's themes, it has been a very frustrating and time consuming process to get this theme works. The theme author is non native English speaker and that adds effort for clarification. I think I'm going to try Prestashop at a later time. 

Link to comment
Share on other sites

i think that theme developer made mistake, 

displayHeader - it's not header of what you see in your theme, header is an in visible hook

displayTop - it's a visible part of theme, sometimes called as page  "header"

 

 

Out of curiosity, hooking category and right column modules to displayHeader, is this consider a bad practice for prestashop? 

Link to comment
Share on other sites

everything depends on what you want to display there.

if you want to "display" (attach) files like js/css maybe some <script> code - everything is ok.

 

if you want to attach there <div> or any other VISIBLE content - it's definitely bad practice.

Link to comment
Share on other sites

As I said before and as vekia mentioned hookHeader module is for loading CSS and JS files required for that module and most modules make use of that hook.

 

All modules hooked to header will also be hooked to other places (since header is not used for display). Its on how you use the hook is what defines bad practice.

Link to comment
Share on other sites

  • 2 months later...

it's easy to fix, here is the full solution 

modified blocklink.php  http://pastebin.com/66j9JfxB

 

paste this code into your blocklink.php file (/modules/blocklink/blocklink.php)

and then try to transplant module to footer section

Hi mod, I was tried your solution but I couldn't transplanted to displayFooter hook. I was trying to hook the store locator block.

Edited by andrefadila (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...