OroCommerce Forums

Covering OroCommerce topics, including community updates and company announcements.

Forums Forums OroCommerce What is the best way to override Product/view.html.twig (ProductBundle)?

This topic contains 1 reply, has 2 voices, and was last updated by Yevhen Shyshkin Yevhen Shyshkin 1 year, 5 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
  • #37937

    Probably there are few ways to override Oro/Bundle/ProductBundle/Resources/views/Product/view.html.twig

    However I’m not sure what would be the most recommended/advised/suggested way to do it by following Oro standards.

    Let’s say I would like to rewrite to my own bundle



    Is it possible?

    P.S.: This is **not** the front-end twig file, this is the admin file.

Viewing 1 replies (of 1 total)
  • Author
  • #37939
    Yevhen Shyshkin
    Yevhen Shyshkin

    Hello Matthew.

    All following recommendations are provided for OroCommerce 1.6.

    1) The easiest way to override this file it to put it to app/Resources directory at the application level – see documentation https://symfony.com/doc/2.8/templating/overriding.html.

    2) You may use bundle inheritance (i.e. set OroProductBundle as parent) and then put file at the same place in the directory structure.

    3) You may create event listener to kernel.controller event and override there _template attribute which is responsible for the path to template file.

    4) You may override whole controller together with all annotations including @Template.

    Of course there are other less trivial ways, but the first one is the most commonly used during the customization of an application.

    Please let me know if that helps.

Viewing 1 replies (of 1 total)

The forum ‘OroCommerce’ is closed to new topics and replies.

You will be redirected to [title]. Would you like to continue?

Yes No