OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – Programming Questions Migration – Add column in Oro entity (not work)

This topic contains 7 replies, has 3 voices, and was last updated by  peeush 4 years, 8 months ago.

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

  • Creator
    Topic
  • #40096

    Santiago Palacios
    Participant

    Hi guys

    I need to add a new column in oro entity (PaymentTerm) and to write the following migration.

    Run the migration and add the new column.

    But…

    In the edit view mode, I can’t see the column that I just added. Also doesn’t add to the form of the entity on wherever of the views: create/edit/show.

    I’m using the oro_options for this purpose, but I don’t know if I’m using it correctly or not, because I don’t know what are all the possible options for oro_options settings and I didn’t find documentation of that.

    Could you help me guys in this?

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #40103

    Andrey Yatsenko
    Moderator

    Hi Santiago,

    This options, unfortunately, are not fully documented. For now, I could advise you to look into the vendors’ code for examples.

    Also, there is a helpful command to check the oro_options values for the field.

    Where the label is the field name.

    There you can see the full list of supported options and what values were applied after running the migration to make sure they work as expected.

    Sometimes options like[view][is_displayable] or [form][is_enabled] can not work as expected, because it requires some extra work on a template, developers could miss it so you have to override the template first, by getting an example from the place where it works.

    #40104

    Santiago Palacios
    Participant

    Thanks Andrey

    I’m going to try what you recommend.

    #40225

    peeush
    Participant

    Hi Andrey

    I am having the same issue – my custom fields, created programmatically on Customer (and other entities) are not showing anywhere on the application forms despite setting ExtendScope::OWNER_CUSTOM. Below are the oro option values for one such field:

    What else do I need to do on the templates side etc. to make this field visible on Customer entity forms (CRUD, datagrid)?

    Thanks

    #40238

    peeush
    Participant

    Hello – figured out that I also had to override update.html.twig and view-html.twig for OroCustomerBundle:Customer entity to get my custom fields to display on the application forms.

    Since file location for overriding templates has changed in symfony 3.4 (and onwards), I had to put my updated twig files in templates/bundles/OroCustomerBundle/Customer instead of <my bundle>Resources/OroCustomerBundle/Customer (or <my bundle>/Resources/views/Customer/

    I am now struggling with the code that I need to put in update.html.twig – below is what I have done:

    My custom field is still not showing up – can you please point me to what did I miss?

    Thanks

    #40240

    Andrey Yatsenko
    Moderator

    There is no need to override the view and update templates completely. Instead, it is recommended to use scroll data events
    https://github.com/oroinc/platform/blob/master/src/Oro/Bundle/UIBundle/Resources/doc/reference/scroll-data-customization.md

    #40241

    Andrey Yatsenko
    Moderator

    But if you still want to override the template, you should place it to src/Resources folder.
    https://oroinc.com/orocrm/doc/current/dev-guide/customization#overriding-templates

    #40262

    peeush
    Participant

    Thanks Andrey – will check out scroll data events to add the new fields to the form.

    On location of the files for overriding templates – my install is using satis.oroinc.com for OroCommerce code:

    I am assuming that means I am on the latest development branch (version 4 or higher) and not the latest stable branch (3.1.11).

    I tried both the options noted in the article (copying to src/Resources and overriding the bundle) but neither worked as my install is on Symfony 4.2+ and the referenced article is for OroCommerce v3 (which I believe is on Symfony 3.4).

    Am I using the right/recommended file location for overriding templates?

    Thanks

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

The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.

Back to top