problems when developing new plugin

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
10 years ago
I am developing a new plugin, but it does not appear in the list of plugins, I do not know what I might be doing wrong.

below is the link to the document I'm following:
https://www.nopcommerce.com/docs/77/how-to-write-a-nopcommerce-plugin.aspx

After step 4 in the topic Handling requests. Controllers, models and views, reads "Now you can see the plugin by going to Admin area> Configuration> Plugins. But as you guessed our plugin does nothing. It does not even have a user interface for its configuration. Let's create a page to configure the plugin. What we need to do now is create a controller, a model, and a view. "

But I can not view it at the location indicated ... what should I do?


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Nop.Core.Plugins;
using Nop.Services.Shipping;
using System.Web.Routing;


namespace Nop.Plugin.Shipping.CorreiosBR
{
    public class CorreiosBR : BasePlugin, IShippingRateComputationMethod
    {

        public override void Install()
        {
            base.Install();
        }

        public override void Uninstall()
        {
            base.Uninstall();
        }

        public override PluginDescriptor PluginDescriptor
        {
            get
            {
                return base.PluginDescriptor;
            }
            set
            {
                base.PluginDescriptor = value;
            }
        }

        public void GetConfigurationRoute(out string actionName, out string controllerName, out System.Web.Routing.RouteValueDictionary routeValues)
        {
            actionName = "Configure";
            controllerName = "ShippingCorreiosBR";
            routeValues = new RouteValueDictionary() { { "Namespaces", "Nop.Plugin.Shipping.CorreiosBR.Controllers" }, { "area", null } };
        }

        public decimal? GetFixedRate(GetShippingOptionRequest getShippingOptionRequest)
        {
            throw new NotImplementedException();
        }

        public GetShippingOptionResponse GetShippingOptions(GetShippingOptionRequest getShippingOptionRequest)
        {
            throw new NotImplementedException();
        }

        public Services.Shipping.Tracking.IShipmentTracker ShipmentTracker
        {
            get { throw new NotImplementedException(); }
        }

        public ShippingRateComputationMethodType ShippingRateComputationMethodType
        {
            get { throw new NotImplementedException(); }
        }
    }
}



Description File
----------------------------------
Group: Shipping methods
FriendlyName: Correios BR
SystemName: Shipping.CorreiosBR
Version: 1.00
SupportedVersions: 2.80
Author: Jolienai Viegas
DisplayOrder: 1
FileName: Nop.Plugin.Shipping.CorreiosBR.dll
10 years ago
On your project's Properties > Build  tab, be sure that the Output Path is set for the Nop.Web plugins subfolder - e.g.

..\..\Presentation\Nop.Web\Plugins\Payments.CashOnDelivery


You can debug if needed.  Set a break point in

\Libraries\Nop.Core\Plugins\PluginManager.cs

                    //load description files
                    foreach (var dfd in GetDescriptionFilesAndDescriptors(pluginFolder))
10 years ago
jolienai wrote:
I am developing a new plugin, but it does not appear in the list of plugins, I do not know what I might be doing wrong.

below is the link to the document I'm following:
https://www.nopcommerce.com/docs/77/how-to-write-a-nopcommerce-plugin.aspx

After step 4 in the topic Handling requests. Controllers, models and views, reads "Now you can see the plugin by going to Admin area> Configuration> Plugins. But as you guessed our plugin does nothing. It does not even have a user interface for its configuration. Let's create a page to configure the plugin. What we need to do now is create a controller, a model, and a view. "

But I can not view it at the location indicated ... what should I do?


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Nop.Core.Plugins;
using Nop.Services.Shipping;
using System.Web.Routing;


namespace Nop.Plugin.Shipping.CorreiosBR
{
    public class CorreiosBR : BasePlugin, IShippingRateComputationMethod
    {

        public override void Install()
        {
            base.Install();
        }

        public override void Uninstall()
        {
            base.Uninstall();
        }

        public override PluginDescriptor PluginDescriptor
        {
            get
            {
                return base.PluginDescriptor;
            }
            set
            {
                base.PluginDescriptor = value;
            }
        }

        public void GetConfigurationRoute(out string actionName, out string controllerName, out System.Web.Routing.RouteValueDictionary routeValues)
        {
            actionName = "Configure";
            controllerName = "ShippingCorreiosBR";
            routeValues = new RouteValueDictionary() { { "Namespaces", "Nop.Plugin.Shipping.CorreiosBR.Controllers" }, { "area", null } };
        }

        public decimal? GetFixedRate(GetShippingOptionRequest getShippingOptionRequest)
        {
            throw new NotImplementedException();
        }

        public GetShippingOptionResponse GetShippingOptions(GetShippingOptionRequest getShippingOptionRequest)
        {
            throw new NotImplementedException();
        }

        public Services.Shipping.Tracking.IShipmentTracker ShipmentTracker
        {
            get { throw new NotImplementedException(); }
        }

        public ShippingRateComputationMethodType ShippingRateComputationMethodType
        {
            get { throw new NotImplementedException(); }
        }
    }
}



