Developer Resources for AbleCommerce eCommerce platform
In This Topic
    Setup Development Environment
    In This Topic

    In order to make plugin development for AbleCommerce easy, here is a brief summary of what to do. First, you will add your custom plugin project into the AbleCommerce solution, alongside the website project.  Then open the project settings and go to build events.

    Check the post build event; here we copy the plugin dlls, views and content into a folder and create a zip file. Instead of copying the plugin folder and zip file into a folder under your project, copy them directly into /website/plugins/ folder.

    This will make development real easy. Every time you update the plugin code or views, just build the plugin. It will copy the latest updates and the website will start using the updated code immediately.

    Once you are done, you can have the plugin build zip file located under its local folder or even have different post build actions depending upon build mode Release/Debug.

     

    Installation and Setup

    For this example, we will setup a plugin named "RandomQuotes": Download sample plugin code.→

    1. Set up a folder to hold everything.  e.g. //GitHub/RandomQuotes/
    2. Copy entire RandomQuotes.zip into this folder.
      • /GitHub/RandomQuotes/Lib/
      • /GitHub/RandomQuotes/Website/
      • /GitHub/RandomQuotes/solution file.sln
    3. Create a /GitHub/RandomQuotes/Projects/ sub-folder to hold the actual class library project.
    4. In the class library project, build out all processing code, models, etc.  and create the various plugin-related payload such as the admin-related files, install script, and route provider file.

     

    Frequently Asked Questions and their Answers

     


    How do I setup my project to develop custom plugins?

    First, don't use the /Website/Plugins/ folder for any development. It's simply a plugin cache for AbleCommerce. You will always create a plugin project folder, and add your views, controllers and other code in there. Then you will package the required items of your plugin into zip. You don't necessarily have to put things in directory structure, everything can be in same folder views, dll etc. Just make sure to reference the views with same diretory structure in controllers.
    Where are my views and controllers built?

    Your controllers, modules, entities and any other code item will be compiled into project output DLLs. All the source code of your controllers will stay within your plugin source. In order to distribute your plugin, you will have to provide the view files, any static content (CSS, js, images), and the DLLs having compiled controllers, models, etc.


    The views and controllers will be created within your project. This way the controller will be compiled into the project class library. In order to make the plugin work in AbleCommerce, you will have to copy over the views into Plugin distributable zip.

    In the Web Application Project, any source files are compiled into DLL file and are not required by the application to work. Actually, if you try to publish the AbleCommerce to a folder you will notice the minimum stuff required to run AbleCommerce. You won't see any controller or model source files because those are already compiled into AbleCommerce.dll.

     

    Can I deploy files from the plugin zip to specified folders within the site?

    No, because this would require that you provide elevated rights at the application level. Always try to keep things within the plugins folder. Technically, you don't even need a generic handler in ASP.NET MVC. It made more sense in WebForms where it provided a clean way without all that ViewState etc to process a request. This can be achieved with a controller action in MVC.

    Routing example: http://petesdotnet.blogspot.com/2009/09/generic-handlers-and-aspnet-routing.html

     

    How do I implement Routes for an IHttpHandler?

    You can define your generic handler class, then you can create a route handler class and finally you register a route using that route handler in plugin route provider.

    Regarding web services and ASMX files, these too can work with ASP.NET routing.

    http://www.ookii.org/Blog/creating_a_route_for_a_asmx_web_service_with_aspnet_routing

    The link above demonstrates how you could fully enclose an asmx web service into a class library without the associated physical asmx file.