how to create a pluggin - that includes creating new table and admin area pages [ver 4.20]

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 years ago
I want to create a custom pluggin that need to create two tables when installing, also it must include a controller with admin panel page and view.
3 years ago
Have a look at the Nop.Plugin.Shipping.FixedByWeightByTotal plugin which will show you a few things
3 years ago
(Plugin FixedByWeightByTotal won't show how to do 'admin page' in general, because it's a shipping provider which inherits from IShippingRateComputationMethod.  Also look at  Nop.Plugin.Misc.SendinBlue which inherits from IMiscPlugin)
3 years ago
after i created a controller, the view is loaded but style is not coming as like admin area pages.
3 years ago
Note this in other plugin's Configure.cshtml file

@{
    Layout = "_ConfigurePlugin";
}

Also, be sure to have a _ViewImports.cshtml file (just copy from another plugin \Views folder)
3 years ago
New York wrote:
Note this in other plugin's Configure.cshtml file

@{
    Layout = "_ConfigurePlugin";
}

Also, be sure to have a _ViewImports.cshtml file (just copy from another plugin \Views folder)



Thank you, it worked.
3 years ago
when i fetch a list of item from DB, iam getting the following error,

Unmapped members were found. Review the types and members below.
Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type
For no matching constructor, add a no-arg ctor, add optional arguments, or map all of the constructor parameters
==============================================================================================
AutoMapper created this type map for you, but your types cannot be mapped using the current configuration.
PremSqlReportProxy -> PremSqlReportModel (Destination member list)
Castle.Proxies.PremSqlReportProxy -> Nop.Plugin.Report.CustomReport.Models.PremSqlReportModel (Destination member list)

Unmapped properties:
Filters
PageSize
CustomProperties


Table Class

public partial class PremSqlReport : BaseEntity
    {
        public string Name { get; set; }
        public string Description { get; set; }
        public string Sql { get; set; }
    }

Mapping Class

public partial class CustomTableMap : NopEntityTypeConfiguration<PremSqlReport>
    {
        public override void Configure(EntityTypeBuilder<PremSqlReport> builder)
        {
            builder.ToTable(nameof(PremSqlReport));

            builder.HasKey(premSqlReport => premSqlReport.Id);
            builder.Property(premSqlReport => premSqlReport.Name).HasMaxLength(400).IsRequired();
            builder.Property(premSqlReport => premSqlReport.Description).HasMaxLength(400);
            builder.Property(premSqlReport => premSqlReport.Sql).HasMaxLength(400);

            base.Configure(builder);
        }
    }
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.