Pimcore Which event is fired when first time product save?

1.1k views Asked by At

Pimcore How to get event for first time product save using backend.

I have to apply some logic for first time product creation in pimcore.

How to find event name.

1

There are 1 answers

1
Andy On BEST ANSWER

The name of the event is 'object.preAdd'.

If the Id of the saved object is 0, it's a newly created one

\Pimcore::getEventManager()->attach("object.preAdd", function (\Zend_EventManager_Event $e) {
    // your code goes here
});

It would probably be best if you stick the code above into a custom made plugin to ensure it's executed on every call.

See https://www.pimcore.org/docs/latest/Extending_Pimcore/Event_API_and_Event_Manager.html for more information