Professional Documents
Culture Documents
Writing an Orchard Webshop Module from scratch Part 3
This post has been updated to be compatible for Orchard >= 1.4.
To create a module, the minimum requirements are that you create a class library and add a text
file to it that is called Module.txt, which in turn has a minimum amount of information to
describe the module: one of which being the name of the module.
We'll have a look at the manifest in a few moments.
Instead of creating a module by hand, we could use the Orchard command line application to
generate a basic structure for us (http://docs.orchardproject.net/Documentation/Creating-a-
module-with-a-simple-text-editor). This will create a class library with some tweaked settings,
http://www.ideliverable.com/blog/writinganorchardwebshopmodulefromscratchpart3 1/10
4/10/2015 IDeliverable Writing an Orchard Webshop Module from scratch Part 3
Although our module will not look like much when we first create it, but in the end, our module
will consist of:
A Module Manifest
Models & ViewModels
Views
Controllers
Drivers
Service classes
Handlers
Shapes
Javascript
Css
A Migration
A ResourceManifest
Routes
Helpers methods
Inside Visual Studio, create a new Class Library Project under the Modules Solution Folder, and
make sure that the project is physically located in \src\Orchard.Web\Modules:
http://www.ideliverable.com/blog/writinganorchardwebshopmodulefromscratchpart3 2/10
4/10/2015 IDeliverable Writing an Orchard Webshop Module from scratch Part 3
Orchard requires that your module exists physically in the Modules directory.
First, let's get rid of the Class1.cs file that Visual Studio created for us, since we have no use for it
(we will create our own classes later).
Next, we will create the Module Manifest file, which is a simple text file describing our module,
with things such as the name of our module, a description, version number, our company url, etc.
Name: Skywalker.WebShop
AntiForgery: enabled
Author: Sipke Schoorstra
Website: http://skywalkersoftwaredevelopment.net
Version: 1.0
OrchardVersion: 1.4
Description: Orchard Webshop Module Demo
Category: Webshop
http://www.ideliverable.com/blog/writinganorchardwebshopmodulefromscratchpart3 3/10
4/10/2015 IDeliverable Writing an Orchard Webshop Module from scratch Part 3
And there you have it: a basic Orchard module that does precisely: nothing. But that's about to
change.
Before we contrinue, let's make sure that Orchard recognizes our module. Launch the website by
pressing CTRL + F5.
Once the site starts, navigate to the admin area.
http://www.ideliverable.com/blog/writinganorchardwebshopmodulefromscratchpart3 4/10
4/10/2015 IDeliverable Writing an Orchard Webshop Module from scratch Part 3
And that's all it takes to create a bare bones module! Next, let's make it do something useful.
What we want is to enable the administrator to define all sorts of products: Books, CDs, DVDs,
Phones, etc.
All these products have at least two properties in common: a unit price and a SKU
(http://en.wikipedia.org/wiki/Stock-keeping_unit).
http://www.ideliverable.com/blog/writinganorchardwebshopmodulefromscratchpart3 5/10
4/10/2015 IDeliverable Writing an Orchard Webshop Module from scratch Part 3
At the heart of Orchard is the fact that every piece of content consists of content parts.
For example, the administrator will be able to define a new type of content: Book. The Book
content type is then defined by its Content Parts.
The administrator can pick the content parts he likes, like BodyPart, CommentsPart, RoutePart,
etc.
In order to turn any content type into a product that has a unit price and a sku, we need to
introduce our own custom part: a ProductPart.
5 comments
Wangzhongyu11 03/25/2012 03:08 AM
http://www.ideliverable.com/blog/writinganorchardwebshopmodulefromscratchpart3 6/10
4/10/2015 IDeliverable Writing an Orchard Webshop Module from scratch Part 3
I thought that with Orchard this won't be that easier but looking at the
solution over here I felt that this is far way easier to what I thought off.
Writing some codes can unleash the power of Orchard.
It's also essential to find out the business model of a business you would like
to employ the service of.
You provide here good information which is very useful to the developer as
well as beginners even they got an idea and inspiration for their application.
Leave a comment
Name:
Email address:
URL:
http://www.ideliverable.com/blog/writinganorchardwebshopmodulefromscratchpart3 7/10
4/10/2015 IDeliverable Writing an Orchard Webshop Module from scratch Part 3
Comment:
How to Format
Type the text
Privacy & Terms
(http://www.google.com/intl/en/policies/)
Submit
Topics
autofac (1) (/Tags/autofac) azure (2) (/Tags/azure) cloud services (2) (/Tags/cloud%20services)
powershell (2) (/Tags/powershell) ssl (1) (/Tags/ssl) startup tasks (2) (/Tags/startup%20tasks)
http://www.ideliverable.com/blog/writinganorchardwebshopmodulefromscratchpart3 8/10
4/10/2015 IDeliverable Writing an Orchard Webshop Module from scratch Part 3
Authors
Daniel Stolt (/blog/author/daniel)
Daniel is the go-to guy here at IDeliverable for all things Azure. He
blogs about his experiences developing for the cloud.
(/blog/author/daniel)
(/blog/author/sipke)
Archive
2014 2013 2012
November (6) December (2) October (1)
(/blog/archive/2014/11) (/blog/archive/2013/12) (/blog/archive/2012/10)
September (3) June (5) September (3)
(/blog/archive/2014/9) (/blog/archive/2013/6) (/blog/archive/2012/9)
March (9) August (1)
(/blog/archive/2013/3) (/blog/archive/2012/8)
January (1) April (7)
(/blog/archive/2013/1) (/blog/archive/2012/4)
February (4)
(/blog/archive/2012/2)
http://www.ideliverable.com/blog/writinganorchardwebshopmodulefromscratchpart3 9/10
4/10/2015 IDeliverable Writing an Orchard Webshop Module from scratch Part 3
January (18)
(/blog/archive/2012/1)
Postal address:
IDeliverable, Ltd.
PO Box 58341
3733 Limassol
CYPRUS
Visiting address:
IDeliverable, Ltd.
Sotiri Tofini 4, 2nd floor
Agios Athanasios
4102 Limassol
CYPRUS
http://www.ideliverable.com/blog/writinganorchardwebshopmodulefromscratchpart3 10/10