Creating custom components/models - Without plugins

Monday, November 25, 2024 11:00:06 PM
  • Posted: Thursday, September 12, 2019 8:56 AM
  • 4
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
0
  • Posted: Thursday, September 12, 2019 10:00 AM
  • 953
Hi,

First of all, thanks for the post. GrandNode is pluginable software, it's better to extend its functionality by plugins. To be honest it's also the easiest way to implement changes in it. Is there any reason, why you prefer to do it in source code, instead of plugin creation? GrandNode developer documentation covers topic of plugin creation, because it's the recommended one. I don't know your exact requirements, so I'm not sure on which plugin example you should focus.

Best regards,
Patryk

GrandNode Team
0
  • Posted: Thursday, September 12, 2019 3:42 PM
  • 4
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
0
  • Posted: Friday, September 13, 2019 7:04 AM
  • 953
I'm not able to tell you what's wrong, because without code it's hard to find the issue. If you want, please post the part of code, maybe we will be able to help you somehow.
Best regards,
Patryk

GrandNode Team
0
  • Posted: Friday, September 13, 2019 8:05 AM
  • 4
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; }
        }
    }
}
0
  • Posted: Friday, September 13, 2019 1:12 PM
  • 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.
1
  • Posted: Sunday, November 29, 2020 10:30 AM
  • 10
Patryk wrote:
Hi,

First of all, thanks for the post. GrandNode is pluginable software, it's better to extend its functionality by plugins. To be honest it's also the easiest way to implement changes in it. Is there any reason, why you prefer to do it in source code, instead of plugin creation? GrandNode developer documentation covers topic of plugin creation, because it's the recommended one. I don't know your exact requirements, so I'm not sure on which plugin example you should focus.



Hi Patryk,

I need your help with this topic
I'm searching for the same thing in grand node
I need to extend the mobile home page to add media (Image and Video)
how can I do that using the plugin?

Thank you.
0
  • Posted: Monday, November 30, 2020 7:51 AM
  • 953
Rihab wrote:

Hi Patryk,

I need your help with this topic
I'm searching for the same thing in grand node
I need to extend the mobile home page to add media (Image and Video)
how can I do that using the plugin?

Thank you.


Hi,

You should extend the Mobile app plugin, you won't achieve this goal with external plugin. Everything should be done in mobile app.
Best regards,
Patryk

GrandNode Team
0
back to top
Filters