Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The "Positions" page displays all the available hooks and their attached modules. Many are empty by default, but some of the most useful ones can have a dozen of modules.


Image RemovedImage Added


At the top of the page, a drop-down menu enables you to only display the module in which you are interested. Alternatively, you can also search for a specific hook.
By default, this page only displays the hooks on which you can position functions. Checking the "Display non-positionable hooks" box below displays all the hooks, even the invisible ones, that are linked to an action for an instance.

The header of the table for each hook displays the hook's name, a quick description (when available), and its number of attached modules. The table lists the modules that are attached to that hook. The modules are displayed in the order in which they appear in the hook.

...

Info

Make sure to disable the cache when testing the effect of a new module on the front-end. You can do this in the "Performance" page, under the "Advanced parametersParameters" menu.


The transplanting process has its own interface:

  1. Go to the "Design" menu, and its "Positions" page.
  2. Click the "Transplant a module" button at the top right. The transplanting interface appears.
  3. In the "Module" drop-down list, select the module you want to transplant.
  4. In the "Transplant to" drop-down list, select where you want to transplant the module to. There are many hooks available. You can change your settings later if needed.
  5. In the "Exceptions" field, type the name of the file(s) of the pages in which you do not want the module to appear.
    You can perform multiple selections simply by clicking on the file names while keeping the Ctrl key pressed. You can deselect files in the same manner: Ctrl+click.
  6. Do not forget to save your changes.

Image Modified


The "Transplant to" drop-down menu gives you a good idea where modules can be placed.

Even though the "Transplant to" drop-down list gives a comprehensive overview of the available hooks, it might not always be clear which is the one to which you want to attach your module. Do not hesitate to try another hook if the result of your selection if not what you expect.
The list gives some details: some hook have a description after the hook's name, for instance, "Add fields to the form 'attribute value'" for displayAttributeForm. Peruse them all in order to choose your hook correctly.

...

Editing a module's setting uses the same interface as the one used for transplanting a module. The only difference is that you cannot change the "Module" field, as it is disabled, and thus grayed out. You can edit both the "Transplant to" setting and the exceptions, which works just as described in the "Attaching a module to a hook" method above.


Image RemovedImage Added


Always check your front - office to make sure the module is indeed where you intended it to be.

...

Some modules cannot be transplanted into other sections of the front office simply because they lack the necessary code. For example, some modules contains templates for both column display and header display, whereas others have one template file which only works with the header section. 

If you want to display simple modules in a position for which it was not built, you will have to edit its template files.
 More complex modules can also be made to be displayed in other sections of the page, but they might have to be partly rewritten in order to have their design work with that new location.

...

Afterward, you must write the code that displays the content on the front page. At best, that means copy/pasting the content of the hookTop() function; at worst, you need to rework the content of hookTop() function into something that will work for the new location.

Widgets

PrestaShop 1.7 has introduced a new system to hook modules: widgets. Thanks to widgets, a module can be used and transplanted to any display hook.

Widgets work with 1.7 modules only (for PrestaShop modules, their technical names start with "ps_"), and cannot be used on all the modules. Read more about widgets here: 

...

https://

...

devdocs.prestashop.com/

...

1.7/modules/concepts/widgets