The controller for path was not found or does not implement IController with nopcommerce

StackOverflow https://stackoverflow.com/questions/23307182

  •  09-07-2023
  •  | 
  •  

Question

i want to display most viewed category wise product in category home page using plugin.

i added code for that in controller

ProductMostviewedController.cs:

[ChildActionOnly]
        public ActionResult CategoryHomepageCategorywiseMostViewedProduct(int categoryid, int? productThumbPictureSize)
        {
            var categoryProduct = _productService.CategorywiseMostViewProduct(categoryid);
            var model = PrepareProductOverviewModels(categoryProduct, true, true, productThumbPictureSize)
                .ToList();
            return View("../Views/Catalog/CategoryTemplate.ProductsInGridOrLines.cshtml",model);
        }

        [NonAction]

i has already write code in CategoryTemplate.ProductsInGridOrLines.cshtml

@Html.Action("CategoryHomepageCategorywiseMostViewedProduct", "ProductMostviewedController", new { categoryid = Model.Id })

but i was got an error :

"NetworkError: 500 Internal Server Error - The controller for path '/jewelry' was not found or does not implement IController.

so please tell me what 's problem?

thank you in advance.

Was it helpful?

Solution

@Html.Action("CategoryHomepageCategorywiseMostViewedProduct", 
"ProductMostviewedController", new { categoryid = Model.Id })

I saw you put "ProductMostviewedControlller", which should actually be "ProductMostviewed" (without the word Controller).

:)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top