Ihave two custom promotions setup which apply two seperate Episerver abstract classes; both of which I have also inheriting from an interface:
public class PromoA: BuyQuantityGetOrderDiscount, ICustomPromo
public class PromoB: BuyQuantityGetSelectedItemsDiscount, ICustomPromo
When I get to the point of checkout I get the generic PromotionData back but it doesn't tell me what custom promotion it is.
Does anyone know of a way to get this information.
Ie I need to know if the PromotionData is based on Promo A or Promo B.
Otherwise I have to go down the route of trying to cast the PromotionData to either of these type - and that will get very messy.
Could you load the PromotionData up and then check the FullName of the type? Something like:
var appliedPromotion = ContentLoader.Get<PromotionData>(PromotionGuid)var promotionFullName = appliedPromotion.GetType().FullNameif(FullName.Contains("PromoA")) doSomething()if(FullName.Contains("PromoB")) doSomethingElse()
Can't you just check
if (promoA is BuyQuantityGetOrderDiscount)
else if (promoA is BuyQuantityGetSelectedItemsDiscount)