Plugin to change the view file - NopCommerce 4.50

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
1 ano atrás
I need to create a plugin to edit the view file in
\src\Presentation\Nop.Web\Views\Customer\Info.cshtml
.

Here's the part I want to edit. I just need to add the
readonly
attribute to the input tag.



How can I do this as a plugin that inserts this attribute?

I know to write one but no idea how I can write a controller to go to this file and edit it.

Or how can I even write one that overrides this view?

PS - I'm using NopCommerce 4.50
1 ano atrás
It would be great if I find a way to do it so that I can also customize the paths in the site URLs by editing
src\Presentation\Nop.Web\Infrastructure\RouteProvider.cs
.
1 ano atrás
Please see this:  http://www.strivingprogrammers.com/Beginners-Guide-to-nopCommerce-Plugin-Development-ASP-NET-MVC-Based-e-Commerce-Solution-Part-2
https://www.nopcommerce.com/en/boards/topic/70457/how-to-override-view-on-nop-420
https://www.nopcommerce.com/en/boards/topic/51467/override-view-page
1 ano atrás
SagarKayasth wrote:

Thank you. Can I use the same method to edit the routes  in this one too?
src\Presentation\Nop.Web\Infrastructure\RouteProvider.cs
1 ano atrás
ckvigneshccts wrote:

Thank you. Can I use the same method to edit the routes  in this one too?
src\Presentation\Nop.Web\Infrastructure\RouteProvider.cs


You need to create route provide in you custom plugin.
see the example:
namespace Nop.Plugin.Misc.MyCustomPlugin.Infrastructure
{
    public class RouteProvider : IRouteProvider
    {
        public void RegisterRoutes(IEndpointRouteBuilder endpointRouteBuilder)
        {
var pattern = string.Empty;
            if (DataSettingsManager.DatabaseIsInstalled)
            {
                var localizationSettings = endpointRouteBuilder.ServiceProvider.GetRequiredService<LocalizationSettings>();
                if (localizationSettings.SeoFriendlyUrlsForLanguagesEnabled)
                {
                    var langservice = endpointRouteBuilder.ServiceProvider.GetRequiredService<ILanguageService>();
                    var languages = langservice.GetAllLanguages().ToList();
                    pattern = "{language:lang=" + languages.FirstOrDefault().UniqueSeoCode + "}/";
                }
            }

            //customer account links
            endpointRouteBuilder.MapControllerRoute("pluginsystemname.CustomerInfo", $"{pattern}customer/info",
                new { controller = "YourPluginContorller", action = "YourpluginMethodName" });            
        }
        public int Priority
        {
            get
            {
                return int.MaxValue; ;
            }
        }

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