Calling Plugin gives error. RouteProvider?

Posted: April 27, 2012 at 5:34 AM 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: April 27, 2012 at 7:09 AM 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: April 27, 2012 at 7:19 AM 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: April 27, 2012 at 8:40 AM 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: April 30, 2012 at 5:55 AM 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: May 02, 2012 at 3:47 AM 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: May 03, 2012 at 2:10 AM 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)
Premium support services
  • Dedicated premium support services provided by core developers are intended for persons who run mission critical websites, work on projects with tight deadlines, or want to get dedicated support.
Professional services
  • Want to open a new store? Want to take your store to the next level? Need a custom extension? We can customize nopCommerce to fit your store perfectly. Request a quote to get started.
E-COMMERCE CONFERENCE 2016
Learn more