Answer the question
In order to leave comments, you need to log in
Why is the script.js file taken from the regular (.default) template when connecting a custom component template?
Hello!
I'm in the process of customizing the catalog complex component template, and at the moment I need to slightly simplify the catalog.item component template, which is called from it. Relatively speaking, now I have a 'custom' template of the catalog component, it calls the 'custom' template of the catalog.section component, and it, in turn, calls the 'custom' template of the catalog.item component. That is, all templates in the chain are custom, there is not a single default
But at the same time, in the catalog.item template, the script.js file is connected for some reason from the /bitrix/components/bitrix/catalog.item/templates/.default/ folder of the default template. Although the template.php itself is pulled up as it should, from my 'custom' template. Has anyone encountered this behavior of the system, why are the files taken from different templates? In theory, script.js should be taken from the template that is called? I have tried clearing the cache multiple times to no avail.
Answer the question
In order to leave comments, you need to log in
Bitrix logic when connecting templates:
- first searches in the connected theme
- then searches in built-in themes
- then in default ones
- then gives an error if nothing is found.
If you have a custom script.js (as well as the styles of your custom style.css template), I highly recommend placing these scripts in custom.js - a special Bitrix file for customization, in order to avoid such bugs. So-called custom scripts and styles. They are in Settings - Developer Tools.
Bitrix will connect these files last and give them the highest priority.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question