运行nopcommerce 2.4.0时,我得到的链接是localhost:7725/c/2/computers
而不是localhost:7725/categories/2/computers
我不知道代码在哪里将类别转换为 c
请帮助我通过nopcommerce学习MVC。
答案 0 :(得分:7)
\Presentation\Nop.Web\Infrastructure\RouteProvider.cs
档案routes.MapLocalizedRoute("Category", "**c**/{categoryId}/{SeName}", new { controller = "Catalog", action = "Category", SeName = UrlParameter.Optional }, new { categoryId = @"\d+" }, new[] { "Nop.Web.Controllers" });
并将其替换为
routes.MapLocalizedRoute("Category",
"categories/{categoryId}/{SeName}",
new { controller = "Catalog", action = "Category", SeName = UrlParameter.Optional },
new { categoryId = @"\d+" },
new[] { "Nop.Web.Controllers" });
3。在\Libraries\Nop.Services\Seo\SitemapGenerator.cs
文件中执行几乎相同的操作(将{0}c/{1}/{2}
替换为{0}categories/{1}/{2}
)