Payment Plugin 3.90

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years ago
Hi All,

I'm working on a payment plugin for V3.90 modelled off the Paypal Standard plugin.  Just working on the UI at this point, but I also want to insert some code into each product page.  I've looked at a few articles and followed the NopPlus.AskAQuestion plugin which does similar.

It doesn't appear to want to work however.  Can I have a payment gateway and insert a widget in the same project?

I have a couple of write logs in there, config page works, the additional payment image appears in te cart however my widget doesn't display.

The code doesn't appear to be getting hit, and I'm not entirely sure how this process is supposed to work, being only a mediocre programmer.

So inmy main cs file I have the following:


        public IList<string> GetWidgetZones()
        {
            _logger.Information("GetWidgetZone");
            return new List<string> { "productdetails_overview_bottom" };
        }




        public void GetDisplayWidgetRoute(string widgetZone, out string actionName, out string controllerName, out RouteValueDictionary routeValues)
        {
            _logger.Information("Entered GetDisplayWidgetRoute");

            actionName = "PublicInfo";
            controllerName = "PaymentZipPay";
            routeValues = new RouteValueDictionary
            {
                {"Namespaces", "Nop.Plugin.Payments.ZipPay.Controllers"},
                {"area", null},
                {"widgetZone", widgetZone}
            };
        }






and in the controller code I have




        [ChildActionOnly]
        public ActionResult PublicInfo(string widgetZone, object additionalData = null)
        {
            //var ZipPayPaymentProcessor = _zipPaymentProcessor; //_settingService.LoadSetting<ZipPayPaymentSettings>(storeScope);
            //ViewBag.ZipPayEnvironment = (string)ZipPayPaymentProcessor.GetZipPayEnvironment();
            //ViewBag.ZipPayPublicKey = (string)ZipPayPaymentProcessor.GetZipPayPublicKey();
            _logger.Information("Entered PublicInfo");
            return View("~/Plugins/Payments.ZipPay/Views/PublicZipInfo.cshtml");
        }





There are a number of things I'm not sure about such as where does the controllername value come from for example.  Is there a good explanation of what gets called and when?


Cheers,
Paul
4 years ago
Do you want widget type plugin behaviour in payment plugin?
4 years ago
Hi,

Primarily it will be a payment plugin, but I also need to embed some "adversising links" into the product pages so they display each time the user goes to the product.  This is just some html and script code that generates a popup when clicked.



Cheers,

Paul
4 years ago
Inherit and implement
IWidgetPlugin
in payment processor class. Implement
ViewComponent
(for 4.0 or upper versions) or
Action
(for below 4.0 version).



[Note:] By doing this, your plugin will react as both payment type and widget type plugin. But when you activate this plugin from plugin list page, then nopCommerce may activate any one type. I faced exactly this issue just yesterday. In my case payment type was activated, but widget type was not. So I had to activate that manually by appending plugin system name to  
widgetsettings.activewidgetsystemnames
from all settings page.
4 years ago
OK thanks, I'll look into that.  This is for personal use so it may actually just be easier to create a widget separately if Nop randomly chooses which one to activate.

One thing that confuses me though is where does the controllerName value come from in the GetDisplayWidgetRoute function?  Is this the namespace?

Thanks

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