Facing issue in service override.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 年 前
Hello All,

I am stuck on one of the issue. Can you please help me on this?

I have two plugins and in both plugins same service override but not override it's method.

My code is.

Plugin1
    public class Plugin1PriceCalculationService : PriceCalculationService
    {
        public Plugin1PriceCalculationService():base()
        {

        }

        public override decimal GetUnitPrice(ShoppingCartItem shoppingCartItem,
            bool includeDiscounts,
            out decimal discountAmount,
            out List<DiscountForCaching> appliedDiscounts)
        { }
    }

Plugin2
    public class Plugin2PriceCalculationService : PriceCalculationService
    {
        public Plugin2PriceCalculationService():base()
        {

        }

        public override decimal GetSubTotal(ShoppingCartItem shoppingCartItem,
           bool includeDiscounts,
           out decimal discountAmount,
           out List<DiscountForCaching> appliedDiscounts,
           out int? maximumDiscountQty)
        { }
    }

Base on above code I need to call both method. but call only one which plugin DependencyRegistrar Order is higher and the rest of all the methods are call from base.

Thanks.
4 年 前
This is the behaviour of .Net. Not related to nopCommerce. You have to call the method of the class which is kot executing, from the method which is executing. Follow examples here.  
https://www.akadia.com/services/dotnet_polymorphism.html
https://stackoverflow.com/questions/1152925/override-an-overridden-method-c
4 年 前
mhsjaber wrote:
This is the behaviour of .Net. Not related to nopCommerce. You have to call the method of the class which is kot executing, from the method which is executing. Follow examples here.  
https://www.akadia.com/services/dotnet_polymorphism.html
https://stackoverflow.com/questions/1152925/override-an-overridden-method-c


Hello mhsjaber,

I understand your answer.
But my question is different.

Same service I want to override but not it's all methods.
I.E.
In the service I have 5 Methods.

Default Service
  public partial class DefaultService : IDefaultService
  {
  
    public DefaultService()
    {}
    
    public virtual void Method1()
    {}
    
    public virtual void Method2()
    {}
    
    public virtual void Method3()
    {}
    
    public virtual void Method4()
    {}
    
    public virtual void Method4()
    {}
  }


Plugin1
    public class Default1Service : DefaultService
    {
        public Default1Service():base()
        {

        }
    
  public override void Method1()
  {}
        
    }

Plugin2
    public class Default2Service : DefaultService
    {
        public Default2Service():base()
        {

        }

        public override void Method2()
  {}
    }

I want to know in this case when my application is running "Method1()" and "Method2()" are calling from which place from plugin1, plugin2  or both.
4 年 前
p.d.dobariya12 wrote:
This is the behaviour of .Net. Not related to nopCommerce. You have to call the method of the class which is kot executing, from the method which is executing. Follow examples here.  
https://www.akadia.com/services/dotnet_polymorphism.html
https://stackoverflow.com/questions/1152925/override-an-overridden-method-c

Hello mhsjaber,

I understand your answer.
But my question is different.

Same service I want to override but not it's all methods.
I.E.
In the service I have 5 Methods.

Default Service
  public partial class DefaultService : IDefaultService
  {
  
    public DefaultService()
    {}
    
    public virtual void Method1()
    {}
    
    public virtual void Method2()
    {}
    
    public virtual void Method3()
    {}
    
    public virtual void Method4()
    {}
    
    public virtual void Method4()
    {}
  }


Plugin1
    public class Default1Service : DefaultService
    {
        public Default1Service():base()
        {

        }
    
  public override void Method1()
  {}
        
    }

Plugin2
    public class Default2Service : DefaultService
    {
        public Default2Service():base()
        {

        }

        public override void Method2()
  {}
    }

I want to know in this case when my application is running "Method1()" and "Method2()" are calling from which place from plugin1, plugin2  or both.


Sorry to interfere.

Method1() will call from the plugin1 and Method2() will call from plugin2 as you override these 2 methods, even if the plugin is not installed. We have a plugin where override the pictureservice from a Plugin and override maximum virtual methods like GetThumbUrl. So whenever GetThumbUrl method calls it is our plugin method get hit.

It also depends on the DI of the 2 plugins.
4 年 前
sina.islam wrote:
This is the behaviour of .Net. Not related to nopCommerce. You have to call the method of the class which is kot executing, from the method which is executing. Follow examples here.  
https://www.akadia.com/services/dotnet_polymorphism.html
https://stackoverflow.com/questions/1152925/override-an-overridden-method-c

