Writing an Orchard Webshop Module from scratch - Part 1

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:

http://docs.orchardproject.net/Documentation/How-Orchard-works
http://msdn.microsoft.com/en-us/magazine/hh708754.aspx


Webshop Features

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 Ogone a 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

35 comments

  • ... Posted by Juanzete Posted 02/01/2012 12:08 AM

    This is AMAZING

  • ... Posted by fabrizio Posted 02/12/2012 11:20 AM

    Great Tutorial<br>Thanks a lot

  • ... Posted by Ali_ta_4000 Posted 02/25/2012 10:16 AM

    Thanks alot

  • ... Posted by Luther Lindsay Posted 02/28/2012 04:56 AM [http://www.tatvasoft.co.uk/]
    <p>When you are developing Orchard modules for the first time, you will face some error while installing and making changes to the module. It might be possible that you want to reset Orchard CMS from the beginning as if Orchard was run for the first time, in such cases the best way to reset is to delete the data folder which you created.<br></p>
  • ... Posted by Zgofmontreal Posted 03/01/2012 05:45 PM

    in ur new Nwazet.Commerce in the gallery, I notice that there r no ProductCatalog. does it mean we should use projection module to get the same result? thx. andy

  • ... Posted by webwinkel beginnen Posted 03/03/2012 09:00 AM [http://www.webmeester.eu/index.php/webwinkel-service/]

    I am sure that you will benefit from provided the knowledge for all web shop. It is really great news for software development. Not only it is just great for software and advanced web site. I am enjoying of this blog.

  • ... Posted by Sipke Schoorstra Posted 03/03/2012 11:23 AM (Author)

    The Projection module would be perfect for that, yes. It would also circumvent the limitation that you can either show all content types, or just one. Projector allows you to select exactly which content types to show.

  • ... Posted by Your Mom Posted 03/22/2012 11:56 AM

    If you love it so much why dont you merry it!!!!!!!

  • ... Posted by Software Development Company Posted 04/17/2012 06:01 AM [http://mindinventory.com/]

    Orchard is powerful CMS with powerful features and inspiring architecture that allows for unlimited extensibility, it might take some time to fully understand it's architecture and being able to customize all aspects of your own Theme!

  • ... Posted by Rob Hurt Posted 05/10/2012 05:09 PM

    data folder = all the files/ folder in app_data, right?

  • ... Posted by Sipke Schoorstra Posted 05/11/2012 07:17 AM (Author)

    That's correct.

  • ... Posted by Samuelshirley Posted 06/19/2012 06:34 PM

    Excellent articles!! They helped me out greatly!

    Are there any plans to work on Parts 11 - 15?

  • ... Posted by Sipke Schoorstra Posted 06/22/2012 12:08 PM (Author)
    <p>I'm glad, thanks!<br>There are currently no concrete plans to work on parts 11 - 15 due to a lack of spare time.<br>However, as I'm moving to Orchard development more and more, I'll probably come across these subjects sooner or later. And that's when I'll be blogging about them.</p>
  • ... Posted by Guest Posted 08/06/2012 02:51 PM

    Great!!! I really like these articles!!! But what about Parts12-15? I'm looking forward to implementing PayPal...

  • ... Posted by Sipke Schoorstra Posted 08/11/2012 01:57 AM (Author)

    Thanks! I'm not sure, it depends on when I'm actually going to need it myself. Probably before the end of this year. A blog post will then soon follow.

  • ... Posted by Abhishek Luv Posted 08/30/2012 02:14 AM [http://www.codeabstract.com]

    Thanks for this awesome module tutorials.

    With Regards Abhishek Luv

  • ... Posted by Kewngen Posted 09/14/2012 09:42 AM

    You haven't given up on this awesome tutorial I hope?

  • ... Posted by Sipke Schoorstra Posted 09/14/2012 08:44 PM (Author)

    No, just a bit short with time lately. Anything specific that you'd like to see handled?

  • ... Posted by Kewngen Posted 09/17/2012 11:04 AM
    <p>Is it OK to say everything? :P<br>I haven't started yet (I too have time issues!), I'm just happy I've got 11 parts before I get to a unwritten one.</p>

    It would be nice if you got the basics up for part 12-15, even if you have to skip some of the fancy stuff. And if you have time afterwards, update the posts to 1.5 (or 1.6 by then).

    Sounds like I'm ungrateful, I'm not! Thanks for a awesome tutorial!

  • ... Posted by ElyorLatipov Posted 09/22/2012 12:21 PM

    Good article!,thx...

  • ... Posted by Ytrog Posted 11/02/2012 12:21 PM

    The link to the demo isn't working

  • ... Posted by Sipke Schoorstra Posted 11/02/2012 10:14 PM (Author)

    Thanks! Should be working again.

  • ... Posted by AmethystBoyer Posted 11/27/2012 04:39 AM [http://demetriagordon.webnode.com/]

    Great article and very very exciting weblog. That is one thing I’m really anticipating. Awaiting studying more from you next weeks time.

  • ... Posted by AmethystBoyer Posted 11/27/2012 04:39 AM [http://demetriagordon.webnode.com/]

    Great article and very very exciting weblog. That is one thing I’m really anticipating. Awaiting studying more from you next weeks time.

  • ... Posted by Mike Posted 12/10/2012 08:01 AM
    <p>Interesting article!<br>But the Demo isn't working :(</p>
  • ... Posted by Barry Terry Posted 12/20/2012 05:50 AM [http://sophiavinson.yolasite.com/]

    The Orchard CMS management interface is a properly analyzed imitation of WordPress. Since this has always been one of WordPress's powerful matches comparative to other CMS, this was a intelligent shift. It also has the advantage that customers that are acquainted with WordPress with easily adapt to Orchard.

  • ... Posted by Christian Lawson Posted 12/21/2012 06:49 AM [http://joshuaclayton.weebly.com/]

    It's very much a platform foundation for building all kinds of webbased programs such as e-commerce backends, CRM's, supportticket techniques, Project control software, group sites, learning control techniques .

  • ... Posted by bathroom cleaning Posted 01/26/2013 10:06 AM [http://www.choni.es/index.php?do=/profile-2213/info/]

    No matter if some one searches for his vital thing, so he/she wants to be available that in detail, thus that thing is maintained over here.

  • ... Posted by Rob Morris Posted 05/12/2015 01:24 PM [http://www.brownjordan.com]

    I am very interested in the ERP post you were going to do next. Any chance we can squeeze that out of you?

  • ... Posted by eru Posted 06/30/2015 02:38 PM

    Hello I wonder what would change, when the store would be implemented based on version 1.9?

    Regards, eru

  • ... Posted by GadgetGeek Posted 07/03/2015 10:09 AM

    It would be nice to see this re-done for version 1.9, using some of the newer features and explaining why they replace the older methods.

  • ... Posted by Mobibiz Posted 11/30/2015 10:52 AM [http://www.mobibiz.in/]

    Great Tutorial ...

  • ... Posted by omid nasri Posted 02/23/2016 07:01 PM [http://www.omidnasri.com]

    Hi, This is AMAZING.

  • ... Posted by Xelium Technologies Posted 01/23/2017 10:58 AM [http://www.xeliumtech.com/]

    Nice and informative tutorial. This tutorial is clearing everything very much related to Orchard CMS. If anyone really want to know about Orchard then this tutorial is his one-stop destination.

  • ... Posted by Pixlogix Posted 02/21/2018 06:40 AM [https://www.pixlogix.com]

    @Sipke Your Orchard Webshop Module is amazing and helpful such a knowledgable article. thanks for sharing this.

Leave a comment