CatalogueControllerBase is Custom Controller base? Is it inherited from CatalogContentBase?
Did you implement custom routing for the catalogue in Commerce Initialization?
CatalogControllerBase is a custom controller yeah, inheriting from ContentController.
That's all my routing code here, I think it's fairly standard unless I've missed something.
using System.Web.Mvc;
using System.Web.Routing;
using EPiServer.Commerce.Routing;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.ServiceLocation;
namespace CommerceTraining.Infrastructure
{
[InitializableModule]
[ModuleDependency(typeof(EPiServer.Commerce.Initialization.InitializationModule))]
public class EPiServerCommerceInitializationModule : IConfigurableModule
{
public void Initialize(InitializationEngine context)
{
CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, false);
}
public void Preload(string[] parameters) { }
public void Uninitialize(InitializationEngine context)
{
}
public void ConfigureContainer(ServiceConfigurationContext context)
{
DependencyResolver.SetResolver(new StructureMapDependencyResolver(context.StructureMap()));
}
}
}
Hi,
As a thought, shouldn't your CatalogControllerBase inherit ContentController<T> rather than ContentController<CatalogContentBase>? Like this:
public class CatalogControllerBase<T> : ContentController<T> where T : CatalogContentBase
{
//Controller code goes here...
}
By having all of your controllers ultimately inheriting ContentController<CatalogContentBase>, I'd imagine Episerver will see that as a bunch of controllers which handle CatalogContentBase rather than your specific catalog content types.
It seems like the problem is with the base controller. I tried your controller and I got the same error.
Example If you want to create One base controller for all catalogue pages
If you want a Base controller for categories only (Nodes)
public class NodeControllerBase<T> : ContentController<T> where T : NodeContentBase
{
//....
}
Thanks guys, yep the problem was in the CatalogControllerBase. Switched it out to;
public class CatalogControllerBase<T> : ContentController<T> where T : CatalogContentBase
and it works perfectly now.
Hi Folks,
getting an error with an ecommerce project. Anytime I try to navigate to a catalog item I get this error. The 'requested type' is always AccessoryProduct in spite of whatever class of item I am actually trying to access.
Strangely enough this seems to coincide with the alphabetical listing of the catalog classes. The erroneous requested type was always 'FashionNode', then I noticed it changed to BlouseProduct when that was added. I added a WatchProduct and AccessoryProduct as a test and noticed it had changed to always requesting an AccessoryProduct.
I've looked around for a solution and the problem has usually seemed to be the classes loaded into the controller, but they all seem to be correct and matching with the right views.
Has anyone one come across this one before?
Many thanks,
Dave