Sylius: Overriding templates from Sylius bundles does not work

Created on 8 Oct 2018  路  5Comments  路  Source: Sylius/Sylius

Sylius version affected: 1.3.0

Description
Overriding templates from Sylius bundles does not work.

Steps to reproduce
After I create a file under templates/bundles/SyliusShopBundle/Homepage/index.html.twig path and I change the content to blank, I still get the Sylius vendor's homepage index template rendered. The weird thing is that overriding templates from Twig bundle (exceptions) works fine.

Possible Solution
I think this might have something to do with the old templates structure, custom namespaces or theme loader for Sylius bundles.

Tip
If I remove the core template from vendor, then the custom template from templates/bundles/Homepage/index.html.twig is loaded. It seems like the vendor has a higher priority than the app.
Might seem obvious, but the bug was detected on Sylius-Standard and replicated in the PluginSkeleton.

Potential Bug

Most helpful comment

I'm on it, it's broken by ThemeBundle logic. If you don't use ThemeBundle, there's a hotfix how to disable it for templates: https://github.com/Sylius/Sylius/issues/7491#issuecomment-379301391

All 5 comments

Related to #9719 and #8929.

Guys, I really need it. Do you have any clue how to fix it? I can provide a PR 馃槃

I'm on it, it's broken by ThemeBundle logic. If you don't use ThemeBundle, there's a hotfix how to disable it for templates: https://github.com/Sylius/Sylius/issues/7491#issuecomment-379301391

Thanks Kamil. I just debugged it quickly and it seems that the $file = $this->templateLocator->locate($template) in ThemeFilesystemLoader (line 120) points to a wrong location. This means that TemplateFileLocator's locate method should be updated. I hope that helps somehow.

9804 should fix this one.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tchapi picture tchapi  路  3Comments

loic425 picture loic425  路  3Comments

stefandoorn picture stefandoorn  路  3Comments

reyostallenberg picture reyostallenberg  路  3Comments

xleliberty picture xleliberty  路  3Comments