Original address: Http://skywalkersoftwaredevelopment.net/blog/writing-an-orchard-webshop-module-from-scratch-part-3
Create a Orchard.webshop module project
This is the 3rd chapter of the tutorial on writing a new orchard module from scratch.
For an overview of this tutorial, please see the introduction.
The Orchard module is a true area class library of ASP. NET MVC, while following the specific specifications of ASP. NET MVC and Orchard.
The Orchard specification enhances your ASP. NET MVC area, so it can be integrated into the Orchard.
Now, we can use the Orchard command-line application to generate a basic structure for us, but let's start from scratch with Visual Studio, which allows us to fully understand that a module can be simply an empty class library plus a module.txt file as a module manifest.
Finally, our module will include:
- A Module Manifest
- Models & ViewModels
- Views
- Controllers
- Drivers
- Service classes
- Handlers
- Shapes
- Javascript
- Css
- A Migration
- A Resourcemanifest
- Routes
- Helpers methods
We will discuss each item in the process.
First, we will start by simply creating a new class library project.
In Visual Studio, create a new class library project under the Solution folder for the module, and make sure that the project is in the physical location \src\orchard.web\moduels:
Orchard requires that your module be located in the modules directory where the physical location exists.
Next, we will create the module's manifest file, which is a simple text file that explains our modules, such as the name of our module, description, version number, company URL, etc.
Let's start by entering the following information for Module.txt:
Name:Orchard.WebShop
Antiforgery:enabled
Author:sipke Schoorstra
Website:http://skywalkersoftwaredevelopment.net
version:1.0
orchardversion:1.3.10
Description:orchard webshop Module Demo
Category:webshop
Then we have a basic orchard module, but it doesn't have any function.
But that's what we're going to do next.
Let us confirm that Orchard has identified our module. Press CTRL + F5 to start the Web site.
After the site starts, navigate to the Administration page.
You can go directly to the admin page by typing the URL http://localhost:30320/OrchardLocal/admin, or click on the "Dashboard" link on the footer of the website.
Once in the Admin page, select modules to enable our orchard Webshop Module:
So we create a skeleton of a module! Next, let's make it possible to do something useful.
What we want is to enable administrators to define a variety of products: books, CDs, DVDs, mobile phones, etc.
All of these products have at least two common features: one unit price and one SKU attribute.
At the heart of Orchard, each part is actually made up of content parts.
For example, an administrator can define a new content type:
Book. The content type of book is defined by its contents parts.
The administrator can pick the content Parts he likes, such as: Bodypart,commentspart,routepart, etc.
In order for book to become a product, we need to first create our own custom part (section): Productpart.
Write a Orchard online store module from scratch (3)-Create a Orchard.webshop module project