Description File
----------------------------------
Group: Shipping methods
FriendlyName: Correios BR
SystemName: Shipping.CorreiosBR
Version: 1.00
SupportedVersions: 2.80
Author: Jolienai Viegas
DisplayOrder: 1
FileName: Nop.Plugin.Shipping.CorreiosBR.dll


There usually can be 2 problems with plugins not displayed in plugin list:

1. Wrong 'SupportedVersions'.
2. Plugins output folder not placed in 'Presentation/Nop.Web/Plugins'.

Check these 2, and then click Reload Plugin List. :)
10 years ago
how to identify the item 1? I'm working with the latest version of nopCommerce.
with respect to item 2 has changed the output path of the project plugin.

2. Plugins not placed in output folder '[my directory] / [my project name web: nopCommerce] / Plugins
10 years ago
jolienai wrote:
how to identify the item 1? I'm working with the latest version of nopCommerce.
with respect to item 2 has changed the output path of the project plugin.

2. Plugins not placed in output folder '[my directory] / [my project name web: nopCommerce] / Plugins


1. Look at Description.txt.
2. There are 2 'Plugins' folders, one is located at ROOT/Plugins, another is at ROOT/Presentation/Nop.Web/Plugins. The first folder is for hosting development files and projects (those source code that you work on in VS). The second folder is the output folder (DLLs only, no source code), of which nopCommerce (at runtime) will scan the folder to identify plugins.
10 years ago
acho que encontrei o problema.

after my test, I report here if it worked.

Regards
10 years ago
I installed nopCommerce using the Microsoft Web Platform Installer and the directory (ROOT/Presentation/Nop.Web/Plugins) not found, what i need to do?
10 years ago
i created the folders structure e worked correct and i can see my plugin for install and for configuration. When I click in configure the error is showed:
A public action method 'Configure' was not found on controller 'Nop.Plugin.Shipping.CorreiosBR.Controllers.ShippingCorreiosBRController'


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Nop.Core.Plugins;
using Nop.Services.Shipping;
using System.Web.Routing;


namespace Nop.Plugin.Shipping.CorreiosBR
{
    public class CorreiosBR : BasePlugin, IShippingRateComputationMethod
    {

        #region override de BasePlugin
        public override void Install()
        {
            base.Install();
        }

        public override void Uninstall()
        {
            base.Uninstall();
        }

        public override PluginDescriptor PluginDescriptor
        {
            get
            {
                return base.PluginDescriptor;
            }
            set
            {
                base.PluginDescriptor = value;
            }
        }
        #endregion


        public void GetConfigurationRoute(out string actionName, out string controllerName, out System.Web.Routing.RouteValueDictionary routeValues)
        {
            actionName = "Configure";
            controllerName = "ShippingCorreiosBR";
            routeValues = new RouteValueDictionary() { { "Namespaces", "Nop.Plugin.Shipping.CorreiosBR.Controllers" }, { "area", null } };
        }

        #region IShippingRateComputationMethod
        public decimal? GetFixedRate(GetShippingOptionRequest getShippingOptionRequest)
        {
            throw new NotImplementedException();
        }

        public GetShippingOptionResponse GetShippingOptions(GetShippingOptionRequest getShippingOptionRequest)
        {
            throw new NotImplementedException();
        }

        public Services.Shipping.Tracking.IShipmentTracker ShipmentTracker
        {
            get { throw new NotImplementedException(); }
        }

        public ShippingRateComputationMethodType ShippingRateComputationMethodType
        {
            get { throw new NotImplementedException(); }
        }
        #endregion
    }
}




below the code of Controller


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;

namespace Nop.Plugin.Shipping.CorreiosBR.Controllers
{
    public class ShippingCorreiosBRController : Controller
    {
        public ActionResult Configure()
        {
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";

            return View();
        }

        [HttpPost]
        public ActionResult Configure(String CEP, String NumeroContrato)
        {
            return Json(new { Result = true, NewCep = CEP, NewNumeroContrato = NumeroContrato}, JsonRequestBehavior.AllowGet);
        }
    }
}




and the error is triggered when:
ConfigureProvider.cshtml

@model ShippingRateComputationMethodModel
@{
    //page title
    ViewBag.Title = T("Admin.Configuration.Shipping.Providers.Configure").Text + " - " + Model.FriendlyName;
}
<div class="section-header">
    <div class="title">
        <img src="@Url.Content("~/Administration/Content/images/ico-configuration.png")" alt="" />
        @T("Admin.Configuration.Shipping.Providers.Configure") - @Model.FriendlyName @Html.ActionLink("(" + T("Admin.Configuration.Shipping.Providers.BackToList") + ")", "Providers")
    </div>
</div>
@if (!String.IsNullOrEmpty(Model.ConfigurationActionName))
{
    @Html.Action(Model.ConfigurationActionName, Model.ConfigurationControllerName, Model.ConfigurationRouteValues);
}
else
{
    @T("Admin.Common.ConfigurationNotRequired")
}
5 years ago
right to be forgotten
5 years ago
right to be forgotten
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.