Plugin authoring problem

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Have been following this tutorial https://www.nopcommerce.com/docs/77/how-to-write-a-nopcommerce-plugin.aspx

Got through The plugin structure, required files, and locations but when I run nop from VS I am not seeing the new plugin when I go to Admin area > Configuration > Plugins?

Why not?

Here's the code

using System.Collections.Generic;
using System.Web.Routing;
using Nop.Core.Domain.Cms;
using Nop.Core.Plugins;
using Nop.Services.Cms;
using Nop.Services.Localization;

namespace Nop.Plugin.Widgets.Clock
{
    public partial class ClockPlugin : BasePlugin, IWidgetPlugin
    {
        /// <summary>
        /// Get a list of supported widget zones; if empty list is returned, then all zones are supported
        /// </summary>
        /// <returns>A list of supported widget zones</returns>
        public IList<WidgetZone> SupportedWidgetZones()
        {
            //limit widget to the following zones
            return new List<WidgetZone>()
            {
                WidgetZone.BeforeLeftSideColumn,
                WidgetZone.AfterLeftSideColumn,
                WidgetZone.BeforeRightSideColumn,
                WidgetZone.AfterRightSideColumn
            };
        }

        /// <summary>
        /// Gets a route for provider configuration
        /// </summary>
        /// <param name="widgetId">Widget identifier</param>
        /// <param name="actionName">Action name</param>
        /// <param name="controllerName">Controller name</param>
        /// <param name="routeValues">Route values</param>
        public void GetConfigurationRoute(int widgetId, out string actionName, out string controllerName, out RouteValueDictionary routeValues)
        {
            actionName = "Configure";
            controllerName = "WidgetsClock";
            routeValues = new RouteValueDictionary() { { "Namespaces", "Nop.Plugin.Widgets.Clock.Controllers" }, { "area", null }, { "widgetId", widgetId } };
        }

        /// <summary>
        /// Gets a route for displaying widget
        /// </summary>
        /// <param name="widgetId">Widget identifier</param>
        /// <param name="actionName">Action name</param>
        /// <param name="controllerName">Controller name</param>
        /// <param name="routeValues">Route values</param>
        public void GetDisplayWidgetRoute(int widgetId, out string actionName, out string controllerName, out RouteValueDictionary routeValues)
        {
            actionName = "PublicInfo";
            controllerName = "WidgetsClock";
            routeValues = new RouteValueDictionary() { { "Namespaces", "Nop.Plugin.Widgets.Clock.Controllers" }, { "area", null }, { "widgetId", widgetId } };
        }

        /// <summary>
        /// Install plugin
        /// </summary>
        public override void Install()
        {
            
            base.Install();
        }

        /// <summary>
        /// Uninstall plugin
        /// </summary>
        public override void Uninstall()
        {
            
            base.Uninstall();
        }
    }
}


and the description.txt file

Group: Widgets
FriendlyName: Clock
SystemName: Widgets.Clock
Version: 1.00
SupportedVersions: 2.50
Author: Dave Burgoyne
DisplayOrder: 1
FileName: Nop.Plugin.Widgets.Clock.dll


anyone point out where I'm going wrong?

Thanks

Dave
12 years ago
Is your output path set to ..\..\Presentation\Nop.Web\Plugins\PLUGIN_NAME
12 years ago
yep

..\..\Presentation\Nop.Web\Plugins\Widgets.Clock\

in all configs
12 years ago
daveb wrote:
when I run nop from VS...

I would be faster to debug why the plugin is not loaded at application startup. Have a look \Libraries\Nop.Core\Plugins\PluginManager.cs file, Initialize method
12 years ago
a.m. wrote:
when I run nop from VS...
I would be faster to debug why the plugin is not loaded at application startup. Have a look \Libraries\Nop.Core\Plugins\PluginManager.cs file, Initialize method


Hi Andrei,

I finally got to the bottom of the issue.

I had entered the correct project build output path (by hand) but I had not created the output folder. ^_^

It might be an idea to note in the 'how to' guide that you need to do this.

Thanks for the pointer.

Dave
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.