OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM Add new file upload button custom view

This topic contains 5 replies, has 2 voices, and was last updated by  Andrey Yatsenko 5 years, 9 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
  • #30941

    chathura
    Participant

    I’m trying to add new file import button to my view and when it submits should redirect to my controller.

    Are they anyway to working on this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #30942

    Andrey Yatsenko
    Moderator

    Hi chathura,

    Please clarify, do you want to use standard import dialog and just redirect the user after import completed to another route?
    Or you just want to add a simple button with a redirect to the controller that is not related to standard import scenario.

    #30943

    chathura
    Participant

    Hi Andrey,

    I want to add standard import button and when the user submits redirect to my own controller and then I can process with my custom import process.becouse from the import I’m going to update some table as well.

    Thank you,
    Chathura

    #30944

    Andrey Yatsenko
    Moderator

    You can solve the problem from another direction.

    1) enable standard import for an entity
    2) create custom import strategy based on \Oro\Bundle\ImportExportBundle\Strategy\Import\AbstractImportStrategy or one of its child strategies.
    There are plenty of examples of custom strategies in the core.
    You probably will need to override or extend the afterProcessEntity($entity) method

    I’d recommend to start from \Oro\Bundle\ImportExportBundle\Strategy\Import\ConfigurableAddOrReplaceStrategy strategy as it’s fully functional.

    As an example, I guess you can use CustomerStrategy.php

    #30945

    chathura
    Participant

    Hi Andrey.

    Thank you very much for your solution.One more thing.

    If I want to add a simple upload button with a redirect to the controller that is not related to standard import scenario.

    Then how can add button in view and redirect to the controller?

    Thank you,
    Chathura

    #30946

    Andrey Yatsenko
    Moderator

    You can add buttons to “navButtons” block of entity templates, first check templates you want to extend, there can be placeholders so you can add buttons without extending template https://github.com/oroinc/platform/tree/master/src/Oro/Bundle/UIBundle#introduction-to-placeholders

    If there are no placeholders defined in navButtons section, you can override the template on an application level, check the Symfony documentation how to do this https://symfony.com/doc/2.8/templating/overriding.html

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

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

Back to top