Add domain and Install data
step 1: Add Domain
add domain named with DisplayDefaultFooterItemSettings.cs at path:
\src\Libraries\Nop.Core\Domain\Common\DisplayDefaultFooterItemSettings.cs
using System;
using System.Collections.Generic;
using System.Text;
using Nop.Core.Configuration;
namespace Nop.Core.Domain.Common
{
/// <summary>
/// Display default menu item settings
/// </summary>
public class DisplayDefaultFooterItemSettings : ISettings
{
/// <summary>
/// Gets or sets a value indicating whether to display "sitemap" footer item
/// </summary>
public bool DisplaySitemapFooterItem { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to display "contact us" footer item
/// </summary>
public bool DisplayContactUsFooterItem { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to display "product search" footer item
/// </summary>
public bool DisplayProductSearchFooterItem { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to display "news" footer item
/// </summary>
public bool DisplayNewsFooterItem { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to display "blog" footer item
/// </summary>
public bool DisplayBlogFooterItem { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to display "forums" footer item
/// </summary>
public bool DisplayForumsFooterItem { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to display "recently viewed products" footer item
/// </summary>
public bool DisplayRecentlyViewedProductsFooterItem { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to display "compare products" footer item
/// </summary>
public bool DisplayCompareProductsFooterItem { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to display "new products" footer item
/// </summary>
public bool DisplayNewProductsFooterItem { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to display "customer info" footer item
/// </summary>
public bool DisplayCustomerInfoFooterItem { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to display "customer orders" footer item
/// </summary>
public bool DisplayCustomerOrdersFooterItem { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to display "customer addresses" footer item
/// </summary>
public bool DisplayCustomerAddressesFooterItem { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to display "shopping cart" footer item
/// </summary>
public bool DisplayShoppingCartFooterItem { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to display "wishlist" footer item
/// </summary>
public bool DisplayWishlistFooterItem { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to display "apply vendor account" footer item
/// </summary>
public bool DisplayApplyVendorAccountFooterItem { get; set; }
}
}
step 2:Install data
\src\Libraries\Nop.Services\Installation\UpgradeService.cs
protected virtual void InstallDisplayDefaultFooterItemSettings()
{
var displayDefaultFooterItemSettings = _settingService.LoadSetting<DisplayDefaultFooterItemSettings>();
var newDisplayDefaultFooterItemSettings = new DisplayDefaultFooterItemSettings
{
DisplaySitemapFooterItem = true,
DisplayContactUsFooterItem = true,
DisplayProductSearchFooterItem = true,
DisplayNewsFooterItem = true,
DisplayBlogFooterItem = true,
DisplayForumsFooterItem = true,
DisplayRecentlyViewedProductsFooterItem = true,
DisplayCompareProductsFooterItem = true,
DisplayNewProductsFooterItem = true,
DisplayCustomerInfoFooterItem = true,
DisplayCustomerOrdersFooterItem = true,
DisplayCustomerAddressesFooterItem = true,
DisplayShoppingCartFooterItem = true,
DisplayWishlistFooterItem = true,
DisplayApplyVendorAccountFooterItem = true
};
displayDefaultFooterItemSettings = newDisplayDefaultFooterItemSettings;
_settingService.SaveSetting<DisplayDefaultFooterItemSettings>(newDisplayDefaultFooterItemSettings);
}
#region Methods
public void UpgradeData()
{
//InstallEmailAccounts();
//InstallAdminAreaSettings();
//InstallForumSettings();
//InstallCaptchaSettings();
//InstallTopicTemplates();
//InstallTopics();
InstallDisplayDefaultFooterItemSettings();
}
#endregion
result
// collection: Setting
{
"_id" : ObjectId("5f762ecea5fd6e5568d09ecc"),
"GenericAttributes" : [ ],
"Name" : "Nop.Core.Domain.Common.DisplayDefaultFooterItemSettings, Nop.Core",
"Value" : null,
"StoreId" : 0,
"Settings" : {
"DisplaySitemapFooterItem" : true,
"DisplayContactUsFooterItem" : true,
"DisplayProductSearchFooterItem" : true,
"DisplayNewsFooterItem" : true,
"DisplayBlogFooterItem" : true,
"DisplayForumsFooterItem" : true,
"DisplayRecentlyViewedProductsFooterItem" : true,
"DisplayCompareProductsFooterItem" : true,
"DisplayNewProductsFooterItem" : true,
"DisplayCustomerInfoFooterItem" : true,
"DisplayCustomerOrdersFooterItem" : true,
"DisplayCustomerAddressesFooterItem" : true,
"DisplayShoppingCartFooterItem" : true,
"DisplayWishlistFooterItem" : true,
"DisplayApplyVendorAccountFooterItem" : true
}
}
register service and display data in Footer ViewComponent
ste[ 3:register service
\src\Presentation\Nop.Web.Framework\DependencyRegistrar.cs
services.AddTransient<DisplayDefaultFooterItemSettings>(sp =>
{
var _settingService = sp.GetService<ISettingService>();
var value = _settingService.LoadSetting<DisplayDefaultFooterItemSettings>();
var currentSetting = new DisplayDefaultFooterItemSettings();
currentSetting = value;
//do something with it
return currentSetting;
});
display