Rank: Advanced Member
Groups: Authorized User, Developers Joined: 5/30/2020(UTC) Posts: 125
Thanks: 14 times Was thanked: 3 time(s) in 3 post(s)
|
I registered two new routes in my Plugin using the following code: Code:public void RegisterRoutes(RouteCollection routes)
{
if (routes["Plugins_General_InventoryPlugin_Admin"] == null)
{
var route = routes.MapRoute(
name: "Plugins_General_InventoryPlugin_Admin",
url: "Admin/InventoryPlugin/{controller}/{action}/{id}",
defaults: new { controller = "InventoryAdmin", action = "Config", id = UrlParameter.Optional },
namespaces: new[] { "InventoryPlugin.Areas.Admin.Controllers" }
);
route.DataTokens["area"] = "Admin";
}
if (routes["Plugins_General_InventoryPlugin_Retail"] == null)
{
var route = routes.MapRoute(
name: "Plugins_General_InventoryPlugin_Retail",
url: "InventoryPlugin/{controller}/{action}/{id}",
defaults: new { controller = "InventoryRetail", action = "Index", id = UrlParameter.Optional },
namespaces: new[] { "InventoryPlugin.Controllers" }
);
}
}
The first route works correctly and shows my plugin configuration page. The second route causes the following error at the top and bottom of the website in place of the Header and Footer: Quote:Multiple types were found that match the controller named 'Category'. This can happen if the route that services this request ('InventoryPlugin/{controller}/{action}/{id}') does not specify namespaces to search for a controller that matches the request. If this is the case, register this route by calling an overload of the 'MapRoute' method that takes a 'namespaces' parameter. The request for 'Category' has found the following matching controllers: AbleCommerce.Controllers.CategoryController AbleCommerce.Areas.Admin.Controllers.CategoryController If you look at my route registration, you can clearly see I've specified controller namespaces for each of the routes. I also went through the AbleCommerce_WAP routes and added namespaces for all of those, but it didn't make a difference. The only way I could get rid of the error was to replace the {controller}/ part of the URL with the physical controller name. But then I have to do that for every new controller. Any other ideas?
|
|
|
|
Rank: Advanced Member
Groups: Admin, Developers, Registered, HelpDesk, Authorized User Joined: 10/5/2018(UTC) Posts: 704
Thanks: 5 times Was thanked: 113 time(s) in 112 post(s)
|
For the retail side, you should always make use of the widgets. You can register an action method as a widget in your plugin controller and then view the content by dragging and dropping the widget on the content page.
You can create a content page from the admin website menu, set the inner and outer template, and then drag and drop the widget.
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The AbleCommerce Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close