Hello mhsjaber,

I understand your answer.
But my question is different.

Same service I want to override but not it's all methods.
I.E.
In the service I have 5 Methods.

Default Service
  public partial class DefaultService : IDefaultService
  {
  
    public DefaultService()
    {}
    
    public virtual void Method1()
    {}
    
    public virtual void Method2()
    {}
    
    public virtual void Method3()
    {}
    
    public virtual void Method4()
    {}
    
    public virtual void Method4()
    {}
  }


Plugin1
    public class Default1Service : DefaultService
    {
        public Default1Service():base()
        {

        }
    
  public override void Method1()
  {}
        
    }

Plugin2
    public class Default2Service : DefaultService
    {
        public Default2Service():base()
        {

        }

        public override void Method2()
  {}
    }

I want to know in this case when my application is running "Method1()" and "Method2()" are calling from which place from plugin1, plugin2  or both.

Sorry to interfere.

Method1() will call from the plugin1 and Method2() will call from plugin2 as you override these 2 methods, even if the plugin is not installed. We have a plugin where override the pictureservice from a Plugin and override maximum virtual methods like GetThumbUrl. So whenever GetThumbUrl method calls it is our plugin method get hit.

It also depends on the DI of the 2 plugins.


Thanks for quote.
I have install both the plugin but at a time call only one override method base on DependencyRegistrar Order
Whichever is higher.
I.E. Plugin1 Order is 11 and Plugin2 order 12 then call method2() from plugin2 and metho1() call from base not call from plugin1.

Or I will give a order 12 to plugin1 and 11 to plugin2 then it call method1() from plugin1 and method2() call from base.

this is the issue I am facing.
4 年 前
My bad you can not do that. Though you can achieve that by inheriting the plugin1 class at plugin2 and register the plugin2 as plugin1. But what will happen when plugin1 will be deleted? Plugin2 will also not work and error will happen as you need to add reference plugin1 at plugin2. It is order based. Here is an open discussion at Github https://github.com/nopSolutions/nopCommerce/issues/2805.
4 年 前
Yes this is a dilemma I am trying to understand as well.

I just finished a plugin and have overridden a number of functions. Rather than copy all the base code into my routines I did ensure I put my code and did my thing in the override, then called the base routine last. But for one override I could not do that and had to insert the base code into my override and change it to incorporate my code and not call the base.

Maybe some sort of nopCommerce policy to ensure there is a systematic approach to overriding in plugins.
I also thought of the idea of a pipeline. Where a number of plugins can attach to the pipeline (all override the base) and provided they have written the override as per policy then the base can in turn call routines in the pipeline (in theory in any order) then last of all the base.

I don’t know if there is a good solution for multiple plugins overriding the same base function ?
A solution for your case is I think some of the developers use a common plugin that is installed first that carries all the common overrides and each time they make a new plugin they need to modify the common plugin and they resolve the differences / conflicts in the code.

There are a couple of links on the discussion I'd also be interested to read others thoughts on this issue.

https://www.nopcommerce.com/boards/t/47433/plugin-override-service-virtual-method.aspx

https://stackoverflow.com/questions/50525834/nopcommerce-customization
3 年 前
p.d.dobariya12 wrote:
Hello All,

I am stuck on one of the issue. Can you please help me on this?

I have two plugins and in both plugins same service override but not override it's method.

My code is.

Plugin1
    public class Plugin1PriceCalculationService : PriceCalculationService
    {
        public Plugin1PriceCalculationService():base()
        {

        }

        public override decimal GetUnitPrice(ShoppingCartItem shoppingCartItem,
            bool includeDiscounts,
            out decimal discountAmount,
            out List<DiscountForCaching> appliedDiscounts)
        { }
    }

Plugin2
    public class Plugin2PriceCalculationService : PriceCalculationService
    {
        public Plugin2PriceCalculationService():base()
        {

        }

        public override decimal GetSubTotal(ShoppingCartItem shoppingCartItem,
           bool includeDiscounts,
           out decimal discountAmount,
           out List<DiscountForCaching> appliedDiscounts,
           out int? maximumDiscountQty)
        { }
    }

Base on above code I need to call both method. but call only one which plugin DependencyRegistrar Order is higher and the rest of all the methods are call from base.

Thanks.


