OroCommerce Forums

Covering OroCommerce topics, including community updates and company announcements.

Forums OroCommerce Basic Extension of standard layout

This topic contains 3 replies, has 2 voices, and was last updated by  christian.stegen 4 months ago.

  • Creator
    Topic
  • #37894

    christian.stegen
    Participant

    [Edit: I am using orocommerce-application 3.0]
    [Edit 2: Wonderful, editing posts apparently removes the code tags!]

    Good day, I am struggling with the basic task of simply extending a predefined layout. My goal is just to append a custom element/twig template to the body of the rendered page.
    I have read a lot of documents, for example https://oroinc.com/b2b-ecommerce/doc/current/dev-guide/front-ui/layouts, but none of the available docs really explain how to achieve my goal (at least the scss gets compiled to css and gets sent to the frontend).

    theme.yml:

    update.yml:

    assets.yml:

    test.html.twig

    What is the correct way to include my_custom_thing template at the end of the body in the rendered storefront? Do i have to register the .twig.html somewhere still? If yes, is there a complete documentation or walkthrough on how to configure it?

    Thanks and with regards,
    Christian

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #37901
    Yevhen Shyshkin
    Yevhen Shyshkin
    Moderator

    Hello Christian.

    I see two issues here.

    First – you should just add one block using @add function instead of @addTree, here is example: https://github.com/oroinc/orocommerce/blob/3.1.0-rc/src/Oro/Bundle/OrderBundle/Resources/views/layouts/default/oro_order_frontend_index/layout.yml#L23-L26

    Second – block name in the template should have name _my_random_thing_widget – feel free to check an example here: https://github.com/oroinc/orocommerce/blob/3.1.0-rc/src/Oro/Bundle/OrderBundle/Resources/views/layouts/default/oro_order_frontend_index/layout.html.twig

    And make sure that application is able to see your layout update – i.e. it has to be in Resources/views/layouts/<theme_name>/page or Resources/views/layouts/<theme_name>/<route_name> directory.

    Please let me know if this solution works for you.

    #37906

    christian.stegen
    Participant

    Hello, thanks for the swift reply.
    I was able to properly extend the layout when i renamed the template block to “_my_random_thing_widget” as you suggested!
    Thank you very much for the help. I will further read into symfony Form rendering as it was linked in the documentations.

    #37908

    christian.stegen
    Participant

    For completeness sake, here is my working setup:

    update.yml

    test.html.twig

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

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

Yes No