In this blog post series we will walk through the process of building an Orchard module from scratch!
Orchard is an awesome CMS with powerful features and inspiring architecture that allows for unlimited extensibility, but it might take some time to fully understand it's architecture and being able to customize all aspects of your own Theme or even create your custom modules that integrate with all the extensibility points of Orchard.
It is my hope that you will benefit from the knowledge I gained along the way and that you will come to see the beauty of Orchard and its architecture. Not only is it just great for simple or advanced websites and blogs, but it's very much a base platform for building all kinds of webbased applications such as e-commerce backends, CRM's, supportticket systems, project management, community sites, learning management systems and so forth. Basically anything you would do from scratch should be considered being built using Orchard. Orchard is actually more of an extensibility framework than it is "just" a CMS. You plugin your own modules that can do anything which a regular ASP.NET MVC application also can, with the added benefit that Orchard has a rich set of features and composibility concepts of which you can take advantage.
The primary audience of this post are ASP.NET MVC developers who are just getting started with Orchard.
Before diving in though, I strongly encourage you to read the following articles upfront if you haven't already:
In this tutorial, we'll create a commerce module with the following features:
- The administrator will be able to turn any ContentType into Products by attaching a ProductPart.
- Site visitors (customers) will be able to add products to a shopping basket, register with the site and be registered as a Customer
- The customer will be able to proceed to checkout and pay for the selected products using an online payment service provider (PSP) (in our demo, we will use
Ogonea simulation PSP).
- Before the customer is redirected to the PSP, the system will create an Order record, with child OrderDetail records.
- After the order is paid by the customer, we need to handle the delivery of the product. In the case of physical products, we might want to notifiy some shipping partner. In the case of virtual products, we might want to generate something like a voucher, or do anything else that is appropariate for the product. To enable this kind of flexibility, we will implement some sort of IShippingProvider interface, for which we will create two simple implementations: one that sends an email notification to a shipper, and another one that will generate a voucher.
- The Admin backend will enable the administrator to manage both Customers as well as Orders.
(note about the embedded screenshots: some screenshots appear too small to be viewable. Until I fix that you can simply drag the picture to your browser's address bar to see the picture in its original size)
Allright, let's get started with building the Orchard Webshop Module!
Part 1 - Introduction (you are here)
Part 2 - Setting up your Orchard Development Environment
Part 3 - Creating a Module
Part 4 - Creating the ProductPart
Part 5 - Creating and rendering the ProductCatalog content type
Part 6 - Creating the ShoppingCart service and controller
Part 7 - Rendering the ShoppingCart and ShoppingCartWidget
Part 8 - Registering new Customers with the site
Part 9 - Creating Orders and Communicating with the PSP
Part 10 - Managing the Customers and Orders from the backend
Part 11 - Customizing the Product and Catalog content list in the Admin: DisplayTypes
Part 12 - Integrating with an ERP system
Part 13 - Handling Shipping and Taxes
Part 14 - Implementing payment methods: Google Checkout
Part 15 - Implementing payment methods: PayPal
Click here to see the demo in action!