OroCommerce Forums

Covering OroCommerce topics, including community updates and company announcements.

Forums Forums OroCommerce How to extend the datagrid.yml of OroB2BProductBundle?

This topic contains 2 replies, has 2 voices, and was last updated by Michael Michael 3 years, 10 months ago.

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

  • Creator
  • #31209

    Hi. I create a custom bundle and extend the product bundle to my custombundle in src folder.

    I copy the datagird.yml from “vendor\oro\commerce\src\OroB2B\Bundle\ProductBundle\Resources\config” to my own custom bundle.

    Now after I copied the datagrid.yml. I having an error like this. “productNames’: Error: ‘productNames’ is already defined.”) in “OroB2BFrontendBundle:layouts:default/layout.html.twig”.

    How do I fix this?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
  • #31210

    Most likely it happens because you copied the datagrid.yml with its entire content.
    The system merges datagrid configuration from the datagrid.yml files, thus the existing configuration of the grids defined in the product bundle is simply duplicated, which is not always allowed.

    I assume you either want to modify the existing product grid, or create a similar grid your own bundle:

    If you want to create a new grid, that would be have the same content, columns, filters and to use it elsewhere, it should be enough to rename the grid definition in your bundle. For example, you can change “products-select-grid-base” to “mycustom-products-select-grid”. Or, better yet, just define your custom grid as a descendant of the original grid:

    and remove the rest of the datagrid definition.

    If the goal is to customize the existing product grid, then you may achieve that by adding only the new configuration parameters (and removing everything else that you copied from the original datagrid.yml), or through event listeners (if you want not only to add something to the grid definition, but also to change the existing behavior or implement more complex logic) as described in the documentation – https://github.com/orocrm/platform/blob/master/src/Oro/Bundle/DataGridBundle/Resources/doc/backend/datagrid.md#extendability


    We’ve just published a blog post about customizing the data grids – https://oroinc.com/b2b-ecommerce/blog/customizing-data-grids-orocommerce . You may find it useful.

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

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

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

Yes No