Creating a nopCommerce Plugin in version 3.90 and below
I recently worked with a client using an older version of nopCommerce that needed to have a plugin made for functionality. In particular, this plugin integrates with updown.io to allow for turning checks on and off during scheduled maintenance.
To do this, you’ll need to have the nopCommerce source code available for use.
Creating the Plugin
To get started, create a Class Library in the Plugins folder:
Make sure to change the location to the plugin folder below the name.
Use naming convention Nop.Plugin.{category}.{name}
The categories you can use include:
- ExternalAuth
- Widgets
- ExchangeRate
- DiscountRules
- Payments
- Shipping
- Tax
- Misc
Next, go into properties and make sure your Target framework is .NET Framework 4,.5.1.
Next, change the output path for all configurations to deploy to:
This will build the output of the plugin into the Web project, which will ultimately deploy to the nopCommerce application.
After that, copy a web.config file from another plugin.
Next, create a Description.txt
file with the following content:
Set both the web.config and Description.txt files to ‘Copy if newer’.
Finally, there is a Class.cs file that was created when creating the Class Library. Rename the file to {name}Plugin.cs and use the following code snippet:
When building, you’ll be warned to add a few references as a result of referencing the Nop.Core project. Add the following NuGet packages:
- Microsoft.Bcl.Build
- Microsoft.Bcl
- Microsoft.Bcl.Async
- Microsoft.Net.Http
Once this is done, you should be able to clean, build, and publish the project. Check the plugins list of the admin backend to see your plugin listed:
Just to ensure everything is working, go ahead and install the plugin. The plugin should install successfully, and the plugin will then be running on your site. You’re now ready to make changes to the plugin to modify NopCommerce capabilities.
Next Steps
After the initial plugin was created, next steps include:
- Creating a logo named logo.png and upload it to the plugin. Set the image to ‘Copy if newer’ and size the image to around 50×50.
- Set up a configuration page to allow for customizing data on the plugin.
Reference:
http://docs.nopcommerce.com/pages/viewpage.action?pageId=22675509