Add / Modify a route?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
Hi All,

I would like to modify the URL for the "About us" page. Out of the box, this page would be accessible at: www.mysite.com/t/AboutUs. Where and What should I change/add in order for it to be www.mysite.com/About-us ?

I am running version 2.50

Thanks in advance.
11 years ago
if you edit the nop.wweb p[roject and crearte new controls and views, that should allow you to build the page you want. The problem is that as well as modifying the nopweb.dll, you will also need to create the view in the main web site.

Hope that helps.

I had to do this so I can put in a custome payment system as trying to create a plugin was getting me no where.
11 years ago
Hi Tokra30,

The AboutUs content, is being created by the "topics" section on the admin module. The URL is created "automatically" by this module.

Can you tell me (guide me step-by-step) how to overcome this? Like I mentioned before, I am new to MVC and I am finding it very hard to find my way around it.

Thanks.
11 years ago
Hi,

The way I got round the problem was to create static pages based on views then modify the corisponding controller, that may not be the best way of doing it but it was my solution.

Seen I am going to be the one looking after our site I am not two fushed about having to go in to the backend code and change things.

Not sure about rerouting traffic direclty from topics, that some thing one of the developers may be able to answer, I just did it that way.

I agree with you aboyt MVC been a little bit odd, I am new to it my self comming from a web forms (VB.net) background now moving to MVC C# is a little off putting, but as I said in some of my other post what I am working on at the moment is a very modified version of 2.5.

But going back to the point at hand. As I said you may be able to modify the routing command in the global.asx file but I will not take any responsabilay in any way for this buggering up your site.

If you do decide to make any modifications to the nop.web dll make sure that you backup your site firt. C# is not as forgiving as vb.net take that from some one who knows the pain you can get your self in to.

Also the site I beleve uses EF and that can be a tricky little bugger as well.

As I said one of the developers of nop may be a better person to ask as I said I just done it my way whitch may not be the correct way but as I said it got round the routing problems I was having.
11 years ago
Hi Tokra30,

Thanks so much for taking the time to answer. Let's wait and see if someone else can give us a different approach. If I find the solution myself, I will post it here. Stay tuned.

Take care,
11 years ago
The way I did it in 2.65 is:

Go in to the Infrastructure folder to edit the RouteProvider.cs

For example:

            //about page
            routes.MapLocalizedRoute("AboutPage",
                            "about",
                            new { controller = "About", action = "Index" },
                            new[] { "Nop.Web.Controllers" });


And then in my new about page view, I added:

        @Html.Action("TopicBlock", "Topic", new { systemName = "about" })

In this way, you can still keep the CMS features via topics but have the URL as domain.com/about
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.