nopCommerce Plugin Project Template For Visual Studio 2017

In this article, we will talk about a Visual Studio extension which simplifies the nopCommerce plugin development.

Introduction

Before moving on to the details of the Visual Studio extension, let's first briefly talk about what nopCommerce and nopCommerce plugins are.

What is nopCommerce?

nopCommerce is an open-source, free e-Commerce shopping cart. It is developed using ASP.NET MVC as front-end and MS SQL 2008 (and higher) as back-end database. It has various features that are applicable to all types of users. Some of the features are listed below,

  1. Mobile-friendly UI
  2. SEO-friendly code
  3. Supports more than 50 payment methods and gateways.
  4. Supports various shipping requirements
  5. Supports various product features like product attributes, product comparison, stock management etc.

As of writing this article, current version of nopCommerce is 3.9. Currently, the nopCommerce team is working on migrating the code base from ASP.NET MVC to new cross-platform ASP.NET CORE platform.

Source code and official site links are,

  1. https://github.com/nopSolutions/nopCommerce
  2. https://nopcommerce.com/

What are Plugins in nopCommerce?

Plugins in nopCommerce are used to extend the functionality of nopCommerce. nopCommerce has various types of plugins like payment methods, shipping rate computation methods, and much more. Like Visual Studio Marketplace, nopCommerce has its own marketplace where we can find various types of plugins. We can also create our own plugins. You can find more information about how to create your own plugin on http://docs.nopcommerce.com/display/en/How+to+write+a+nopCommerce+plugin.

nopCommerce plugin is just a class library project. To convert this class library project into a nopCommerce plugin, we need to perform some steps like change the build path for the project, add description file (provide some information regarding the plugin like its version, author, description), logo etc. Every time we start developing our own plugin, we need to add this basic stuff to our project. The most important setting is the build path. If we forgot to set the build path to a proper location, then the plugin will not be displayed in admin section in plugin list. This is where the nopCommerce plugin project template extension comes in play.

nopCommerce Plugin Project Template For Visual Studio 2017

It is a Visual Studio extension which adds a new class library project template for nopCommerce plugin development. This project template consists of basic content like web.config file, description file, plugin configuration file etc., so that we can start with actual plugin development process. In nopCommerce project, you just need to right click on Plugins folder and select Add => New Project option as shown below (F:1).

nopCommerce

It will open up the project dialog. Project template is visible under Visual C# => nopCommerce menu, as shown below (F: 2).

nopCommerce

Select the nopCommerce Plugin Class Library project template, give it a name, make sure the project location points to Plugins folder, and then click on OK button. The project will be added under Plugins folder.

This project contains files like Description.txt, default logo image, plugin setting file, a Controller, a View and web.config file, as shown below (F:3).

nopCommerce

Build path for the project is also set to Nop.Web\Plugins folder and output path is also set for files like Description.txt, logo image, web.config and View. So that when you build plugin, content of the plugin will get copied to Nop.Web\Plugins folder as shown below (F: 4).

nopCommerce
Note

You just need to change the version of nopCommerce according to your nopCommerce project version in Description.txt file. By default it is set as 3.90.

When you run the project and go to Plugins section in admin, you will be able to see the plugin in admin section under "Misc" group, as shown below (F: 5).

nopCommerce

You can download this extension from the VS Gallery or get the CI build. Source code for this project template is available on GitHub.

Conclusion

In this article, we talked about nopCommerce plugin project template extension for Visual Studio 2017 and how to kick start the plugin development process quickly. I hope you enjoyed reading the article.

Happy Coding!