Last updated: Oct 11 2013
3. Creating a start page
In this step, we
- Create a start page page type in CMS, with rendering based on MVC and the Episerver content model.
- Configure the site's start page.
- Add components to display catalog content.
We assume that you are using the Episerver Visual Studio extension.
Note: You must be a site administrator to create a start page under the website root.
Creating the start page page type
Follow the steps under Creating a page type, Adding page rendering and Configuring the start page in Create a starter project for CMS to create a start page page type with a controller and a view on the front-end site of your Commerce solution. After completing this, you have a website with a working start page.
Creating content types for category, product and variant
These steps create simple content types for a category node, a product, and a variant (SKU). This allows you to add catalog entries from the catalog user interface, the foundation of the catalog structure.
- Right-click the Models folder, select Add > New Folder, and name it Catalog.
- Right-click Catalog, select Add > New Item, then EPiServer and Page Type.
- Name the item MyNode.cs and click Add. This will be a category content type.
- Since catalog content is not page-based, change PageType to CatalogContentType, remove DisplayName and Description, add MetaClassName = My_Node, and resolve the using references.
- Repeat steps 1-4 to add content types for MyProduct and MyVariation. The two new classes should inherit ProductContent and VariationContent.
- Compile the solution.
- Log into the catalog user interface.
- Verify that you can create categories, products and variants based on the created content types.
Note: Since there is no rendering yet, the entries open in the All properties editing view. The content types are very simple with no properties, just to illustrate the content model in Commerce.
Adding controllers and views for catalog entries
These steps add controllers and views for rendering the catalog content types. This works the same way as creating the rendering for CMS content.
- Open the project in Visual Studio, and right-click the Controllers folder.
- Select Add > New Item > EPiServer > Page Controller (MVC).
- Name the item MyNodeController.cs and click Add. This will be a category content type controller.
- Change PageController to ContentController and resolve the using references.
- Repeat steps 1-4 to add controllers for MyProduct and MyVariation.
- Right-click the Views folder, select Add > New Folder, and name it MyNode.
- Right-click the MyNode folder, select Add > New item, and Page Partial View (MVC Razor) under the EPiServer group.
- Name the item Index.cshtml and click Add.
- In the Index.cshtml file, change the model to be YourSite.Models.Catalog.MyNode.
- Repeat steps 1-4 to add views for MyProduct and MyVariation.
- Compile the solution.
- Verify that you have proper rendering (although empty) for your content types.
- Go to Adding e-commerce functionality for information about adding e-commerce features.
- Go to Adding website functionality for information about adding CMS features.