ssossossosso

Forums

Covering OroCommerce topics, B2B eCommerce trends, community updates and company announcements.

This topic contains 0 replies, has 1 voice, and was last updated by thinh2010 thinh2010 1 month, 1 week ago.

  • Creator
    Topic
  • #5197
    thinh2010
    thinh2010
    Participant

    Hi,
    I am working on the frontend of orocommerce. I dont know how to check the last item in embedded_list.

    this is my code:

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #5259

    Anyt
    Participant

    Hello thinh2010,

    To know what item is the last you can override embeded_list_widget twig block and pass standard twig loop variable to the child block
    here the reference for the variable https://twig.sensiolabs.org/doc/2.x/tags/for.html

    To make it working just insert below block type to your twig template

    This is the copy of the original block from https://github.com/orocrm/customer-portal/blob/master/src/Oro/Bundle/FrontendBundle/Resources/views/layouts/blank/layout.html.twig#L197-L237

    The only thing I changed is line 29, with

    Here I passed the standard loop variable that available in any {% for %} loop from the parent block to the child with {% do block|merge_context(context) %}

    Now you can use loop variable in the child items template of embedded_list block

    That it!

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.