how to create link with nop 2.5

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 12 ans
I'm beginer with nop 2.5, today, I want to create link to click when user click on the link, It's will go to destination I like.
EX: I have page default.cshtml in views/Home
how can I define the link? (I'm sorry because, I'm begin to make friend with nop 2.5)

I saw on  HearderMenu (on Share)
<a href="@Url.RouteUrl("ShoppingCart")" class="ico-cart">@T("ShoppingCart")

It's mean: link to RouteProvider.cs
routes.MapLocalizedRoute("ShoppingCart",
                            "cart/",
                            new { controller = "ShoppingCart", action = "Cart" },
                            new[] { "Nop.Web.Controllers" });   <<< that's right?

1. I don't understand what's "cart/"
another example
<a href="@Url.RouteUrl("Product", new { productId = Model.Id, SeName = Model.SeName })">@Model.Name</a>

I don't see it's something like "cart/"


2. Why did it always have   new[] { "Nop.Web.Controllers" } but in admin don't have    new[] { "Nop.Admin.Controllers" }?? what's purpose?
Il y a 12 ans
[email protected] wrote:
I'm beginer with nop 2.5, today, I want to create link to click when user click on the link, It's will go to destination I like.
EX: I have page default.cshtml in views/Home
how can I define the link? (I'm sorry because, I'm begin to make friend with nop 2.5)

I saw on  HearderMenu (on Share)
<a href="@Url.RouteUrl("ShoppingCart")" class="ico-cart">@T("ShoppingCart")

It's mean: link to RouteProvider.cs
routes.MapLocalizedRoute("ShoppingCart",
                            "cart/",
                            new { controller = "ShoppingCart", action = "Cart" },
                            new[] { "Nop.Web.Controllers" });   <<< that's right?

1. I don't understand what's "cart/"
another example
<a href="@Url.RouteUrl("Product", new { productId = Model.Id, SeName = Model.SeName })">@Model.Name</a>

I don't see it's something like "cart/"


2. Why did it always have   new[] { "Nop.Web.Controllers" } but in admin don't have    new[] { "Nop.Admin.Controllers" }?? what's purpose?

You need to read up on MVC and now it works (http://www.asp.net/mvc).  Also MVC doesn't use default as the main file when loading it a view, it actually use Index.cshtml as the default file in the View Folder.

1. Cart is actually located in the ShoppingCart View folder (Nop.Web > Views > ShoppingCart > Cart.cshtml).
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.