For anyone still looking for a solution, there are multiple ways to do this.
One straight forward way this can be done -without fancy additional coding- is by using Autofac decorators.
See here about decorators

Yes it's bulky, yes it's hard to implement. Are those reasons not to use it? Of course not.
The ability to allow users the freedom to install plugins without the constant fear of breaking/losing functionality because of overridden services is much more important.

Here's an example that does not allow adding products with price 0 to shopping cart.

1. Register the decorator in your DependencyRegistrar

builder.RegisterDecorator<DShoppingCartService, IShoppingCartService>();


2. Create your service:


public class DShoppingCartService : IShoppingCartService
{
    private readonly IShoppingCartService _decorated;
    private readonly IDecoratorContext _context;
        
    private readonly ILocalizationService _localizationService;

    public DShoppingCartService(IShoppingCartService decorated, IDecoratorContext context, ILocalizationService localizationService)
    {
        this._decorated = decorated ?? throw new ArgumentNullException(nameof(decorated));
        this._context = context ?? throw new ArgumentNullException(nameof(context));

        _localizationService = localizationService;
    }

    public IList<string> AddToCart(Customer customer, Product product, ShoppingCartType shoppingCartType, int storeId, string attributesXml = null, decimal customerEnteredPrice = 0, DateTime? rentalStartDate = null, DateTime? rentalEndDate = null, int quantity = 1, bool addRequiredProducts = true)
    {
        if (customer == null)
            throw new ArgumentNullException(nameof(customer));

        if (product == null)
            throw new ArgumentNullException(nameof(product));

        var warnings = new List<string>();

        if (shoppingCartType == ShoppingCartType.ShoppingCart && !product.CustomerEntersPrice)
        {
            decimal price = GetUnitPrice(product,
                customer,
                shoppingCartType,
                1, attributesXml, customerEnteredPrice,
                rentalStartDate, rentalEndDate,
                true, out var _, out _);
            //var finalPriceWithDiscountBase = _taxService.GetProductPrice(product, finalPrice, out var _);
            //price = _currencyService.ConvertFromPrimaryStoreCurrency(finalPriceWithDiscountBase, _workContext.WorkingCurrency);

            if (price <= 0)
            {
                warnings.Add(_localizationService.GetResource("Products.CallForPrice"));
                return warnings;
            }
                
        }

        return _decorated.AddToCart(customer, product, shoppingCartType, storeId, attributesXml, customerEnteredPrice, rentalStartDate, rentalEndDate, quantity, addRequiredProducts);

    }

    public int DeleteExpiredShoppingCartItems(DateTime olderThanUtc)
    {
        return _decorated.DeleteExpiredShoppingCartItems(olderThanUtc);
    }

    public void DeleteShoppingCartItem(ShoppingCartItem shoppingCartItem, bool resetCheckoutData = true, bool ensureOnlyActiveCheckoutAttributes = false)
    {
        _decorated.DeleteShoppingCartItem(shoppingCartItem, resetCheckoutData, ensureOnlyActiveCheckoutAttributes);
    }

    public void DeleteShoppingCartItem(int shoppingCartItemId, bool resetCheckoutData = true, bool ensureOnlyActiveCheckoutAttributes = false)
    {
        _decorated.DeleteShoppingCartItem(shoppingCartItemId, resetCheckoutData, ensureOnlyActiveCheckoutAttributes);
    }

    public ShoppingCartItem FindShoppingCartItemInTheCart(IList<ShoppingCartItem> shoppingCart, ShoppingCartType shoppingCartType, Product product, string attributesXml = "", decimal customerEnteredPrice = 0, DateTime? rentalStartDate = null, DateTime? rentalEndDate = null)
    {
        return _decorated.FindShoppingCartItemInTheCart(shoppingCart, shoppingCartType, product, attributesXml, customerEnteredPrice, rentalStartDate, rentalEndDate);
    }

    public IEnumerable<Product> GetProductsRequiringProduct(IList<ShoppingCartItem> cart, Product product)
    {
        return _decorated.GetProductsRequiringProduct(cart, product);
    }

    public string GetRecurringCycleInfo(IList<ShoppingCartItem> shoppingCart, out int cycleLength, out RecurringProductCyclePeriod cyclePeriod, out int totalCycles)
    {
        return _decorated.GetRecurringCycleInfo(shoppingCart, out cycleLength, out cyclePeriod, out totalCycles);
    }

