This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » eZ Publish 5 Platform » How to override product.tpl by...

How to override product.tpl by product.html.twig?

How to override product.tpl by product.html.twig?

Friday 02 August 2013 1:54:22 pm - 6 replies


I am trying to override default ezpublish legacy product template by new twig template.
I have created product.html.twig file in /DemoBundle/Resources/views/full folder, but it doesn't work.

Any ideas?


Friday 02 August 2013 3:40:37 pm


You can afaik not override a 4.x template with a 5.x template, only the other way around.

Assuming you have legacy_mode disabled, the remaining issue that hinders your from running this template on 5.x is probably because the shop related FieldTypes have not been implemented in 5.x so it fallbacks to legacy for rendering the content.


Hope this helps,


Friday 02 August 2013 11:16:14 pm

Otoh the legacy template system has built-in management of different "resource types".

Extending it to handle twig:xxx as alternative to design:yyy is probably not too hard - it just remains to be seen if twig templates can cope with working in an environment where DIC might not have been set up (that, and the usage of ezpersistentobject things in twig is possible but member attributes have slightly different names than in ez4 templates)

Thursday 08 August 2013 1:08:19 pm


see here :

I use it to override classes see Identifier\ContentType.  I still use legacy_mode:false.

For the class full view must work after that you can override other templates inside your full view like info box, gallerie...

Dont forget : you can call a .tpl file from yout twig .this is usefull for upgrade from 4.x

{% ez_legacy_include "design:my/old_template.tpl" with {"someVar": "someValue"} %}

Thursday 31 October 2013 12:44:25 pm

Thanks, it works fine for me except that my full/feedback_form.html.twig template is not decorated by the pagelayout.html.twig.

Do I have to extends pagelayout.html.twig in feedback_form.html.twig or is this something automatically handled? (I tried but didn't work as I expected: output print the layout filename... I'm confused)

I'm pretty new here and I'm playing with eZ Publish for the first time. Sorry for my dumb questions happy.gif Emoticon 

Thursday 31 October 2013 1:13:09 pm


you can extend your pagelayout in the feedback_form.html.twig like:

 {% extends noLayout ? viewbaseLayout : "YourBundleName::pagelayout.html.twig" %}
{% block Feedback %}
    {% ez_legacy_include ....
{% endblock %}

Thursday 31 October 2013 2:11:05 pm

Thanks for your quick answer Ramzi, it works!


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from