Jump to content

Install Theme + custom modules at the same time


Andrej Stas

Recommended Posts

Hi,

 

I'm struggling with this situation:

 

I would like to pack theme + my custom modules into one theme ZIP.

 

Is it even possible? I know it's possible to rewrite .tpl files of native modules in the theme ZIP, but how about importing new modules?

 

Should I ask user to install each module separately?

 

Thank you

Link to comment
Share on other sites

Hi,

 

I'm struggling with this situation:

 

I would like to pack theme + my custom modules into one theme ZIP.

 

Is it even possible? I know it's possible to rewrite .tpl files of native modules in the theme ZIP, but how about importing new modules?

 

Should I ask user to install each module separately?

 

Thank you

Yes, you can create a zip file with two folders: modules and themes. The zip should file also contain a xml file with instructions.

You can export a theme from your website to see how it looks. Export the theme with some modules checked.

 

When you will install the zip file on a shop you will be prompted to install the included modules in that pack.

  • Like 1
Link to comment
Share on other sites

Yes, you can create a zip file with two folders: modules and themes. The zip should file also contain a xml file with instructions.

You can export a theme from your website to see how it looks. Export the theme with some modules checked.

 

When you will install the zip file on a shop you will be prompted to install the included modules in that pack.

Thank you Daniel, I will test it soon and update this thread. Have a great day

Link to comment
Share on other sites

  • 1 month later...

Now we can do it. Thank you!

Good job! :)

 

For others:

 

 

Yes, in theme.yml, you have to add the name of your module under:

- dependencies 

- to_enable

 

and eventually also add your module to appropriate hooks

 

Example:

dependencies:
  modules:
    - my_module
....


global_settings:
  modules:
    to_enable:
      - my_module
...


  hooks:
    modules_to_hook:
      displayTop:
        - my_module
      displayHome:
        - my_module
....
  • Like 4
Link to comment
Share on other sites

  • 4 weeks later...

I have a question about translations relating to this subject.


 


I edited few translations related to my theme and module which were saved successfully.


How to include those translations within theme package?


 


After editing translations, a folder (fr-FR) was created but its empty.


Path: /themes/MyTheme/translations/fr-FR/


Link to comment
Share on other sites

You can translate it in Back Office > Translations. (do not in file)

 

I know about doing translations from Back-office. In fact, I have already done the translations from Back-office.

 

My question is how to include those edited translations within theme package?

I want to provide complete theme package to my client along with its translations.

 

As I said earlier, a folder named "fr-FR" is created (Path: /themes/MyTheme/translations/fr-FR/) while editing translations from Back-office, but its empty or doesn't contain any translation file.

 

Taking example of PS 1.6, theme package includes its translations file here: /themes/MyTheme/lang/fr.php

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

I know about doing translations from Back-office. In fact, I have already done the translations from Back-office.

 

My question is how to include those edited translations within theme package?

I want to provide complete theme package to my client along with its translations.

 

As I said earlier, a folder named "fr-FR" is created (Path: /themes/MyTheme/translations/fr-FR/) while editing translations from Back-office, but its empty or doesn't contain any translation file.

 

Taking example of PS 1.6, theme package includes its translations file here: /themes/MyTheme/lang/fr.php

Hi, I also would like to know, how to export already done translations ...

Link to comment
Share on other sites

  • 6 years later...

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).

 

Source: https://stackoverflow.com/questions/60773538/cant-get-theme-specific-modules-to-work-in-prestashop-1-7-x

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...