Hi,
You can create your own implementation of CatalogEventListenerBase and hook the events here, such as EntryUpdating or EntryUpdated, or you can just register you methods in CatalogEventHandler.
Regards.
/Q
I cannot seem to find the CatalogEventListenerBase, is this new in v8? I'm running on 7.12.
Yes it's released in Commerce 8.
For 7.12 you can hook your event to CatalogEventHandler. In your class:
var _catalogEventHandler = ServiceLocator.Current.GetInstance<CatalogEventHandler>()
_catalogEventHandler.Initialize();
_catalogEventHandler.EntryUpdated += EntryUpdatedInEcf;
_catalogEventHandler.RelationsUpdated += RelationsUpdatedInEcf;
Regards.
/Q
I'm getting the eror "Cannot assign to 'EntryUpdated' because it is a 'method group'"
It works for ContentUpdated and RelationUpdated that are Eventhandlers.
My bad, EntryUpdated is not an event of CatalogEventHandler. We only provide generic ContentUpdated, which you'll need to check which catalog content is updated by ReferenceConverter.
/Q
The problem seems to be that I never get to the ContentUpdated event.
I have this:
var _contenEventHandler = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<EPiServer.Core.IContentEvents>(); _contenEventHandler.PublishedContent += _contenEventHandler_PublishedContent; var _catalogEventHandler = ServiceLocator.Current.GetInstance<CatalogEventHandler>(); _catalogEventHandler.Initialize(); _catalogEventHandler.ContentUpdated += _catalogEventHandler_ContentUpdated;
Then I have some loggining in each of the eventHandler methods, but I only see messages from the _ContentUpdated method (and there only the images connected to the product being saved).
We still have problem getting the ContentUpdated event to initialize using the code suggested above. What do we have to do to get the methods registered?
Is there any way I can hook on an event when a product/item is created or edited like I can with the Event Handlers in CMS?