我想使用插件在类别主页中显示最常见的类别明智产品。
我在控制器中添加了代码
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]
我已在CategoryTemplate.ProductsInGridOrLines.cshtml
@Html.Action("CategoryHomepageCategorywiseMostViewedProduct", "ProductMostviewedController", new { categoryid = Model.Id })
但是我遇到了错误:
"NetworkError: 500 Internal Server Error - The controller for path '/jewelry' was not found or does not implement IController.
所以请告诉我有什么问题?
提前谢谢。
答案 0 :(得分:4)
@Html.Action("CategoryHomepageCategorywiseMostViewedProduct",
"ProductMostviewedController", new { categoryid = Model.Id })
我看到你把" ProductMostviewedControlller ",实际应该是" ProductMostviewed " (没有控制器一词)。
:)