OroCommerce Forums

Covering OroCommerce topics, including community updates and company announcements.

Forums Forums OroCommerce event import

This topic contains 2 replies, has 2 voices, and was last updated by  msalmi.kais 6 years, 3 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
  • #32647

    msalmi.kais
    Participant

    hi
    I import 17000 products successfully. my problem is:
    I want to automatically disable all existing products in my database before importing a new product file.
    how to do it ?
    Thank you

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

    ibratsilo
    Moderator

    Hi, thanks for your question.

    You can simply execute query which will update oro_product table and set status to all records as disabled. The simplest way will be to add this logic to some command or controller action and execute it when you need (before next import).

    For automatic triggering this logic one of the options you can apply is to extend Oro\Bundle\ImportExportBundle\Controller\ImportExportController::importProcessAction and add your custom logic at the beginning.

    Regarding event there are a lot different events in ImportExporBundle, but after small investigation I did not find which can fit your needs 100%. Because actually import is executed as delayed process and it is done on consumer level, so I did not find event which is triggered right after Import start.

    But you certainly can use some, such as Oro\Bundle\ImportExportBundle\Event\StrategyEvent::PROCESS_BEFORE. Be aware that such event is triggered for each entity (import row) before processed so need to added some flag (property) which will guarantee update logic executes once.

    #32649

    msalmi.kais
    Participant

    Thanks for your help.
    I will try

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

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

Back to top