Raising price and inventory event updates
This topic describes how to raise event updates for prices and inventories, when using the Find search provider EPiServer.Find.Commerce. Events are raised when changes are made to prices and inventories, which triggers indexing of updated content.
Price updated event from custom price service
The default price service, PriceServiceDatabase, raises an event when a price is changed, which lets EPiServer.Find.Commerce re-index the variation content with updated prices.
Modify a custom price service to re-index variation contents when a price is updated.
- Add a dependency to Mediachase.Commerce.Engine.Events.CatalogKeyEventBroadcaster in the service.
- Call OnPriceUpdated(priceValues, new PriceUpdateEventArgs(catalogKeys)) on the CatalogKeyEventBroadcaster instance when a price has been added, updated or removed. The catalogKeys is an IEnumerable<CatalogKey> that works as a reference to the variations to which the prices belong.
Inventory updated event from custom inventory service
The default inventory service, InventoryDatabase, will raise an event when an inventory has been changed. This makes it possible for EPiServer.Find.Commerce to re-index the variation content with updated inventories.
A custom inventory service needs to be modified to make it possible to redindex variation contents when an inventory has been updated.
- Add a dependency to Mediachase.Commerce.Engine.Events.CatalogKeyEventBroadcaster in the service.
- Call OnInventoryUpdated(inventory, new InventoryUpdateEventArgs(catalogKeys)) on the CatalogKeyEventBroadcaster instance when an inventory has been added/updated/removed. The catalogKeys is an IEnumerable<CatalogKey> that works as a reference to the variations to which the inventories belong.
Do you find this information helpful? Please log in to provide feedback.
Last updated: Nov 03, 2015