ssossossosso

Forums

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

OroCommerce, an open-source B2B commerce platform. 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 8 months, 2 weeks ago.

  • Creator
    Topic
  • #1627
    alvin.francisco
    alvin.francisco
    Participant

    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?

    help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #1628
    Michael
    Michael
    Oro Core

    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

    #1661
    Michael
    Michael
    Oro Core

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

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

You must be logged in to reply to this topic.