Nop 3.9 override @Url.RouteUrl("Category", new { SeName = category.SeName })

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Hi!
I need override @Url.RouteUrl("Category", new { SeName = category.SeName }) - so it should pass me to my Action on Contoller. How to make this?
6 years ago
art_MOO wrote:
Hi!
I need override @Url.RouteUrl("Category", new { SeName = category.SeName }) - so it should pass me to my Action on Contoller. How to make this?


You can update Generic Route value from "\Presentation\Nop.Web.Framework\Seo\GenericPathRoute.cs"

change your controller and action method name in below section (line number around 163)
                    
case "category":
                        {
                            data.Values["controller"] = "Catalog";
                            data.Values["action"] = "Category";
                            data.Values["categoryid"] = urlRecord.EntityId;
                            data.Values["SeName"] = urlRecord.Slug;
                        }
                        break;


Hope it will work.
6 years ago
I tryed to override GenericPathRoute with extended class.
And i also add

            routes.CustomGenericPathRoute("FF.Plugin.Misc.SpeedFilters.Controllers.Category",
                 "{generic_se_name}",
                 new { controller = "SpeedFilters", action = "Category" },
                 new[] { "FF.Plugin.Misc.SpeedFilters.Controllers" });


So Category start to works, but for Product - i retrive error that there is muptiple ways - first to Nop.Web.Product and second to Nop.Admin.product.

I tryed to make it like


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


But no effect.
And i dont get how to solve this.
6 years ago
What error you get ?
6 years ago
hi,

i need new customproduct page how to create route i want this type

routes.MapLocalizedRoute("CustomProduct",
                          "{productId}/{SeName}",
                          new { controller = "CustomProduct", action = "CustomProductDetails" },
                          new { productId = @"\d+" },
                          new[] { "Nop.Web.Controllers" });

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

but its not working
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.