How to get override GetFinalPrice from plugin

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 years ago
yeah we tried what you suggested but didn't work.

Did you get a chance to write your own plugin for the same thing?
9 years ago
Will write it tonight UK time and let you know
9 years ago
Hello there,

Did you write the code and was that successful?
9 years ago
Nope, everything didn't go to plan.  Been unwell all weekend.  I have decided that for what I want, I need to create a new shipping plugin.
9 years ago
Hi,
I have same problem.
Is there any progress?
9 years ago
What is the problem, your service isn't getting called or you're still getting the circular reference error?
9 years ago
AndyMcKenna wrote:
What is the problem, your service isn't getting called or you're still getting the circular reference error?



In the same manner yes
8 years ago
Overriding PriceCalculationService  GetFinalPrice From plugin in
Nop 3.60


DependencyRegistrar;


builder.RegisterType<MyPriceCalculationService>().As<IPriceCalculationService>().InstancePerLifetimeScope();





public partial class MyPriceCalculationService : PriceCalculationService, IPriceCalculationService
{

            
                

#region Fields

        private readonly IWorkContext _workContext;
        private readonly IStoreContext _storeContext;
        private readonly IDiscountService _discountService;
        private readonly ICategoryService _categoryService;
        private readonly IManufacturerService _manufacturerService;
        private readonly IProductAttributeParser _productAttributeParser;
        private readonly IProductService _productService;
        private readonly ICacheManager _cacheManager;
        private readonly ShoppingCartSettings _shoppingCartSettings;
        private readonly CatalogSettings _catalogSettings;

#endregion

#region Ctor

public MyPriceCalculationService(IWorkContext workContext, IStoreContext storeContext,
            IDiscountService discountService,
            ICategoryService categoryService,
            IManufacturerService manufacturerService,
            IProductAttributeParser productAttributeParser,
            IProductService productService,
            ICacheManager cacheManager,
            ShoppingCartSettings shoppingCartSettings,
            CatalogSettings catalogSettings): base( workContext,  storeContext,
             discountService,
             categoryService,
             manufacturerService,
             productAttributeParser,
             productService,
             cacheManager,
             shoppingCartSettings,
             catalogSettings)
  {

   this._workContext = workContext;
            this._storeContext = storeContext;
            this._discountService = discountService;
            this._categoryService = categoryService;
            this._manufacturerService = manufacturerService;
            this._productAttributeParser = productAttributeParser;
            this._productService = productService;
            this._cacheManager = cacheManager;
            this._shoppingCartSettings = shoppingCartSettings;
            this._catalogSettings = catalogSettings;
  }
              
        
        #endregion

public override  decimal GetFinalPrice(Product product,
        Customer customer,
        decimal additionalCharge,
        bool includeDiscounts,
        int quantity,
        DateTime? rentalStartDate,
        DateTime? rentalEndDate,
        out decimal discountAmount,
        out Discount appliedDiscount)
         {

    Discount appliedDis = new Discount();
    appliedDiscount = appliedDis;
    discountAmount = decimal.Zero;

                ///new calculation logic
    decimal price = product.Price + 10; //just sample
    return price;
    }

            
}
}
8 years ago
Hello,

I'm trying establish overriding GetFinalPrice method, but without any success. I'm using Nop 3.50. I create plugin with DependancyRegistrar and service which overriding one method from PriceCalculation but method is not called. I check and that new service is registered.

I create like example before, but with no success!!

Please if someone could help me. I uploaded plugin with source code in link >>

Thanks in advance
8 years ago
I already resolve Issue. The problem was in one another plugin, which also implement IPricaCalculationService so my plugin never been hited.

And example above works fine.

Thanks
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.