I have created two plugins named for example named as CustomPlugin & MyPlugin. There is one common view page in both of these plugins but with different Model. I use View engine in both of these plugins. I have registered View Engine on 0 index in both plugins.
I want to know which plugin call that view page first? How View Engine works if it has two path for 0 index? Is there any way to make it first always?
I have done this already. My main problem is to have same view page in both plugin.
For example, view page name is xyz.cshtml. So my both plugin contain a separate view page in their own folder and with their model but view page name is same. Now when I run my application it gives me an error for model like expecting model is customplugin.model and it is getting myplugin.model.
I have done this already. My main problem is to have same view page in both plugin.
For example, view page name is xyz.cshtml. So my both plugin contain a separate view page in their own folder and with their model but view page name is same. Now when I run my application it gives me an error for model like expecting model is customplugin.model and it is getting myplugin.model.
How can I solve this?
on many plugin the view name is same just difference is plugin namespace and its output folder
The model item passed into the dictionary is of type 'Nop.Plugin.Models.CustomModel', but this dictionary requires a model item of type 'Nop.Plugin.Models.MyPluginModel'.
Because xyz.cshtml page is exist in both plugin. I am trying to run page of Custom plugin but it will find page in MyPlugin first. Hence it throws above error.
The model item passed into the dictionary is of type 'Nop.Plugin.Models.CustomModel', but this dictionary requires a model item of type 'Nop.Plugin.Models.MyPluginModel'.
Because xyz.cshtml page is exist in both plugin. I am trying to run page of Custom plugin but it will find page in MyPlugin first. Hence it throws above error.
from controller action you are returning Nop.Plugin.Models.CustomModel and in xyz.cshtml you have used Nop.Plugin.Models.MyPluginModel so as both model is not matching it throw this exception.
so its not issue of not finding view but its issue of you are not using same model on both controller action and view it self
The model item passed into the dictionary is of type 'Nop.Plugin.Models.CustomModel', but this dictionary requires a model item of type 'Nop.Plugin.Models.MyPluginModel'.
Because xyz.cshtml page is exist in both plugin. I am trying to run page of Custom plugin but it will find page in MyPlugin first. Hence it throws above error.
publicvoid RegisterRoutes(RouteCollection routes) { System.Web.Mvc.ViewEngines.Engines.Insert(0, new CustomViewEngine()); }
publicint Priority { get { return 10; } }
You register your route in routeprovider. Increase your priority to get desired result.
Then I register view engine from Route file like: ViewEngines.Engines.Insert(0, new CustomPluginViewEngine()); and ViewEngines.Engines.Insert(0, new MyPluginViewEngine()); respectively.
Now, both of this plugin has _productBox.cshtml page with their own model.
Both plugin's functionality won't work together for this page, if both are installed. If only one is installed then it works fine.
Hope this will helps you to understand my problem clearly.