Plugin Developement ICategoryService Cannot be found

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
Every Service can be called except ICategoryService. I can clearly see ICategoryService under Nop.Services.Catalog but when calling it it says "ICategoryService cannot be found"


using Microsoft.AspNetCore.Mvc;
using Nop.Core;
using Nop.Core.Caching;
using Nop.Core.Domain.Catalog;
using Nop.Plugin.Widgets.MegaMenu.Models;
using Nop.Services.Catalog;
using Nop.Services.Configuration;
using Nop.Services.Media;
using Nop.Web.Framework.Components;
using System.Linq;


namespace Nop.Plugin.Widgets.MegaMenu.Components
{
  [ViewComponent(Name = "MegaMenu")]
  public class MegaMenuViewComponent : NopViewComponent
  {
    private readonly IStoreContext _storeContext;
    private readonly IStaticCacheManager _cacheManager;
    private readonly ISettingService _settingService;
    private readonly IPictureService _pictureService;
    private readonly ICategoryService _categoryService;

    public MegaMenuViewComponent(IStoreContext storeContext,
        IStaticCacheManager cacheManager,
        ISettingService settingService,
        IPictureService pictureService,
        ICategoryService categoryService)
    {
      this._storeContext = storeContext;
      this._cacheManager = cacheManager;
      this._settingService = settingService;
      this._pictureService = pictureService;
      this._categoryService = categoryService;
    }



public IViewComponentResult Invoke(string widgetZone, object additionalData)
    {
      var mCategories = new PublicInfoModel();

      var allCategories = _categoryService.GetAllCategories().Where(x => x.IncludeInTopMenu == true);
5 years ago
Solved. There is a bug in nopcommerce 4.1 for ICategoryService

The implementation in ICategoryService.cs for Nop.Service.Catalog;


public partial interface IList
{
  

Changed to:

public partial interface ICategoryService
{


Cleaned and Rebuilt Solution and all is working. Did nopCommerce forget to rename the service???
5 years ago
Looks fine to me -

https://github.com/nopSolutions/nopCommerce/blob/develop/src/Libraries/Nop.Services/Catalog/ICategoryService.cs
https://github.com/nopSolutions/nopCommerce/blob/develop/src/Libraries/Nop.Services/Catalog/CategoryService.cs
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.