OroCommerce Forums

Covering OroCommerce topics, including community updates and company announcements.

Forums OroCommerce filtering products

This topic contains 4 replies, has 2 voices, and was last updated by marcosjp88 marcosjp88 2 weeks, 5 days ago.

  • Creator
    Topic
  • #38708
    marcosjp88
    marcosjp88
    Participant

    have a problem wanting to replace the datagrid frontend-product-search-grid, any change that makes it, however minimal, stops working or bring products, making the normal process of extending the bundle

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #38709
    Andrey Yatsenko
    Andrey Yatsenko
    Moderator

    When you want to extend the datagrid, there is no need to extend the bundle.

    All the datagrids.yml files in enabled bundles are merged together. So to extend an existing datagrid you can just declare the datagrid with the same name and add only things that you want to, without copying all the original configuration as it will be merged with yours automatically.

    However, if you want to remove something from the datagrid configuration or modify it dynamically, it’s quite more complicated. Instead, you have to register the datagrid event listener and change the configuration there. See Datagrid Events for more details.

    #38743
    marcosjp88
    marcosjp88
    Participant

    Thank you very much, I take this opportunity to ask you another question, where should I intercept the products if I wanted to filter them by the category id, but without depending on what happened in the url?

    • This reply was modified 3 weeks, 1 day ago by marcosjp88 marcosjp88.
    #38747
    Andrey Yatsenko
    Andrey Yatsenko
    Moderator

    If we are talking about products, there are 2 general events that allow restricting them in all the places Oro\Bundle\ProductBundle\Event\ProductDBQueryRestrictionEvent and
    Oro\Bundle\ProductBundle\Event\ProductSearchQueryRestrictionEvent

    If you want to restrict results in a specific grid, instead you can modify the datagrid query.
    As an example, see: VisibilityGridListener::onDatagridBuildAfter() and the listener definition in services.yml.

    #38756
    marcosjp88
    marcosjp88
    Participant

    tnks

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

You must be logged in to reply to this topic.

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

Yes No