Plugin Issue

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
I am using nopcommerce 2.3
I have worked both plugin samples.
I have created a plugin Nop.Plugin.HPTechLLC.Conditions. It builds without error and the build files are properly placed in the web/plugins folder.

I have placed the following link into my header menu

<li><a href="@Url.RouteUrl("Nop.Plugin.HPTechLLC.Conditions")">@T("Conditions.HeaderMenuLinkText")</a></li>

Which produces this link when run

http://localhost:2669/Conditions

unfortunately I get the following message when I try and click on the link

The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.

Requested URL: /Conditions


My plugin file structure

ConditionsProvider.cs
Description.txt
RouteProvider.cs
web.config
Controllers/ConditionsController.cs
Views/Index.cshtml


The actual code so far is:

ConditionsProvider.cs

using Nop.Core.Plugins;

namespace Nop.Plugin.HPTechLLC.Conditions
{
    public class ConditionsProvider : BasePlugin { }
}


Description.txt

Group: HPTechLLC
FriendlyName: Conditions
SystemName: HPTechLLC.Conditions
Version: 1.00
SupportedVersions: 2.30
Author: High Plains Technology LLC
DisplayOrder: 1
FileName: Nop.Plugin.HPTechLLC.Conditions.dll


RouteProvider.cs

using System.Web.Mvc;
using System.Web.Routing;
using Nop.Web.Framework.Mvc.Routes;

namespace Nop.Plugin.HPTechLLC.Conditions
{
    public class RouteProvider : IRouteProvider
    {
        #region IRouteProvider Conditions

        public void RegisterRoutes(RouteCollection routes)
        {

            routes.MapRoute("Nop.Plugin.HPTechLLC.Conditions", "Conditions", // The route name, and the actual route.
                                            new { controller = "Conditions", action = "Index" }, // Route defaults
                                            new[] { "Nop.Plugin.HPTechLLC.Conditions.Controllers" }); // The namespace where controllers are stored
        }

        public int Priority
        {
            get { return 0; }
        }

        #endregion
    }
}


ConditionsController.cs

using System.Web.Mvc;
using Nop.Core;
using Nop.Core.Domain.Catalog;
using Nop.Services.Catalog;
using Nop.Services.Localization;

namespace Nop.Plugin.HPTechLLC.Conditions.Controllers
{
    public class RequestConditionsController : Controller
    {


        public ActionResult Index()
        {
            return View("Nop.Plugin.HPTechLLC.Conditions.Views.Index");
        }
    }
}



Index.cshtml

@{
        Layout = "~/Views/Shared/_ColumnsTwo.cshtml";
}
<div>
<div class="page-title"><h4>Conditions</h4></div>
</div>





I think I am just missing soemthing simpel but I am learning C#, MVC, Entity, and nopcommerce at the same time. We use vb.net, linq to sql, and webforms at work. So I appear to be missing something.

I have done several rebuild and clean attempts and did an edit of the global to force it to rebuild.
12 years ago
Is this thing on? No really any ideas anyone?
12 years ago
vishrb wrote:
RouteProvider.cs

        public void RegisterRoutes(RouteCollection routes)
        {

            routes.MapRoute("Nop.Plugin.HPTechLLC.Conditions", "Conditions", // The route name, and the actual route.
                                            new { controller = "Conditions", action = "Index" }, // Route defaults
                                            new[] { "Nop.Plugin.HPTechLLC.Conditions.Controllers" }); // The namespace where controllers are stored
        }

    public class RequestConditionsController: Controller
    {


        public ActionResult Index()
        {
            return View("Nop.Plugin.HPTechLLC.Conditions.Views.Index");
        }
    }
[/code]

You registered 'Conditions' controller name in your RouteProvider, but your controller name is 'RequestConditionsController'. I presume it should be 'ConditionsController'
12 years ago
Thank you for responding. That did it. I probably would have overlooked that for a long time to come. Thanks again.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.