"Product" route but where is this?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
I saw a lot of routes using "Product" route name, however; I can't find where in nopcommerce is the registered.

Url.RouteUrl("Product", new {SeName = Model.SeName})


can anyone share something on where this "Product" route is registered?
6 years ago
Good Question. I also want to know this. Thanks
6 years ago
archie748491 wrote:
I saw a lot of routes using "Product" route name, however; I can't find where in nopcommerce is the registered.

Url.RouteUrl("Product", new {SeName = Model.SeName})


can anyone share something on where this "Product" route is registered?


\Presentation\Nop.Web\Infrastructure\GenericUrlRouteProvider.cs
6 years ago
thank you...

I think that the route mentioned above is related to bellow code in class GenericPathRoute from C:\workspace\trunk\Presentation\Nop.Web.Framework\Seo


                        case "product":
                        {
                            data.Values["controller"] = "Product";
                            data.Values["action"] = "ProductDetails";
                            data.Values["productid"] = urlRecord.EntityId;
                            data.Values["SeName"] = urlRecord.Slug;
                        }
                        break;

however; where and how GenericPathRoute function

        public override RouteData GetRouteData(HttpContextBase httpContext)

is called?

every time below code is clicked

<a href="@Url.RouteUrl("Product", new {SeName = Model.SeName})">@Model.Name</a>

it calls  

GetRouteData(HttpContextBase httpContext)






Regards,

Archie
6 years ago
archie748491 wrote:
thank you...

I think that the route mentioned above is related to bellow code in class GenericPathRoute from C:\workspace\trunk\Presentation\Nop.Web.Framework\Seo


                        case "product":
                        {
                            data.Values["controller"] = "Product";
                            data.Values["action"] = "ProductDetails";
                            data.Values["productid"] = urlRecord.EntityId;
                            data.Values["SeName"] = urlRecord.Slug;
                        }
                        break;

however; where and how GenericPathRoute function

        public override RouteData GetRouteData(HttpContextBase httpContext)

is called?

every time below code is clicked

<a href="@Url.RouteUrl("Product", new {SeName = Model.SeName})">@Model.Name</a>

it calls  

GetRouteData(HttpContextBase httpContext)

Regards,

Archie


See the the flowing  route ===>
 
//generic URLs
           routeBuilder.MapGenericPathRoute("GenericUrl", "{GenericSeName}",
                new { controller = "Common", action = "GenericUrl" });


   //define this routes to use in UI views (in case if you want to customize some of them later)
routeBuilder.MapLocalizedRoute("Product", "{SeName}",
                new { controller = "Product", action = "ProductDetails" });


And then a look on your found file "Presentation\Nop.Web.Framework\Seo  "
6 years ago
Your info is useful but I still don't understand how

public override RouteData GetRouteData(HttpContextBase httpContext)

under GenericPathRoute.cs we're called and how and when Nop.Web.Framework get involved in this?
6 years ago
archie748491 wrote:
Your info is useful but I still don't understand how

public override RouteData GetRouteData(HttpContextBase httpContext)

under GenericPathRoute.cs we're called and how and when Nop.Web.Framework get involved in this?


Read this article hope it will useful to you.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.