Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nopcommerce MVC Route Explain

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

I don't know where is the code convert categories to c

Please help me to learn MVC via nopcommerce.

like image 569
Green Avatar asked Jan 17 '23 09:01

Green


1 Answers

  1. Open \Presentation\Nop.Web\Infrastructure\RouteProvider.cs file
  2. 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 \Libraries\Nop.Services\Seo\SitemapGenerator.cs file (replace {0}c/{1}/{2} with {0}categories/{1}/{2})

like image 143
Andrei M Avatar answered Jan 26 '23 04:01

Andrei M