Inject modules HTML/JS/CSS codes in whole shop frontend


Is there a way to add HTML/JS/CSS based on module frontend template in any shop FE-Page without edit the theme templates (e.g. without inserting blocks into theme templates)?


Maybe i don’t understand, but why not use the existing blocks?


The module ressource injection should work without any problems / template dependencies. The best approach would be, that the shop administrator don’t need to edit the template at all. Maybe I’m wrong, but if we use “existings blocks” it’s not sure that the block we used is present in the template, right? I think about a situation were the shop administrator is using a custom theme. So, we can’t be sure that the “Block” we used is available inside this custom theme template, right?


Yes you’re right, but most custom themes are based on azure or flow, so blocks should be available also in custom themes. Also most modules use those default blocks, so if you make a theme without them, most of the modules available will not work. For troubleshooting, in backend service/system health you can see the blocks that are used by modules but not available in template and might cause problems.


I can second that: Every child theme or even themes made from scratch shall definitely use all blocks. If a block is missing that is needed for a module on a specific place, please send a pull request.


Ok so I guess there is no functionality to inject FE ressources into all pages without using Block / Themes / Templating?


You could override method process in core/output to parse and change output, eg. look for /body and inject something before it.


this way is not completely independent from templates, but you can add custom js files and scripts to the processing array for [{oxscript}], which has to be called from template.
here is an example: