I know how to retrieve one promotion (using IContentLoader)... But, how can I easily get a collection of ALL promotions at runtime?
Using the same APIs. Discounts (=promotions) are children of Campaigns (or SalesCampaigns). And you cannot create a SalesCampaign with another SalesCampaign as parent, hence it's only two levels. So just interate all the campaigns and then get the children of all of them. Like so
var salesCampaigns = _contentLoader.GetChildren<SalesCampaign>(SalesCampaignFolder.CampaignRoot);
var allPromotions = new List<PromotionData>();
foreach (var salesCampaign in salesCampaigns)
Ah, I see. That had crossed my mind after your answer on my other question ;) But, wasn't sure if it's the preferred way so I decided to ask :)
Thanks again Joel,
PromotionEngineContentLoader.GetPromotions should do that for you. But if you want to write some code yourself, then Joel's answer is correct.
Sounds good to me!
Isn't that one internal? Reason I didn't recommend it is that I thought it was internal :P