Change the default implementation of a plugin
This article describes how you can change the default implementation of an e-commerce plugin.
The default plugins provided as off-the-shelf add-ons can be customised and changed. You can do it in two different ways.
- Replace them with your own code.
- Extend them with your own code.
Replace with your own code
Implement the correct interface in your own class, inside your own assembly (.dll) and place the assembly in the webroot\bin folder. Litium will automatically detect the custom implementation, and will use that instead of the default implementation. The plugin attribute needs to be added to the implementation to make it work correctly. More information about selecting implementations of a plugin can be found in IPluginSelector interface.
Extend with your own code
Write your own classes by extending the classes provided by the default implementation. Usually the default implementation provide virtual methods to allow this type of extension. Place your assembly in the webroot\bin folder. Litium will automatically detect the custom implementation and will use that instead of the default implementation. Effectively this is the template method design pattern.