Create View page for Catalog

  • Updated

By default, in Quicksilver sample site, we just have view pages for under Catalog Node level pages but no view page for Catalog level page. That means you can access the page except (404 error). How can we create view page for Catalog page - Fashion in this sample.

Firstly, you may think we will create Model - Controller - View for Fashion. It's so easy :) There is a model class FashionCatalog extends CatalogContent class as other Model classes. Wait, please look at that post"You should not inherit from the following types because they exist only to show various states in the system".

So, the solution is that you won't create the FashionCatalog class, just use the CatalogContent as Model class then pass it to Controller class and View page to render.

The CatalogController class will be like that: 

public class CatalogController : ContentController<CatalogContent>
   public ActionResult Index(CatalogContent currentPage)

      return View(currentPage);

And in View page:

@model EPiServer.Commerce.Catalog.ContentTypes.CatalogContent

hello: @Model.Name

Here is the result :