Troubleshooting

PrestaShop: recover a missing block in the theme with "Transplant a module"

Reviewed on 4 min read templates modules PrestaShop

Sometimes a block that had always displayed correctly disappears from the shop: the language selector, the cart, the menu… There is no error, and even if you reinstall or reset the module, it still does not show.

Most likely the module has lost its hook to the theme position where it was displayed. A PrestaShop theme is a canvas with a series of positions (displayNav, displayTop, displayFooter…), and each module is hooked to one or more of them. If it loses the hook, it simply stops being displayed.

As an example we use a real case: the language selector (ps_languageselector) had disappeared from the navigation bar. The same steps work for any other module.

1. Find out which position it should be in

Open the folder of the theme you use, themes/NOMBRE_PLANTILLA/, from the cPanel File Manager or by FTP. Inside, in the config folder, open the theme.yml file and search for the module's technical name, which is the name of its folder inside modules (in this case ps_languageselector).

Searching for ps_languageselector in the theme's theme.yml file

In this theme it appears only once, inside the displayNav position. That is the position where the theme expects the module. In the Classic theme of PrestaShop 1.7 and 8, however, the language selector goes in displayNav2: that is why it is worth checking your own theme.yml.

If the module does not appear in theme.yml, check which position it is in on another shop with the same theme or in the theme's documentation.

2. Check whether it is still hooked

In the PrestaShop back office go to Design > Positions. Find the position you found (displayNav in the example) and check whether the module appears inside it.

displayNav position in Design > Positions without the language selector

If it does not appear, you have found the problem.

If it does appear but does not show in the shop, the problem is something else. Click the module, Edit, and check the list of Exceptions: it may be excluded from the page you are looking at. Also check in Modules > Module Manager that it is enabled.

3. Transplant the module

In Design > Positions, click Transplant a module (top right) and fill in:

  • Module: the one that has disappeared; in the example, Language selector block.
  • Transplant to: the position you found in theme.yml, displayNav in the example.

Transplant a module form with the language selector and the displayNav position

Click Save.

4. Check the result

Clear the cache in Advanced Parameters > Performance > Clear cache and reload the shop: the block should reappear just as it was.

If it appears in a different order from before within the bar, go back to Design > Positions and drag the module within its position until it is back in place. If it appears twice, it was also hooked to another position displayed in the same area: remove the extra hook with the Unhook option in the module's menu in that position.

If you have multistore, make sure before you start that you are editing the right shop in the shop selector at the top.

You may also find useful

Something wrong or out of date? Tell us and we will review it.