How to add new component to views

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
1 anno tempo fa
Hi guys
I want to know how can I add new component such as button , image , link ,... to nopcommerce views ?
for example assume you want to add new option to admin panel when the customer is vendor , how do you implement this ? . by the way I don't want to use ViewComponent .
1 anno tempo fa
You can override the razor page and add custom logic there. If you're intending to do it from plugin you can use ViewLocationExpander to override the view (For your case the Admin view). Then you can add your custom logics there.
Ex: Inject customer service in the razor page, check if current customer is vendor then show hide your custom http snippet. But view overriding wouldn't be a good practice as you could break default/other functionalities.
1 anno tempo fa
you can push your input field by jquery and when from submitted you can take this value by using action filter.
1 anno tempo fa
Thanks for your comments guys
If I just want to add a component to a view (for example admin layout of product view) , should I certainly override ViewLocationExpander ?
there is not another solution ?
1 anno tempo fa
Using view component would be easier, and if you don't want to override the views, you can change the response content from plugins using ActionFilters.
For example look over here: https://stackoverflow.com/questions/43610602/read-modify-response-of-mvc-action-with-filters
1 anno tempo fa
Yeah i want to change view from plugin and if i use ViewComponent i should modify nopcommerce views
1 anno tempo fa
You don't have to modify views if you use the existing widget zones defined by default. If you need more widget zones or define new zones to existing views, then you may need to override the existing views.
1 anno tempo fa
Thanks
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.