Plugin architecture
This section describes the concepts behind Sales plugins.
Introduction
The Sales plugins allow extending the sales functionality and customizing its behaviour. There are two basic design concepts behind the plugins.
- Separation of Concerns: Keep your business logic separate from the user interface logic.
- Inversion of Control: Let implementation make the decisions on matters best known to implementation.
Separation of Concerns
When a project is implemented using Litium, normally you would separate the business logic implementation into the code behind files of your website templates, or a set of code files in your app_code directory.
This is desirable in most situations, but Sales needs another step. Your custom implementation needs to be used by Sales in back office as well. For example, there are two ways of placing an order:
- From the public website you create.
- From Sales in back office, by creating the order in the Order management view.
In both cases above, there will be order total calculations, and this calculation is depending on your own implementation. Therefore, the logic you provide in that implementation has to be accessible to both back office and the templates you write. To do this, you have to place all your logic into the Sales plugins where applicable, so that they are available from back office as well.
The diagram below shows how both templates and Sales in back office use the logic you provide in the plugins.

Inversion of Control
Some of the detailed customisations you will use in your implementation project cannot be generalised.
For example:
- A campaign will behave differently from one project implementation to another.
- Different implementations may use different payment providers, delivery providers and pricing rules.
- Different projects will have different order states, and different state transitions, and different actions that need to be taken in those transitions.
Therefore, the implementation project needs to control how a particular functionality should be implemented by the Litium API. This is done using the IoC design pattern. Litium defines the C# interfaces of the plugins that the implementation project can provide with concrete implementation classes. Then, when the functionality defined by these interfaces are required, the concrete implementations are loaded and used by Litium.
A basic functioning implementation for each of these plugin interfaces are provided with the product, "out of the box". You are free to modify them as you wish, or use them without any modifications. The plugin source folder in the implementation package contains the full source code of all plugins.
This article describes how you can change the default implementation of an e-commerce plugin.
If you want to customize a plug-in, you can find an example here in the article
service decorator.
The IPluginSelector interface can be implemented to select a particular implementation of a plugin (out of several implementations) based on the business scenario.