public override void Process(ActiveCommerce.Prices.Pipelines.GetProductTotals.GetProductTotalsArgs args) { var shopContext = Sitecore.Ecommerce.Context.Entity.Resolve <Sitecore.Ecommerce.ShopContext>(); var settings = shopContext.GetGeneralSettings() as ActiveCommerce.Training.PriceTesting.Configuration.GeneralSettings; if (settings == null) { Sitecore.Diagnostics.Log.Warn("GetPricingRulePrice: General Settings did not resolve to correct type", this); return; } var ruleContext = new PricingRuleContext { Cart = Sitecore.Ecommerce.Context.Entity.GetInstance <ShoppingCart>() as ActiveCommerce.Carts.ShoppingCart, }; settings.PricingRules.Run(ruleContext); if (string.IsNullOrEmpty(ruleContext.PriceLevel)) { return; } PriceName = ruleContext.PriceLevel; var price = GetPrice(args.Product.PriceXml); if (!price.HasValue) { return; } args.Totals.PriceExVat = price.Value; args.Totals.DiscountExVat = 0; args.HasPrice = true; }
public void Process(ActiveCommerce.Prices.Pipelines.GetProductTotals.GetProductTotalsArgs args) { var shopContext = Sitecore.Ecommerce.Context.Entity.Resolve <Sitecore.Ecommerce.ShopContext>(); var settings = shopContext.GetGeneralSettings() as GeneralSettings; if (settings == null) { Sitecore.Diagnostics.Log.Warn("GetPricingRulePrice: General Settings did not resolve to correct type", this); return; } var ruleContext = new PricingRuleContext { Item = args.Product.InnerItem, Cart = Sitecore.Ecommerce.Context.Entity.GetInstance <ShoppingCart>() as ActiveCommerce.Carts.ShoppingCart, GetProductTotalsArgs = args }; settings.PricingRules.Run(ruleContext); }