How to create a Custom Action Filter in nopCommerce v4

2 years ago
Just started to upgrade one of our sites to v4.0 and been through the process of upgrading the Action Filters. Thought someone else might interested in this, so I created (my first) a blog post:

http://blog.majako.net/how-to-create-a-custom-action-filter-in-nopcommerce-v4/

Any feedback appreciated!
2 years ago
Hello,

This is appreciated. We are using this from a long time but it is good to see someone shared a nice written blog on it.
2 years ago
You can also implement INopStartup

https://www.nopcommerce.com/boards/t/49255/how-can-i-register-a-global-action-filter-from-my-plugin-in-nopcommere-40.aspx
2 years ago
timmit wrote:
You can also implement INopStartup

https://www.nopcommerce.com/boards/t/49255/how-can-i-register-a-global-action-filter-from-my-plugin-in-nopcommere-40.aspx


Thanks, I updated the post to take this approach instead.
2 years ago
Very nice, by using the generic filter Add method there is no need to manually instantiate the filter class and DI will handle constructor injection.


public void ConfigureServices(IServiceCollection services, IConfigurationRoot configuration)
        {
            services.Configure<MvcOptions>(config =>
            {              
                config.Filters.Add<ProductDetailsActionFilter>();
            });
        }
2 years ago
I followed your guide, but the filter is called in all stores even if it is limited to only one of them.

How can I limit the filter to just one store?
2 years ago
mgustafsson

This link http://blog.majako.net/how-to-create-a-custom-action-filter-in-nopcommerce-v4/

Doesn't work!

Can this be fixed?
Please
1 year ago
Hemyl wrote:
mgustafsson

This link http://blog.majako.net/how-to-create-a-custom-action-filter-in-nopcommerce-v4/

Doesn't work!

Can this be fixed?
Please


Article is moved to:

http://www.majako.net/how-to-create-a-custom-action-filter-in-nopcommerce-v4/