Accessing a partial view in a Plugin from NopCommerce views. Need Help.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
I've been working with nopCommerce for the last few months with a lot of success until I tried to write my own plugin that would allow me to display data in a view I created in the Nop.Web project.  I used the ProductViewTracker example and was able to install, uninstall, and configure my plugin successfully using Admin.   I can access all my data in my SQL database also.  

Everything was going fine until I tried to access a partial view from a view I created in the Nop.Web project that is specific to my website.  From the view I'm having trouble when I use Html.RenderPartial("actionname", "controllername").  The controller in my plugin is called, but when the controller tries to return the view I receive the error:

The partial view 'GolfCourses' was not found or no view engine supports the searched locations. The following locations were searched:

~/Themes/MyStore/Views/sbagolf/GolfCourses.cshtml
~/Themes/MyStore/Views/sbagolf/GolfCourses.vbhtml
~/Themes/MyStore/Views/Shared/GolfCourses.cshtml
~/Themes/MyStore/Views/Shared/GolfCourses.vbhtml
~/Views/sbagolf/GolfCourses.cshtml
~/Views/sbagolf/GolfCourses.vbhtml
~/Views/Shared/GolfCourses.cshtml
~/Views/Shared/GolfCourses.vbhtml
~/Administration/Views/sbagolf/GolfCourses.cshtml
~/Administration/Views/sbagolf/GolfCourses.vbhtml
~/Administration/Views/Shared/GolfCourses.cshtml
~/Administration/Views/Shared/GolfCourses.vbhtml


Please help.  What am I missing?  Do I need to add my Plugin views to the searched locations?

Big thanks in advance.
11 years ago
It could be that your Route is not configured properly, or you could render the partial using the correct absolute path to the partial view you are trying to access and @Html.Partial instead of @Html.RenderAction:

@Html.Partial(<AbolutePathHere>, model);
11 years ago
After a lot of searching I finally figured out the problem.  If your calling an "action" "controller" in a Plugin from a view in Nop.Web be sure to use the full path to the view in your Plugin controller.  I found the solution in the LivePersonChat Plugin:

Must use:

return View("Nop.Plugin.Widgets.LivePersonChat.Views.WidgetsLivePersonChat.PublicInfo", model);

Instead of:

return View("PublicInfo", model);
11 years ago
Hi,

Not sure, but my problem is somewhat related to your.. may be you can help me!

Pls review the post I made here:

https://www.nopcommerce.com/boards/t/20987/load-view-from-plugin-without-embedding-it-as-resources.aspx

Please advise.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.