    public IList<string> GetRentalProductWarnings(Product product, DateTime? rentalStartDate = null, DateTime? rentalEndDate = null)
    {
        return _decorated.GetRentalProductWarnings(product, rentalStartDate, rentalEndDate);
    }

    public IList<string> GetRequiredProductWarnings(Customer customer, ShoppingCartType shoppingCartType, Product product, int storeId, int quantity, bool addRequiredProducts, int shoppingCartItemId)
    {
        return _decorated.GetRequiredProductWarnings(customer, shoppingCartType, product, storeId, quantity, addRequiredProducts, shoppingCartItemId);
    }

    public IList<ShoppingCartItem> GetShoppingCart(Customer customer, ShoppingCartType? shoppingCartType = null, int storeId = 0, int? productId = null, DateTime? createdFromUtc = null, DateTime? createdToUtc = null)
    {
        return _decorated.GetShoppingCart(customer, shoppingCartType, storeId, productId, createdFromUtc, createdToUtc);
    }

    public IList<string> GetShoppingCartItemAttributeWarnings(Customer customer, ShoppingCartType shoppingCartType, Product product, int quantity = 1, string attributesXml = "", bool ignoreNonCombinableAttributes = false, bool ignoreConditionMet = false)
    {
        return _decorated.GetShoppingCartItemAttributeWarnings(customer, shoppingCartType, product, quantity, attributesXml, ignoreNonCombinableAttributes, ignoreConditionMet);
    }

    public IList<string> GetShoppingCartItemGiftCardWarnings(ShoppingCartType shoppingCartType, Product product, string attributesXml)
    {
        return _decorated.GetShoppingCartItemGiftCardWarnings(shoppingCartType, product, attributesXml);
    }

    public IList<string> GetShoppingCartItemWarnings(Customer customer, ShoppingCartType shoppingCartType, Product product, int storeId, string attributesXml, decimal customerEnteredPrice, DateTime? rentalStartDate = null, DateTime? rentalEndDate = null, int quantity = 1, bool addRequiredProducts = true, int shoppingCartItemId = 0, bool getStandardWarnings = true, bool getAttributesWarnings = true, bool getGiftCardWarnings = true, bool getRequiredProductWarnings = true, bool getRentalWarnings = true)
    {
        return _decorated.GetShoppingCartItemWarnings(customer, shoppingCartType, product, storeId, attributesXml, customerEnteredPrice, rentalStartDate, rentalEndDate, quantity, addRequiredProducts, shoppingCartItemId, getStandardWarnings, getAttributesWarnings, getGiftCardWarnings, getRequiredProductWarnings, getRentalWarnings);
    }

    public IList<string> GetShoppingCartWarnings(IList<ShoppingCartItem> shoppingCart, string checkoutAttributesXml, bool validateCheckoutAttributes)
    {
        return _decorated.GetShoppingCartWarnings(shoppingCart, checkoutAttributesXml, validateCheckoutAttributes);
    }

    public IList<string> GetStandardWarnings(Customer customer, ShoppingCartType shoppingCartType, Product product, string attributesXml, decimal customerEnteredPrice, int quantity)
    {
        return _decorated.GetStandardWarnings(customer, shoppingCartType, product, attributesXml, customerEnteredPrice, quantity);
    }

    public decimal GetSubTotal(ShoppingCartItem shoppingCartItem, bool includeDiscounts = true)
    {
        return _decorated.GetSubTotal(shoppingCartItem, includeDiscounts);
    }

    public decimal GetSubTotal(ShoppingCartItem shoppingCartItem, bool includeDiscounts, out decimal discountAmount, out List<Discount> appliedDiscounts, out int? maximumDiscountQty)
    {
        return _decorated.GetSubTotal(shoppingCartItem, includeDiscounts, out discountAmount, out appliedDiscounts, out maximumDiscountQty);
    }

    public decimal GetUnitPrice(ShoppingCartItem shoppingCartItem, bool includeDiscounts = true)
    {
        return _decorated.GetUnitPrice(shoppingCartItem, includeDiscounts);
    }

    public decimal GetUnitPrice(ShoppingCartItem shoppingCartItem, bool includeDiscounts, out decimal discountAmount, out List<Discount> appliedDiscounts)
    {
        return _decorated.GetUnitPrice(shoppingCartItem, includeDiscounts, out discountAmount, out appliedDiscounts);
    }

