【问题标题】:The controller for path was not found or does not implement IController with nopcommerce找不到路径的控制器或未使用 nopcommerce 实现 IController
【发布时间】:2014-04-26 05:47:36
【问题描述】:

我想使用插件在类别主页中显示查看次数最多的类别明智产品。

我在控制器中添加了代码

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.

那么请告诉我有什么问题?

提前谢谢你。

【问题讨论】:

  • 你有public class JewelryController : Controller { ... 吗?
  • 没有..但我有公共类 ProductMostviewedController : BaseNopController{....}
  • BaseNopController Controller 还是以其他方式实现 IController...
  • 我都尝试过,但结果相同
  • BaseNopController 继承自 Controller... :)

标签: nopcommerce


【解决方案1】:
@Html.Action("CategoryHomepageCategorywiseMostViewedProduct", 
"ProductMostviewedController", new { categoryid = Model.Id })

我看到你输入了“ProductMostviewedController”,实际上应该是“ProductMostviewed”(没有Controller这个词)。

:)

【讨论】:

    猜你喜欢
    • 2014-05-10
    • 2012-12-10
    • 2013-05-31
    • 1970-01-01
    • 2016-11-26
    • 1970-01-01
    • 1970-01-01
    • 2020-07-20
    相关资源
    最近更新 更多