Override View in a Plugin

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

I want to override the view "CategoryTemplate.ProductsInGridOrLines.cshtml" in my own plugin.

I found those 2 links to help me :

https://www.pronopcommerce.com/3-ways-to-display-views-in-your-nopcommerce-plugins-embedded-resource-theme-override-and-custom-view-engine

http://alexwolfthoughts.com/overriding-views-in-a-nopcommerce-plugin/

But I didn't succeed.

I just want override the view to add a custom widgetZone.


On the first link in "The Advanced Method - "Custom View Engine", I don't understand the class "CustomViewEngine.cs"
It says "What this code does is that it adds additional locations for the ViewEngine to search for Views. The placeholder {0} will be replaced by your Controller's Action name."

But I haven't any controller action for the View I want to override. I just want when the View is called, the program search my overrided View instead the basical view.

Can someone help me ?

Thank's
7 years ago
You still can use: ~/Plugins/[YOUR_PLUGIN_FOLDER]/Views/{0}.cshtml. In this case, {0} is replaced by whatever Action that actually gets called. Try it and let me know if it works. :)
7 years ago
Thank you but, I already tried this and it doesn't works :(.
The called View is not my overrided View.
7 years ago
It works ! Sorry I thought i'd to replace {0} manually ...
7 years ago
romain.bordone wrote:
Hello,

I want to override the view "CategoryTemplate.ProductsInGridOrLines.cshtml" in my own plugin.



Please see this: http://www.strivingprogrammers.com/Blog/post/Lavish-Kumar/4129/Beginners-Guide-to-nopCommerce-Plugin-Development-ASP-NET-MVC-Based-e-Commerce-Solution-Part-2/
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.