    public decimal GetUnitPrice(Product product, Customer customer, ShoppingCartType shoppingCartType, int quantity, string attributesXml, decimal customerEnteredPrice, DateTime? rentalStartDate, DateTime? rentalEndDate, bool includeDiscounts, out decimal discountAmount, out List<Discount> appliedDiscounts)
    {
        return _decorated.GetUnitPrice(product, customer, shoppingCartType, quantity, attributesXml, customerEnteredPrice, rentalStartDate, rentalEndDate, includeDiscounts, out discountAmount, out appliedDiscounts);
    }

    public void MigrateShoppingCart(Customer fromCustomer, Customer toCustomer, bool includeCouponCodes)
    {
        _decorated.MigrateShoppingCart(fromCustomer, toCustomer, includeCouponCodes);
    }

    public bool ShoppingCartIsRecurring(IList<ShoppingCartItem> shoppingCart)
    {
        return _decorated.ShoppingCartIsRecurring(shoppingCart);
    }

    public bool ShoppingCartRequiresShipping(IList<ShoppingCartItem> shoppingCart)
    {
        return _decorated.ShoppingCartRequiresShipping(shoppingCart);
    }

    public IList<string> UpdateShoppingCartItem(Customer customer, int shoppingCartItemId, string attributesXml, decimal customerEnteredPrice, DateTime? rentalStartDate = null, DateTime? rentalEndDate = null, int quantity = 1, bool resetCheckoutData = true)
    {
        return _decorated.UpdateShoppingCartItem(customer, shoppingCartItemId, attributesXml, customerEnteredPrice, rentalStartDate, rentalEndDate, quantity, resetCheckoutData);
    }
}
2 年 前
alinmircea wrote:
Hello All,

I am stuck on one of the issue. Can you please help me on this?

I have two plugins and in both plugins same service override but not override it's method.

My code is.

Plugin1
    public class Plugin1PriceCalculationService : PriceCalculationService
    {
        public Plugin1PriceCalculationService():base()
        {

        }

        public override decimal GetUnitPrice(ShoppingCartItem shoppingCartItem,
            bool includeDiscounts,
            out decimal discountAmount,
            out List<DiscountForCaching> appliedDiscounts)
        { }
    }

Plugin2
    public class Plugin2PriceCalculationService : PriceCalculationService
    {
        public Plugin2PriceCalculationService():base()
        {

        }

        public override decimal GetSubTotal(ShoppingCartItem shoppingCartItem,
           bool includeDiscounts,
           out decimal discountAmount,
           out List<DiscountForCaching> appliedDiscounts,
           out int? maximumDiscountQty)
        { }
    }

Base on above code I need to call both method. but call only one which plugin DependencyRegistrar Order is higher and the rest of all the methods are call from base.

Thanks.

For anyone still looking for a solution, there are multiple ways to do this.
One straight forward way this can be done -without fancy additional coding- is by using Autofac decorators.
See here about decorators

Yes it's bulky, yes it's hard to implement. Are those reasons not to use it? Of course not.
The ability to allow users the freedom to install plugins without the constant fear of breaking/losing functionality because of overridden services is much more important.

Here's an example that does not allow adding products with price 0 to shopping cart.

1. Register the decorator in your DependencyRegistrar

builder.RegisterDecorator<DShoppingCartService, IShoppingCartService>();


2. Create your service:


public class DShoppingCartService : IShoppingCartService
{
    private readonly IShoppingCartService _decorated;
    private readonly IDecoratorContext _context;
        
    private readonly ILocalizationService _localizationService;

    public DShoppingCartService(IShoppingCartService decorated, IDecoratorContext context, ILocalizationService localizationService)
    {
        this._decorated = decorated ?? throw new ArgumentNullException(nameof(decorated));
        this._context = context ?? throw new ArgumentNullException(nameof(context));

        _localizationService = localizationService;
    }

