Calling Plugin gives error. RouteProvider?

Posted: one year ago Quote #68448
Hi Everyone,

I'm having a problem on calling a simple hello world plugin. (Controller Action retruns a View)

Structure:

Pacoliba.Plugin.Catalog.ProductOverview
--- Controllers
------ CatalogProductOverviewController.cs
--- Models
--- Views
------ CatalogProductOverview
--------- ProductOverview.cshtml


This is the error i'm getting using - @Html.Action("GetProductOverview", "CatalogProductOverview") on the Index.cshtml of my theme:

The controller for path '/' was not found or does not implement IController.


RouteProvider:

namespace Pacoliba.Plugin.Catalog.ProductOverview
{
    class RouteProvider : IRouteProvider
    {

        public void RegisterRoutes(RouteCollection routes)
        {
            routes.MapRoute("Pacoliba.Plugin.Catalog.ProductOverview.GetProductOverview",
                 "Plugins/CatalogProductOverview/GetProductOverview",
                 new { controller = "CatalogProductOverview", action = "GetProductOverview" },
                 new[] { "Pacoliba.Plugin.Catalog.CatalogProductOverview.Controllers" }
            );

        }
        public int Priority
        {
            get
            {
                return 0;
            }
        }
    }
}


Controller - CatalogProductOverviewController.cs:

namespace Pacoliba.Plugin.Catalog.ProductOverview.Controllers
{
    class CatalogProductOverviewController : Controller
    {

        public ActionResult GetProductOverview(){

            return View("Pacoliba.Plugin.Catalog.ProductOverview.Views.CatalogProductOverview.ProductOverview");

        }

    }


}


View - ProductOverview.cshtml:

<div>
    hello world
</div>


As you can see, it's a quite simple example because i'm just getting started on developing plugins. Does someone knows what i'm doing wrong?

Kind Regards
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: one year ago Quote #68454
I'm pretty sure you can't directly reference plugins like that from a theme.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
StackOverflow - http://stackoverflow.com/users/113988/andymckenna
http://bitshiftweb.com - FirstData payment plugin and contract development services
Posted: one year ago Quote #68456
Hi AndyMcKenna,

Thx for replying. Recently I've purchased an extension plugin form nop-templates.com and followed this documentation to implement. I was able to implement the filters in my theme using this bit of code:


@section nopAjaxFilters
{
        @Html.Action("GetFilters", "NopAjaxFilters")
}


So I've thought this was possible? I'm still getting the same error over and over again.

Kind Regards
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: one year ago Quote #68469
No, it just looks like I'm wrong.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
StackOverflow - http://stackoverflow.com/users/113988/andymckenna
http://bitshiftweb.com - FirstData payment plugin and contract development services
Posted: one year ago Quote #68635
I'm fairly new to the MVC architecture, but learning as much as I can recently along with nopCommerce. (keep that in mind :))

In your route provider I think you have the namespace incorrect for your controller. The last argument for MapRoute() is a string array of namespaces, yours is:

new[] { "Pacoliba.Plugin.Catalog.CatalogProductOverview.Controllers" }


I think it should be:

new[] { "Pacoliba.Plugin.Catalog.ProductOverview.Controllers" }
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: one year ago Quote #68830
weega wrote:
I'm fairly new to the MVC architecture, but learning as much as I can recently along with nopCommerce. (keep that in mind :))

In your route provider I think you have the namespace incorrect for your controller. The last argument for MapRoute() is a string array of namespaces, yours is:

new[] { "Pacoliba.Plugin.Catalog.CatalogProductOverview.Controllers" }


I think it should be:

new[] { "Pacoliba.Plugin.Catalog.ProductOverview.Controllers" }


Hi weega,

Thx for replying. You were right about the namespace of my plugin, but i'm still getting the same error after changing. Strange...
Is there someone who has developed a simple plugin so i can take a look at the code?

Kind regards.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: one year ago Quote #68929
Did you see this post? Make sure you restart your application from the admin.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
nopCommerce on facebook