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

Posted: December 06, 2017 at 9:30 AM Quote #197329
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?
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: December 06, 2017 at 11:37 AM Quote #197336
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.
This post/answer is useful
1
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Raju Paladiya
Posted: December 07, 2017 at 3:03 AM Quote #197382
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.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: December 07, 2017 at 10:18 AM Quote #197433
What error you get ?
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Raju Paladiya
Premium support services
  • Dedicated premium support services provided by core developers are intended for persons who run mission critical websites, work on projects with tight deadlines, or want to get dedicated support.
Professional services
  • Want to open a new store? Want to take your store to the next level? Need a custom extension? We can customize nopCommerce to fit your store perfectly. Request a quote to get started.