    public IList<string> AddToCart(Customer customer, Product product, ShoppingCartType shoppingCartType, int storeId, string attributesXml = null, decimal customerEnteredPrice = 0, DateTime? rentalStartDate = null, DateTime? rentalEndDate = null, int quantity = 1, bool addRequiredProducts = true)
    {
        if (customer == null)
            throw new ArgumentNullException(nameof(customer));

        if (product == null)
            throw new ArgumentNullException(nameof(product));

        var warnings = new List<string>();

        if (shoppingCartType == ShoppingCartType.ShoppingCart && !product.CustomerEntersPrice)
        {
            decimal price = GetUnitPrice(product,
                customer,
                shoppingCartType,
                1, attributesXml, customerEnteredPrice,
                rentalStartDate, rentalEndDate,
                true, out var _, out _);
            //var finalPriceWithDiscountBase = _taxService.GetProductPrice(product, finalPrice, out var _);
            //price = _currencyService.ConvertFromPrimaryStoreCurrency(finalPriceWithDiscountBase, _workContext.WorkingCurrency);

            if (price <= 0)
            {
                warnings.Add(_localizationService.GetResource("Products.CallForPrice"));
                return warnings;
            }
                
        }

        return _decorated.AddToCart(customer, product, shoppingCartType, storeId, attributesXml, customerEnteredPrice, rentalStartDate, rentalEndDate, quantity, addRequiredProducts);

    }

    public int DeleteExpiredShoppingCartItems(DateTime olderThanUtc)
    {
        return _decorated.DeleteExpiredShoppingCartItems(olderThanUtc);
    }

    public void DeleteShoppingCartItem(ShoppingCartItem shoppingCartItem, bool resetCheckoutData = true, bool ensureOnlyActiveCheckoutAttributes = false)
    {
        _decorated.DeleteShoppingCartItem(shoppingCartItem, resetCheckoutData, ensureOnlyActiveCheckoutAttributes);
    }

    public void DeleteShoppingCartItem(int shoppingCartItemId, bool resetCheckoutData = true, bool ensureOnlyActiveCheckoutAttributes = false)
    {
        _decorated.DeleteShoppingCartItem(shoppingCartItemId, resetCheckoutData, ensureOnlyActiveCheckoutAttributes);
    }

    public ShoppingCartItem FindShoppingCartItemInTheCart(IList<ShoppingCartItem> shoppingCart, ShoppingCartType shoppingCartType, Product product, string attributesXml = "", decimal customerEnteredPrice = 0, DateTime? rentalStartDate = null, DateTime? rentalEndDate = null)
    {
        return _decorated.FindShoppingCartItemInTheCart(shoppingCart, shoppingCartType, product, attributesXml, customerEnteredPrice, rentalStartDate, rentalEndDate);
    }

    public IEnumerable<Product> GetProductsRequiringProduct(IList<ShoppingCartItem> cart, Product product)
    {
        return _decorated.GetProductsRequiringProduct(cart, product);
    }

    public string GetRecurringCycleInfo(IList<ShoppingCartItem> shoppingCart, out int cycleLength, out RecurringProductCyclePeriod cyclePeriod, out int totalCycles)
    {
        return _decorated.GetRecurringCycleInfo(shoppingCart, out cycleLength, out cyclePeriod, out totalCycles);
    }

    public IList<string> GetRentalProductWarnings(Product product, DateTime? rentalStartDate = null, DateTime? rentalEndDate = null)
    {
        return _decorated.GetRentalProductWarnings(product, rentalStartDate, rentalEndDate);
    }

    public IList<string> GetRequiredProductWarnings(Customer customer, ShoppingCartType shoppingCartType, Product product, int storeId, int quantity, bool addRequiredProducts, int shoppingCartItemId)
    {
        return _decorated.GetRequiredProductWarnings(customer, shoppingCartType, product, storeId, quantity, addRequiredProducts, shoppingCartItemId);
    }

    public IList<ShoppingCartItem> GetShoppingCart(Customer customer, ShoppingCartType? shoppingCartType = null, int storeId = 0, int? productId = null, DateTime? createdFromUtc = null, DateTime? createdToUtc = null)
    {
        return _decorated.GetShoppingCart(customer, shoppingCartType, storeId, productId, createdFromUtc, createdToUtc);
    }

    public IList<string> GetShoppingCartItemAttributeWarnings(Customer customer, ShoppingCartType shoppingCartType, Product product, int quantity = 1, string attributesXml = "", bool ignoreNonCombinableAttributes = false, bool ignoreConditionMet = false)
    {
        return _decorated.GetShoppingCartItemAttributeWarnings(customer, shoppingCartType, product, quantity, attributesXml, ignoreNonCombinableAttributes, ignoreConditionMet);
    }

    public IList<string> GetShoppingCartItemGiftCardWarnings(ShoppingCartType shoppingCartType, Product product, string attributesXml)
    {
        return _decorated.GetShoppingCartItemGiftCardWarnings(shoppingCartType, product, attributesXml);
    }

