Profile: Jacob

Statistics
Avatar
  • 4

Update on this - Turns out the issue was the description hadn't been changed to copy if newer and as such wasn't copied into the project references, apologies.

Friday, September 13, 2019 1:12 PM

The code I've added to try this has just been the same as the base plugin creation guide - http://docs.grandnode.com/how-to-create-base-plugin-3

The only difference I can see is that I've tried changing the project references/property groups for the plugin - tried with ..\ and ..\{Top folder}
e.g.
<ProjectReference Include="..\PluginTestProj\Grand.Services\Grand.Services.csproj">
      <Private>false</Private>
</ProjectReference>

FeaturedVendorsPlugin.cs


using Grand.Core.Plugins;
using Grand.Services.Common;
using System.Threading.Tasks;

namespace Grand.Plugin.Misc.FeaturedVendors
{
    public class FeaturedVendorsPlugin : BasePlugin, IMiscPlugin
    {
        #region Methods
        public override async Task Install()
        {
            await base.Install();
        }
        public override async Task Uninstall()
        {
            await base.Uninstall();
        }

        #endregion
    }
}


DependencyRegistrar.cs

using Autofac;
using Grand.Core.Configuration;
using Grand.Core.Infrastructure;
using Grand.Core.Infrastructure.DependencyManagement;

namespace Grand.Plugin.Misc.FeaturedVendors
{
    public class DependencyRegistrar : IDependencyRegistrar
    {
        public void Register(ContainerBuilder builder, ITypeFinder typeFinder, GrandConfig config)
        {
            builder.RegisterType<FeaturedVendorsPlugin>().InstancePerLifetimeScope();
        }

        public int Order
        {
            get { return 1; }
        }
    }
}

Friday, September 13, 2019 8:05 AM

Thanks for replying, I've had a quick look at the plugins section on the documentation and tried to implement that but every time I try to reload the list of plugins it crashes out without catching the exception. (System.Threading.Tasks.TaskCanceledException: A task was canceled). Wondering if you've got any ideas on this?

The reason I was looking into not doing it as a plugin originally was just because the component didn't really require much logic/I was unsure of the overhead on the plugins compared to a few class files in the source code.

Thanks

Thursday, September 12, 2019 3:42 PM

Hi,

I'm wondering if it's possible to add custom models/components into the platform without the use of plugins?

For example, I want to create a featured vendor component which can be hardcoded through JSON/Model in the component file.

Is what I want to achieve possible without creating a plugin and if so, is there any information on custom components as I can't find this in the docs?

Thanks

Thursday, September 12, 2019 8:56 AM