Nopcommerce MVC Route Description

When running nopcommerce 2.4.0, I get the link localhost:7725/c/2/computers instead of localhost:7725/categories/2/computers

I don't know where the code converts categories to c

Please help me learn MVC through nopcommerce.

+4
source share
1 answer
  • Open the \Presentation\Nop.Web\Infrastructure\RouteProvider.cs file
  • To find
  routes.MapLocalizedRoute ("Category",
                  "** c ** / {categoryId} / {SeName}",
                  new {controller = "Catalog", action = "Category", SeName = UrlParameter.Optional},
                  new {categoryId = @ "\ d +"},
                  new [] {"Nop.Web.Controllers"});

and replace it with

 routes.MapLocalizedRoute("Category", "categories/{categoryId}/{SeName}", new { controller = "Catalog", action = "Category", SeName = UrlParameter.Optional }, new { categoryId = @"\d+" }, new[] { "Nop.Web.Controllers" }); 

3. Do almost the same in the \Libraries\Nop.Services\Seo\SitemapGenerator.cs (replace {0}c/{1}/{2} with {0}categories/{1}/{2} )

+7
source

Source: https://habr.com/ru/post/1398197/


All Articles