Hi. this is my first post here.
I have created one misc plugin. but I don't know now how to put this in nopcommerce.web.
following is my plugin description.
plugin: TestPlugin
View: iTestPlugin where I have two input Name and Note
Domain: iTestRecord, I have two properies, Name and Note
Models: iTestListModel and iTestModel
Data: iTestMap and iTestObjectContext
Service: iTestService and IiTestService(interface)
Controller: iTestPlugin
My table: iTestPlugin
I can add both values in database by configure form in plugin in administrator.
Now I want to list out all these values only in home page before ToplcBlock.
I did following steps but getting errors. are these steps right? or how to add misc plugin in nopcommerce.web
step1: I create one view in common folder and named it iTestView. (blank view)
step2: I added following code in commoncontroller
// object declare
private readonly IMiscPlugin _miscPlugin;
// in common constructors
this._miscPlugin = miscplugin // where miscplugin is parameter argument of constructor
step3: Action method in common controller
[ChildActionOnly]
public ActionResult iTestAction()
{
RouteValueDictionary routeValues;
string actionName;
string controllerName;
_miscPlugin.GetConfigurationRoute(out actionName, out controllerName, out routeValues);
var model = new Nop.Web.Models.Common.MiscModel();
model.ActionName = actionName;
model.ControllerName = controllerName;
model.RouteValues = routeValues;
return PartialView(model);
}
step4: index.chtml
@Html.Action("iTestAction", "Common")
<div class="clear">
</div>
when I run project, I get this error.
No parameterless constructor defined for this object.
I think it is because of common constructor where I used IMiscPlugin object.
My GetConfigurationRoute method as following code
public void GetConfigurationRoute(out string actionName, out string controllerName, out RouteValueDictionary routeValues)
{
actionName = "Index";
controllerName = "iTestPlugin";
routeValues = new RouteValueDictionary() { { "Namespaces", "Nop.Plugin.Misc.iTestPlugin.Controllers.Controllers" }, { "area", null } };
}
Note: I have no issue in plugin code. I just want to know how to add misc plugin in nopcommerce.web project.
Thanks
Imrankhan