    public IList<string> GetShoppingCartItemWarnings(Customer customer, ShoppingCartType shoppingCartType, Product product, int storeId, string attributesXml, decimal customerEnteredPrice, DateTime? rentalStartDate = null, DateTime? rentalEndDate = null, int quantity = 1, bool addRequiredProducts = true, int shoppingCartItemId = 0, bool getStandardWarnings = true, bool getAttributesWarnings = true, bool getGiftCardWarnings = true, bool getRequiredProductWarnings = true, bool getRentalWarnings = true)
    {
        return _decorated.GetShoppingCartItemWarnings(customer, shoppingCartType, product, storeId, attributesXml, customerEnteredPrice, rentalStartDate, rentalEndDate, quantity, addRequiredProducts, shoppingCartItemId, getStandardWarnings, getAttributesWarnings, getGiftCardWarnings, getRequiredProductWarnings, getRentalWarnings);
    }

    public IList<string> GetShoppingCartWarnings(IList<ShoppingCartItem> shoppingCart, string checkoutAttributesXml, bool validateCheckoutAttributes)
    {
        return _decorated.GetShoppingCartWarnings(shoppingCart, checkoutAttributesXml, validateCheckoutAttributes);
    }

    public IList<string> GetStandardWarnings(Customer customer, ShoppingCartType shoppingCartType, Product product, string attributesXml, decimal customerEnteredPrice, int quantity)
    {
        return _decorated.GetStandardWarnings(customer, shoppingCartType, product, attributesXml, customerEnteredPrice, quantity);
    }

    public decimal GetSubTotal(ShoppingCartItem shoppingCartItem, bool includeDiscounts = true)
    {
        return _decorated.GetSubTotal(shoppingCartItem, includeDiscounts);
    }

    public decimal GetSubTotal(ShoppingCartItem shoppingCartItem, bool includeDiscounts, out decimal discountAmount, out List<Discount> appliedDiscounts, out int? maximumDiscountQty)
    {
        return _decorated.GetSubTotal(shoppingCartItem, includeDiscounts, out discountAmount, out appliedDiscounts, out maximumDiscountQty);
    }

    public decimal GetUnitPrice(ShoppingCartItem shoppingCartItem, bool includeDiscounts = true)
    {
        return _decorated.GetUnitPrice(shoppingCartItem, includeDiscounts);
    }

    public decimal GetUnitPrice(ShoppingCartItem shoppingCartItem, bool includeDiscounts, out decimal discountAmount, out List<Discount> appliedDiscounts)
    {
        return _decorated.GetUnitPrice(shoppingCartItem, includeDiscounts, out discountAmount, out appliedDiscounts);
    }

    public decimal GetUnitPrice(Product product, Customer customer, ShoppingCartType shoppingCartType, int quantity, string attributesXml, decimal customerEnteredPrice, DateTime? rentalStartDate, DateTime? rentalEndDate, bool includeDiscounts, out decimal discountAmount, out List<Discount> appliedDiscounts)
    {
        return _decorated.GetUnitPrice(product, customer, shoppingCartType, quantity, attributesXml, customerEnteredPrice, rentalStartDate, rentalEndDate, includeDiscounts, out discountAmount, out appliedDiscounts);
    }

    public void MigrateShoppingCart(Customer fromCustomer, Customer toCustomer, bool includeCouponCodes)
    {
        _decorated.MigrateShoppingCart(fromCustomer, toCustomer, includeCouponCodes);
    }

    public bool ShoppingCartIsRecurring(IList<ShoppingCartItem> shoppingCart)
    {
        return _decorated.ShoppingCartIsRecurring(shoppingCart);
    }

    public bool ShoppingCartRequiresShipping(IList<ShoppingCartItem> shoppingCart)
    {
        return _decorated.ShoppingCartRequiresShipping(shoppingCart);
    }

    public IList<string> UpdateShoppingCartItem(Customer customer, int shoppingCartItemId, string attributesXml, decimal customerEnteredPrice, DateTime? rentalStartDate = null, DateTime? rentalEndDate = null, int quantity = 1, bool resetCheckoutData = true)
    {
        return _decorated.UpdateShoppingCartItem(customer, shoppingCartItemId, attributesXml, customerEnteredPrice, rentalStartDate, rentalEndDate, quantity, resetCheckoutData);
    }
}



How did you registered your decorator in DependencyRegistrar ?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.