Write an Orchard online store module from scratch (4)-create a ProductPart

Source: Internet
Author: User

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.

  1. Add a reference to the Orchard. Framework project to inherit from Orchard. ContentManagement. Records. ContentPartRecord.
  2. Name the new folder "Models"
  3. In the "Models" folder, create a new class named ProductRecord.
  4. In the "Models" folder, create a new class named ProductPart and inherit from ContentPart <ProductRecord>.
  5. ProductPart has the following attributes: Price and SKU.

Your solution should look like the following:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.