How to serve request like "localhost:1234/Admin/Product/List" from plugin?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
Hi!!!
I'm working on Nop 2.65 . I need to add two fields at Product level and will use it at order level.
So What are the best practices to implement this...? I'm trying to implement it using making separate plugin but facing some difficulties.
  
How to serve request like "localhost:1234/Admin/Product/List" from plugin? (means all request regarding product like product Add/Update at admin side
11 years ago
Dharmik wrote:
Hi!!!
I'm working on Nop 2.65 . I need to add two fields at Product level and will use it at order level.
So What are the best practices to implement this...? I'm trying to implement it using making separate plugin but facing some difficulties.
  
How to serve request like "localhost:1234/Admin/Product/List" from plugin? (means all request regarding product like product Add/Update at admin side


You can use an ActionFilter to do it. ActionFilter allows you to run codes before / after an Action execution, and I used it a lot in my plugin. :D
11 years ago
wooncherk wrote:

You can use an ActionFilter to do it. ActionFilter allows you to run codes before / after an Action execution, and I used it a lot in my plugin. :D



Hello, I am having the same problem in implementing this type of customization. So can you please give us demo for action filter. How it works? And if possible can you please provide us the demo code or plugin you had written using action filter?

Thanks in advance.
11 years ago
krutal wrote:

You can use an ActionFilter to do it. ActionFilter allows you to run codes before / after an Action execution, and I used it a lot in my plugin. :D


Hello, I am having the same problem in implementing this type of customization. So can you please give us demo for action filter. How it works? And if possible can you please provide us the demo code or plugin you had written using action filter?

Thanks in advance.


Action filter is an MVC concept, so you just need to search on the web and there will be tons of info on it.

Anyway, if you want a starter, I've briefly described Action filter here:

https://www.nopcommerce.com/boards/t/19724/how-to-load-cshtml-file-from-plugin.aspx
11 years ago
Thank you.

I am just starting the action filter. And tried the link you had provided me.

But there just I couldn't understand the code below.

 if (actionDescriptor.ControllerDescriptor.ControllerType == typeof(OrderController) &&
                actionDescriptor.ActionName.Equals("AddProductToOrderDetails") &&
                controllerContext.HttpContext.Request.HttpMethod == "POST")
            {
                return new Filter[]
                {
                    new Filter(_actionFilter, FilterScope.Action, null)
                };
            }


Can you elaborate above part of code please.

Thanks in advance.
11 years ago
krutal wrote:
Thank you.

I am just starting the action filter. And tried the link you had provided me.

But there just I couldn't understand the code below.

 if (actionDescriptor.ControllerDescriptor.ControllerType == typeof(OrderController) &&
                actionDescriptor.ActionName.Equals("AddProductToOrderDetails") &&
                controllerContext.HttpContext.Request.HttpMethod == "POST")
            {
                return new Filter[]
                {
                    new Filter(_actionFilter, FilterScope.Action, null)
                };
            }


Can you elaborate above part of code please.

Thanks in advance.


You only want to apply the filter on specific controller, specific action and specific HTTP method. :D
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.