Address: http://skywalkersoftwaredevelopment.net/blog/writing-an-orchard-webshop-module-from-scratch-part-4
ProductPart
This is the first tutorial to write a new Orchard module.
For an overview of this tutorial, see Introduction.
Content Items in Orchard are composed of Content Parts. Using our online store module, we hope that the administrator can add ProductPart to any content type (ContentType) to form a Product ).
For example, you can define the content type of a "book" and add it to the ProductPart to convert the "book" to "commodity", and then add it to the shopping cart, order, and details.
Create a ProductPart to store data in the database. We need to create ProductRecord and inherit from Orchard. ContentManagement. Records. ContentPartRecord.
Orchard uses the suffix "Record" as the specification and uses nhibw.orm for persistence.
- Add a reference to the Orchard. Framework project to inherit from Orchard. ContentManagement. Records. ContentPartRecord.
- Name the new folder "Models"
- In the "Models" folder, create a new class named ProductRecord.
- In the "Models" folder, create a new class named ProductPart and inherit from ContentPart <ProductRecord>.
- ProductPart has the following attributes: Price and SKU.
Your solution should look like the following: