Hey,
I have ecommerce site where I set up products. Some products can be bundles.
The bundle price is calculated using each bundle item price.
For example:
Main product: Shower, Price : 0
Bundle item: Head, Price 100
Bundle item: Mixer, Price 200
So the total price of shower is 300.
I need this price for product ordering in the list (by price asc/desc) and for display in product details.
For this I created additional field in CMS.Product, called TotalPrice.
Then subscribed to global events...
DocumentEvents.Insert.Before += Document_Insert_Before;
DocumentEvents.Update.Before += Document_Update_Before;
DocumentEvents.Delete.Before += Document_Delete_Before;
And here problems starts:
1. Document_Update_Before does not see yet that bundle item was added or removed.. it happens later... Update.After event does not help too...
I am using: InfoDataSet<SKUInfo> items = SKUInfoProvider.GetBundleItems(product.SKUID);
This finally I solved by creating CustomBundleInfoProvider...
2. Document_Delete_Before - here I am trying to find all parent products to which document belongs as bundle item using such select:
select BundleID as ParentSkuID from COM_Bundle where SKUID = @deletedSkuId
and it seems that in Document.Before event these entries ALREADY removed, so I cannot find affected products anymore. And it looks like CustomBundleInfoProvider is not called at all.
Can you please advice, how can I reliable update document TotalPrice when changing child (bundle items) products.
I am using Kentico 7.34, web site.
regards
Mantas