Do we still use _AdminLayout.cshtml in plugins?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
dootchie wrote:
Great I'm glad it works!!

So if we want to display a page in a customers "my account" we need a component to do that? Do we need a routeprovider.cs then?


I that case, you don't need to decorate your controller/method with Admin area, so you need routeprovider for sure.
6 years ago
ahmadkq wrote:
Great I'm glad it works!!

So if we want to display a page in a customers "my account" we need a component to do that? Do we need a routeprovider.cs then?

I that case, you don't need to decorate your controller/method with Admin area, so you need routeprovider for sure.


Thanks. I’ll try it tonight.
6 years ago
So here is what I did. Made my RouteProvider.cs in my plugin:

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Nop.Web.Framework.Localization;
using Nop.Web.Framework.Mvc.Routing;

namespace Nop.Plugin.TShirts.Fundraiser
{
    /// <summary>
    /// Represents provider that provided basic routes
    /// </summary>
    public partial class RouteProvider : IRouteProvider
    {
        #region Methods

        /// <summary>
        /// Register routes
        /// </summary>
        /// <param name="routeBuilder">Route builder</param>
        public void RegisterRoutes(IRouteBuilder routeBuilder)
        {
            //reorder routes so the most used ones are on top. It can improve performance

            //my fundraisers
            routeBuilder.MapLocalizedRoute("Nop.Plugin.TShirts.Fundraiser.MyFundraisers", "mymundraiser/{fundraiserId:min(0)}",
        new {controller = "MyFundraiserController", action = "MyFundraisers" });

        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets a priority of route provider
        /// </summary>
        public int Priority
        {
            get { return 0; }
        }

        #endregion
    }
}


Here is the link syntax, but when it runs it just makes a "blank" entry:

<a href="@Url.RouteUrl(item.CustomerNavigationItems.RouteName, new { fundraiserId = item.Id })">@(item.CustomerNavigationItems.Title)</a>






But if I do this, it does make an entry, but when I click the link I just get a page not found:

<a href="@Url.Action(item.CustomerNavigationItems.RouteName, new { fundraiserId = item.Id })">@(item.CustomerNavigationItems.Title)</a>


6 years ago
I figured it out. My "URL" needed to be:

<a href="@Url.Action(item.CustomerNavigationItems.RouteName, new { item.Id })">@(item.CustomerNavigationItems.Title)</a>
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.