Defining components, content types, and templates
Now that you have seen the functionality of the content and component types provided with the project template, we will define custom pages and regions for storing categories and products imported from the Northwind
database to show a catalog of Northwind products.
First, we will create an MVC controller that responds to an HTTP GET
request for the /import
relative path by querying the Northwind
database for categories and their products.
Then, using the Piranha CMS API to find a special page that represents the root of the product catalog, and as children of that page, we will programmatically create instances of a custom CategoryPage
type with a custom region to store details like the name, description, and image of each category, and a list of instances of a custom region to store details of each product, including name, price, and units in stock, as shown in the following diagram:
Figure 17.21: The site&apos...