1
votes

i'm developing a custom prestashop 1.7.x module, it has to be a theme-specific module (my-theme/modules/module) and i've followed the lineguides from the official documentation but the module display in the modules catalog only if it's located in the root/modules folder.

I've also declared the module as a theme dependency in the theme.yml configuration file, but nothing seems to happen, i'm stuck.

2

2 Answers

0
votes

The official documentation (and the internet) is void when trying to understand the concept of theme-specific modules.

The theme's modules folder is dedicated to overriding the templates and assets of any module.

You want to add your theme-specific module in the dependencies/modules folder, then declare it in your theme's configuration (config/theme.yml):

dependencies:
  modules:
    - yourmodule

global_settings:
  modules:
    to_enable:
      - yourmodule

When installing your theme from a ZIP file, Prestashop will move the modules contained in this folder.

They won't be installed and enabled, this is done when enabling the theme (given that you specified to enable it in your theme's configuration as seen above).

-1
votes

theme/modules are for overrides, it will override only the modules that are already installed.

theme/dependencies are for dependencies, the modules you put there will be installed when you install the theme (you have to install with a zip file from the prestashop admin UI, dont try to just copy/past the theme on your FTP).

When you install your theme, prestashop will copy the files from the dependencies directory to root/modules, then run the "install" method of each module.