Prestashop: Child theme doesn't load parent modules and load from other child theme

Created on 13 Nov 2020  路  12Comments  路  Source: PrestaShop/PrestaShop

Describe the bug

Child them loads module template from an other child theme in case If a module folder exists or not in a child theme

Expected behavior

A child them must load module template from the parent them "classic" or from the current child them if the module template exists

Steps to Reproduce

Multistore enabled with 2 stores
DEV mode enabled

Store 1 has child them "dark" with theme.yml parameters :

parent: classic
name: dark
display_name: Dark

Store 2 has child them "light" with theme.yml parameters :

parent: classic
name: light
display_name: Light

In the store 1, with "browser dev tools", the module ps_featuredproducts folder exists in the them "dark", it must load the module template from it, but instead it loads the module template from the light them.
In the case where the module folder does not exist, it must load the module template from the parent them "classic", but instead it loads the module template from the "light" them too.

<!-- begin module:ps_featuredproducts/views/templates/hook/ps_featuredproducts.tpl -->
<!-- begin C:\wamp64\www\presta/themes/light/modules/ps_featuredproducts/views/templates/hook/ps_featuredproducts.tpl -->
<section>...</section>
<!-- end C:\wamp64\www\presta/themes/light/modules/ps_featuredproducts/views/templates/hook/ps_featuredproducts.tpl -->
<!-- end module:ps_featuredproducts/views/templates/hook/ps_featuredproducts.tpl -->

And sometimes in the store 2 its the inverse, it loads module from the "dark" them
Reproduced on 3 different installations

Additional information

  • PrestaShop version: 1.7.6.7 & 1.7.6.8
  • PHP version: 7.2
1.7.6.8 BO Bug Fixed Multistore Theme & logo waiting for author

All 12 comments

Hello @catlynx ,

After doing all your steps, when opening the console, I only see the module being related to classic theme :
Capture d鈥檈虂cran 2020-11-13 a虁 17 24 38

Shop 1 -> Dark
Capture d鈥檈虂cran 2020-11-13 a虁 17 28 47

Shop 2 -> Light
Capture d鈥檈虂cran 2020-11-13 a虁 17 29 07

Dev mode activated :
Capture d鈥檈虂cran 2020-11-13 a虁 17 28 38

Hi @florine2623,
Have you checked both shop and empty the cache?

Case 1 : both shop have ps_featuredproducts module folder

Shop 1 "dark theme" : loads wrong modules folder

shop1-3

Shop 2 "light theme" : modules folder are correct

shop2-2

Case 2 : I delete the ps_featuredproducts module only on the Shop 1 and clear the cache

Shop 1 "dark theme" : the ps_featuredproducts module is loaded from classic theme and the rest of modules are loaded from the correct "dark" theme

shop1-case2

Shop 2 "light theme" : the ps_featuredproducts module exists in this theme but it is loaded from the classic theme and the rest of the modules are loaded from the wrong "dark" theme

shop2-case2

Prestashop loads the theme which was compiled at first :

Deleting the cache folder
Refreshing the first store "dark theme" and after the second store "light theme"
The result is both store use the same theme "dark theme"

Deleting the cache folder
Refreshing the second store "light theme" and after the first store "dark theme"
The result is both store use the same theme "light theme"

Hello @catlynx

Case 1 : both shop have ps_featuredproducts module folder

I didn't manage to reproduce your issue with PS1.7.6.8 as you can see in the attached screen record below:

https://drive.google.com/file/d/13NTEwci2nf-zA38y4H4xYb1x-vIaELb5/view

Case 2 : I delete the ps_featuredproducts module only on the Shop 1 and clear the cache

If you uninstall a module, it will be uninstalled from all shops.

Please check and feedback.

Thanks!

Hello @hibatallahAouadni

The bug happens even if there is not a parent theme.
Both theme have all modules override in "themes/theme_name/modules/".
Each theme must load modules from it.
The order of opening the shop 2 at first for compiling affects the shop 1, more details in this video :

https://drive.google.com/file/d/1Vx4jpV-Mmf9jl3rqK0ZO0O_5iSAY1G4_/view?usp=sharing

Case 2 : I delete the ps_featuredproducts module only on the Shop 1 and clear the cache
I don't uninstall the module but I delete the folder in "themes/dark/modules/" to check if it's loaded from the parent theme "when enabled".

Many thanks!

Hello @catlynx

I did the override of ps_featuredproducts module like you mentioned above and follow the order that you sugguest, yet I didn't manage to reproduce your issue, see the attached scren record below:

https://drive.google.com/file/d/1x8jKAXZCDG7rySbGCw7QTxC44Af0VRCg/view

As you see in the record, I tried with both order and there's no problem.
Please check and feedback.

Thanks!

Hello @hibatallahAouadni

Thanks for the screen video,
The bug persists, I checked my web server parameters and I did an update. I tried several installations, but no way.

I will do other test and I will be back if something new comes up.

Hi @catlynx @hibatallahAouadni ,

I'm having similar a issue, where one of the themes is a child theme and one isn't.
Shop 1: child of classic theme
Shop 2: "Full" theme

As @catlynx already mentioned, the order of opening the shops is important. If you first open Shop 2 and then Shop 1, Shop 1 loads templates of Shop 2.

Hello @arisschl

As I mentionned above I didn't manage to reproduce the issue even with the order that @catlynx sugguested it, could you please watch and check the attached screen record above.

If you notice something is missed or you have other information that will help me to reproduce the issue, please let me know.

Thanks!

Hi @arisschl @hibatallahAouadni

Fortunately, This bug disappeared in version 1.7.7.0 of Prestashop.

Happy coding !

@catlynx Glad to hear 馃帀

@catlynx @hibatallahAouadni that's great news!
However, we have a PrestaShop environment that we don't simply upgrade to 1.7.7.0. Is there anything known about the fix that is applied to solve this issue?

Issue is solved by #13804

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vincent-dp picture vincent-dp  路  3Comments

Prestaworks picture Prestaworks  路  3Comments

Van-peterson picture Van-peterson  路  3Comments

sandra2n picture sandra2n  路  3Comments

khouloudbelguith picture khouloudbelguith  路  3Comments