rahat wrote:
As the CategoryNavigation.cshtml view exist in two locations so the viewengine confuse which one it will show. The solution is write
return PartialView("~/Plugins/YourPlugin/Views/YourView/CategoryNavigation.cshtml", model);
at controller. Where from the view appear. I mean at
public ActionResult CategoryNavigation(int currentCategoryId, int currentProductId)
{
...................
}
I do not think the view engine is confused! A file can exist in multiple locations and the first searched-found location is returned. That is how the MVC works.
I am not having any error in the application. I just need the view rendered from the plugin. I am trying to override the left category section from a plugin. That is why I do not want to modify the Catalog controller either.
Ok let me understand your requirement first. If you want to show "CategoryNavigation.cshtm" view from your plugin then at _ColumnsTwo.cshtml you may write
@Html.Action("YourCustomCategoryNavigation", "YourPluginController", new { currentCategoryId = currentCategoryId, currentProductId = currentProductId })
The "YourCustomCategoryNavigation" method will have the same functionality as the default one but it will return
return PartialView("~/Plugins/YourPlugin/Views/YourView/CategoryNavigation.cshtml", model);
If you do not want to change _ColumnsTwo.cshtml then you need to handle it by widget.