SaaS CMS has officially launched! Learn more now.

Commerce Product Price Update Event Handler

Vote:
 
Version 8
We had a qestion regarding even handlers for catalog updates. At the moment we have a requirement for re-indexing any product that is updated. For this we are using the following feature available -

http://world.episerver.com/documentation/Class-library/?documentId=commerce/8/85A3C683
http://sdk.episerver.com/commerce/1.1.1/Content/Developers%20Guide/Catalog%20System/Catalog%20How%20To%20Code%20Samples/Writing%20Event%20Handlers.htm

and you use some code like below 

CatalogEventBroadcaster.Instance.LocalEntryUpdated += LocalEntryUpdated;

The above works perfectly fine and triggers when content is published.  There is also a method to track relation updates when a variant is added to a product which also works fine.

However we have noticed that the price updates don't seem to trigger any of the above and there is no way to attach an event to price updates. This is critical for us as we need to do two critical things on price updates 

a) Reindex the product in EPiserver find immediately and 
b) Create a price history log.

Also just need a confirmation that if a content is publihed using the scheduler, will the event listners get trigger and would they re-index the product corectly.
#117437
Feb 20, 2015 16:32
Vote:
 

Hi,

Yes, price updates do not trigger events. If you want to handle events, you'll need to implement your own IPriceService and IPriceDetailService which will trigger events when you call save. I guess you can mimick what we are doing in PriceServiceDatabase and PriceDetailDatabase and add relevant events.

More information can be found here:

http://world.episerver.com/Forum/Developer-forum/EPiServer-Commerce/Thread-Container/2014/5/Custom-Pricing-Provider/

Regards.

/Q

#117439
Feb 20, 2015 16:44
Vote:
 

Hi Sandeep

I have just blogged about a potential solution for this: http://david-t.ec/1B4qZ1c

David

#117555
Feb 23, 2015 10:24
Vote:
 

Hi David

Thanks for the solution. I have tested and it seems to trigger correctly. Will let you know if there are any further issues.

Kind Regards

Sandeep

#117854
Feb 23, 2015 12:05
Vote:
 

Thanks Sandeep, if it works for you please can you mark as answered so the comminity can benefit.

David

#117859
Feb 23, 2015 13:01
Vote:
 

Hi,

Stay tuned for Commerce 8.15, will be released in a couple of days. It will have new API:s to listen and fire events when prices and inventories are updated.

More information can be found here: http://world.episerver.com/blogs/Quan-Mai/Dates/2015/7/new-events-for-price-and-inventory-updates/

Regards,

/Q

#131416
Jul 23, 2015 17:27
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.