Call module in tpl file in preashashop

I want to use the search module in my header.tpl file. The fact that I used this code

{include file='./modules/blocksearch/blocksearch.tpl'}

But it does not work and with the help of this code my page is empty.

Thank you in advance

+4
source share
2 answers

You cannot include a module template like this because the PHP code for the te module is not called, and the template needs to set some Smarty variables.

The best you can do is connect the block search module to your header. Here we go:

  • Go to "admin> modules> position"
  • Click the Transplant Module button
  • Select “Quick Search Box” for “Module”
  • Select "Page Title / displayHeader" for "Paste in"
  • Click "Save."

The Quick Search Module is now connected to your title.

+3
source

Here you will find what you are looking for http://www.ecartservice.net/prestashop-articles/1-4-plugins-revisited-part-1/

This is a great and easy way to call modules directly in template files without using hooks. I tested it in both Prestashop 1.4 and 1.5, and it works.

For Prestashop 1.5, you will need to create 2 additional files in the "override" folder, as described in the link above:

  • Plugin.php in / override / classes /
  • FrontController.php in / override / classes / controller /

Then you can use the following code in the template files:

 {plugin module='editorial' hook='displayHome'} 

You need to use the hook name (displayHome) and NOT an alias (home).

+4
source

All Articles