Override Admin edit product view page in custom plugin- nop commerce 4.2

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

I have recently started working on NOP commerce 4.2. I want to override the existing admin edit product page. I am looking for the correct approach to override the existing views in the plugin.  
Please share if you have any idea about this. I have searched for the same but not found any appropriate document.
4 years ago
Create a custom view location expander in your plugin. Then add this code.
public class ViewLocationExpander : IViewLocationExpander
{
    public void PopulateValues(ViewLocationExpanderContext context)
    {
    }

    public IEnumerable<string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable<string> viewLocations)
    {
        if (context.AreaName == "Admin" && context.ControllerName == "Product" && context.ViewName == "Edit")
            viewLocations = new string[] { $"/Plugins/YourPlugin.PublishFolder/ViewNmae.cshtml" };

        return viewLocations;
    }
}
4 years ago
Thanks for the response.

I am a little bit confuses about code structure.
please refer to the following screenshot.
https://drive.google.com/open?id=1n_nkuqpCyysnpMjXI6WIb6GyDJcQKhTo

This is my add new product page in the admin dashboard.
I want to add 2  input fields after SKU input Filed in the existing admin _createOrUpdate.cshtml file. for this case, I am not getting the exact solution.
can you please share something step by step approach on that. this will help many people.

Thanks in advance
4 years ago
[email protected] wrote:

I want to add 2  input fields after SKU input Filed in the existing admin _createOrUpdate.cshtml file. for this case, I am not getting the exact solution.
can you please share something step by step approach on that. this will help many people.

Thanks in advance


You can alternatively make use of the widget plugin if you want to extend the product entity(It will not add the field directly below the SKU but you can create a separate section at the bottom or at the top) so that you won't have to customize the default source code which the Nop team have implemented.
You can check the Nivo slider plugin  and check this article even though it was targeted for previous version https://dzone.com/articles/what-are-nopcommerce-widgets-and-how-to-create-one
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.