Basically, I'm adding a Silverlight 4 Bing Map as a new page to nopCommerce (e.g., to display customers on a map). I'm stuck trying to figure out where to modify the database mappping to the model so that a new menu item can be added as optional (kinda like Forums and Blogs) and persisted (saved).
What I've done so far works great (map is displayed) so long as I comment out the optional section (ie, the IF block). I'd like to be able to make this an Admin controllable item. Here are the steps I've taken:
1. Add bool value to model
Modified [Project Root]\Libraries\Nop.Web\Models\Common\MenuModel.cs to add new boolean value:
public bool MapEnabled { get; set; }
2. Register route
Modified [Project Root]\Libraries\Nop.Web\Infrastructure\RouteProvider.cs (right after home page stuff) and added:
//Map
routes.MapLocalizedRoute("Map",
"map",
new { controller = "Map", action = "Index" },
new[] { "Nop.Web.Controllers" });
3. Add conditional logic for menu item display
Modified [Project Root]\Libraries\Nop.Web\Views\Common\Menu.cshtml (right after home page stuff) and added:
@if (Model.MapEnabled)
{
<li><a href="@Url.RouteUrl("Map")">@T("Map")</a></li>
}
4. Add string resource to database
INSERT INTO [dbo].[LocaleStringResource]
VALUES(1,'Map','Map')
5. Create partial view base
A. Copied from existing [Project Root]\Libraries\Nop.Web\Views\Shared\_ColumnsOne.cshtml to create _ColumnsOneMap.cshtml
B. Modified _ColumnsOneMap.cshtml replace contents with (note map section):
@{
Layout = "~/Views/Shared/_Root.cshtml";
}
<div class="master-wrapper-center-1">
<div class="master-wrapper-cph-1">
<div style="height:600px; overflow: scroll">
@Helpers.Silverlight("~/ClientBin/BingMaps.Silverlight.xap", "4.0")
</div>
@Html.Action("WidgetsByZone", "Widget", new { widgetZone = Nop.Core.Domain.Cms.WidgetZone.BeforeMainColumn })
@RenderBody()
@Html.Action("WidgetsByZone", "Widget", new { widgetZone = Nop.Core.Domain.Cms.WidgetZone.AfterMainColumn })
</div>
</div>
6. Create new view that inherits from partial view
A. Add Map folder under [Project Root]\Libraries\Nop.Web\Views and add new view [Project Root]\Libraries\Nop.Web\Views\Map\Map\Index.cshtml to it
B. Modified Map.cshtml replace contents with:
@{
Layout = "~/Views/Shared/_ColumnsOneMap.cshtml";
}
<div class="mapmain">
</div>
What am I missing? I know the model has to be mapped (not mapped as in Bing Maps but code to database mapped) to the database but I can't figure out where this happens for the menu items.
Any help will be greatly appreciated.