I am trying and failing to override a method within the product controller in Nopcommerce.

In my plugin, I am extending the services classes successfully, however when it comes to overriding the product controller, I am having problems and it just doesn't hit the breakpoint.

So I am trying to override the virtual method PrepareProductDetailsPageModel in Nop.Web.Controllers.Product

    [NonAction]
    protected virtual ProductDetailsModel PrepareProductDetailsPageModel(Product product,
        ShoppingCartItem updatecartitem = null, bool isAssociatedProduct = false)
    {
    }

I am creating my new class ProductController.cs as:


public partial class ProductController :      Nop.Web.Controllers.ProductController
     {

     #region Fields

    private readonly ICategoryService _categoryService;
    private readonly IManufacturerService _manufacturerService;
    private readonly IProductService _productService;
    private readonly IVendorService _vendorService;
    private readonly IProductTemplateService _productTemplateService;
    private readonly IProductAttributeService _productAttributeService;
    private readonly IWorkContext _workContext;
    private readonly IStoreContext _storeContext;
    private readonly ITaxService _taxService;
    private readonly ICurrencyService _currencyService;
    private readonly IPictureService _pictureService;
    private readonly ILocalizationService _localizationService;
    private readonly IPriceCalculationService _priceCalculationService;
    private readonly IPriceFormatter _priceFormatter;
    private readonly IWebHelper _webHelper;
    private readonly ISpecificationAttributeService _specificationAttributeService;
    private readonly IDateTimeHelper _dateTimeHelper;
    private readonly IRecentlyViewedProductsService _recentlyViewedProductsService;
    private readonly ICompareProductsService _compareProductsService;
    private readonly IWorkflowMessageService _workflowMessageService;
    private readonly IProductTagService _productTagService;
    private readonly IOrderReportService _orderReportService;
    private readonly IBackInStockSubscriptionService _backInStockSubscriptionService;
    private readonly IAclService _aclService;
    private readonly IStoreMappingService _storeMappingService;
    private readonly IPermissionService _permissionService;
    private readonly ICustomerActivityService _customerActivityService;
    private readonly IProductAttributeParser _productAttributeParser;
    private readonly IShippingService _shippingService;
    private readonly MediaSettings _mediaSettings;
    private readonly CatalogSettings _catalogSettings;
    private readonly VendorSettings _vendorSettings;
    private readonly ShoppingCartSettings _shoppingCartSettings;
    private readonly LocalizationSettings _localizationSettings;
    private readonly CustomerSettings _customerSettings;
    private readonly CaptchaSettings _captchaSettings;
    private readonly SeoSettings _seoSettings;
    private readonly ICacheManager _cacheManager;

    #endregion

    #region Constructors

    public ProductController(ICategoryService categoryService,
        IManufacturerService manufacturerService,
        IProductService productService,
        IVendorService vendorService,
        IProductTemplateService productTemplateService,
        IProductAttributeService productAttributeService,
        IWorkContext workContext,
        IStoreContext storeContext,
        ITaxService taxService,
        ICurrencyService currencyService,
        IPictureService pictureService,
        ILocalizationService localizationService,
        IPriceCalculationService priceCalculationService,
        IPriceFormatter priceFormatter,
        IWebHelper webHelper,
        ISpecificationAttributeService specificationAttributeService,
        IDateTimeHelper dateTimeHelper,
        IRecentlyViewedProductsService recentlyViewedProductsService,
        ICompareProductsService compareProductsService,
        IWorkflowMessageService workflowMessageService,
        IProductTagService productTagService,
        IOrderReportService orderReportService,
        IBackInStockSubscriptionService backInStockSubscriptionService,
        IAclService aclService,
        IStoreMappingService storeMappingService,
        IPermissionService permissionService,
        ICustomerActivityService customerActivityService,
        IProductAttributeParser productAttributeParser,
        IShippingService shippingService,
        MediaSettings mediaSettings,
        CatalogSettings catalogSettings,
        VendorSettings vendorSettings,
        ShoppingCartSettings shoppingCartSettings,
        LocalizationSettings localizationSettings,
        CustomerSettings customerSettings,
        CaptchaSettings captchaSettings,
        SeoSettings seoSettings,
        ICacheManager cacheManager)
        : base(categoryService, manufacturerService, productService, vendorService, productTemplateService, productAttributeService,
            workContext, storeContext, taxService, currencyService, pictureService, localizationService, priceCalculationService, priceFormatter, webHelper, specificationAttributeService, dateTimeHelper,
            recentlyViewedProductsService, compareProductsService, workflowMessageService, productTagService, orderReportService, backInStockSubscriptionService, aclService, storeMappingService, permissionService,
            customerActivityService, productAttributeParser, shippingService, mediaSettings, catalogSettings, vendorSettings, shoppingCartSettings, localizationSettings, customerSettings, captchaSettings, seoSettings,
            cacheManager)
    {
        this._categoryService = categoryService;
        this._manufacturerService = manufacturerService;
        this._productService = productService;
        this._vendorService = vendorService;
        this._productTemplateService = productTemplateService;
        this._productAttributeService = productAttributeService;
        this._workContext = workContext;
        this._storeContext = storeContext;
        this._taxService = taxService;
        this._currencyService = currencyService;
        this._pictureService = pictureService;
        this._localizationService = localizationService;
        this._priceCalculationService = priceCalculationService;
        this._priceFormatter = priceFormatter;
        this._webHelper = webHelper;
        this._specificationAttributeService = specificationAttributeService;
        this._dateTimeHelper = dateTimeHelper;
        this._recentlyViewedProductsService = recentlyViewedProductsService;
        this._compareProductsService = compareProductsService;
        this._workflowMessageService = workflowMessageService;
        this._productTagService = productTagService;
        this._orderReportService = orderReportService;
        this._backInStockSubscriptionService = backInStockSubscriptionService;
        this._aclService = aclService;
        this._storeMappingService = storeMappingService;
        this._permissionService = permissionService;
        this._customerActivityService = customerActivityService;
        this._productAttributeParser = productAttributeParser;
        this._shippingService = shippingService;
        this._mediaSettings = mediaSettings;
        this._catalogSettings = catalogSettings;
        this._vendorSettings = vendorSettings;
        this._shoppingCartSettings = shoppingCartSettings;
        this._localizationSettings = localizationSettings;
        this._customerSettings = customerSettings;
        this._captchaSettings = captchaSettings;
        this._seoSettings = seoSettings;
        this._cacheManager = cacheManager;
    }

        protected override ProductDetailsModel PrepareProductDetailsPageModel(Product product, ShoppingCartItem updatecartitem = null, bool isAssociatedProduct = false)
        {
           return base.PrepareProductDetailsPageModel(product,
           updatecartitem, isAssociatedProduct);
        }
     }


However, this will not hit my overridden method.

Can anyone help out and please let me know what I am doing wrong.

When overriding the TaxService.cs I register my TaxService in DependencyRegistrar.

Is there something I should be doing for this controller?

Thanks for any help.