URL routing

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
10 anos atrás
Hi guys!

Question for Nop 3.1
I want to build next URL for products:

"{CategoryName}/{SeName}"


So {CategoryName} is dynamically value.
I will use a separate controller and action (Not "Catalog" controller and not "Product" action).
How to implement it?

I have tried:

routes.MapLocalizedRoute("CategoryProduct",
      "{CategoryName}/{SeName}",
       new { controller = "MyController", action = "Product" },
       new[] { "Nop.Web.Controllers" });


But inside "GenericPathRoute.GetRouteData(HttpContextBase httpContext)" RouteData object always null, so I can't get UrlRecord object.

Thanks!
10 anos atrás
Hi,

Found my mistake.
Need add something like this:


routes.MapGenericPathRoute("GenericEntityUrl",
          "{entity_name}/{generic_se_name}",
           new { controller = "MyController", action = "GenericUrl" },
           new[] { "Nop.Web.Controllers" });
10 anos atrás
Hi, I need to add the category name in my urls as well, such as mysite.com/categoryname/productname.

Can you explain a bit more details on how you accomplished this?

Thanks,
KT
9 anos atrás
I'm also trying to get the www.mysite.com/CategoryName/Product URL working.

After reading through this:
http://www.pronopcommerce.com/nopcommerce-id-less-url-structure-demystified-how-does-nopcommerce-270-and-280-resolve-urls


It's apparent that there's more to be done than just this:

routes.MapLocalizedRoute("CategoryProduct",
      "{CategoryName}/{SeName}",
       new { controller = "MyController", action = "Product" },
       new[] { "Nop.Web.Controllers" });


{CategoryName}/{Product} is the recommended URL format from Google for SEO best practices.  Has anyone else accomplished this in nop 3.1?  

Thanks in advance!
9 anos atrás
rread wrote:
I'm also trying to get the www.mysite.com/CategoryName/Product URL working.

After reading through this:
http://www.pronopcommerce.com/nopcommerce-id-less-url-structure-demystified-how-does-nopcommerce-270-and-280-resolve-urls


It's apparent that there's more to be done than just this:

routes.MapLocalizedRoute("CategoryProduct",
      "{CategoryName}/{SeName}",
       new { controller = "MyController", action = "Product" },
       new[] { "Nop.Web.Controllers" });


{CategoryName}/{Product} is the recommended URL format from Google for SEO best practices.  Has anyone else accomplished this in nop 3.1?  

Thanks in advance!


I am preparing a blog post on this. Will announce it once I am done. :)
9 anos atrás
The blogpost is now posted at http://www.pronopcommerce.com/hierarchical-product-url-with-category-breadcrum-in-the-url-in-nopcommerce

Enjoy! :)
9 anos atrás
wooncherk wrote:

Perfect!  I've got the code hooked in and am going through and updating all of my product URLs.

Thanks!
9 anos atrás
Hi wooncherk,

I am trying to create a plugin which will override the TopicsDetails.cshtml page. I added a route like this:

          routes.MapRoute("Nop.Plugin.Other.CustomTopic.ViewCustomTopic", "{SeName}",
                            new { controller = "CustomTopic", action = "TopicDetails", SeName = UrlParameter.Optional },
                            new[] { "Nop.Plugin.Other.CustomTopic.Controllers" });

This is getting all the {SeName} to my CustomTopicController .Even the products SeName.


If I add this instead of the older one:

           routes.MapRoute("Nop.Plugin.Other.CustomTopic.ViewCustomTopic",
                            new { controller = "CustomTopic", action = "TopicDetails" },
                            new[] { "Nop.Plugin.Other.CustomTopic.Controllers" });

I get an error because the TopicDetails(int itemId) Action receives an integer which is not provided as we know that GenericPathRoutes.cs Provides that integer.

How can I override the Rules of GenericPathRoutes.cs to do it so that only the topic SeName would hit my Controller or is there other way to do that kind of work or is it even possible to do?
9 anos atrás
Hi there,

I need some help to understand the routing issue for the admin plugin controller.
I have developed a plugin which adds a custom tab to the product tab strip in the admin area.
While my tab loading I should receive the tab content from the controller by request.
I have tied a different urls to get to the controller, but I received 404 error (not found).
Should I change or create routing for my controller?
If yes, please, suggest me how to do it.

The controller name: ProductPricesTabController
The namespace: Nop.Plugin.Admin.ProductPricesTab.Controllers
The method in the controller class I want to reach: GetTabContent()

What url should I provide to the ajax method in order to received the tab content?

Thank you.
6 anos atrás
Hi Everyone

Someone can tell me how can change URL path like  http://localhost:15536/ProductName/Category ,i am using nopcommerce 3.09,
Thanks & Regard
Rajnish
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.