با سلام
با این راه حل، وقتی یک محصول به لیست مقایسه افزوده شود، سیستم کلاس CSS با نام in-compare-list"" را به ریشه ی تگ جزئیات محصول/نمایش جعبه ای محصول می افزاید. بنابراین شما میتوانید استایل هر یک از عناصر زیرمجموعه را تغییر دهید.
یک پوشه با نام Features در پروژه ی Nop.Web ایجاد کنید.
در پوشه ی Features دو کلاس جدید با نام های CustomProductModelFactory و DependencyRegistrar ایجاد نمایید و کدهای زیر را در آن ها قرار دهید:
برای ناپ کامرس 4.00CustomProductModelFactory.cs
using Nop.Core;
using Nop.Core.Caching;
using Nop.Core.Domain.Catalog;
using Nop.Core.Domain.Customers;
using Nop.Core.Domain.Media;
using Nop.Core.Domain.Orders;
using Nop.Core.Domain.Seo;
using Nop.Core.Domain.Vendors;
using Nop.Services.Catalog;
using Nop.Services.Directory;
using Nop.Services.Helpers;
using Nop.Services.Localization;
using Nop.Services.Media;
using Nop.Services.Security;
using Nop.Services.Shipping.Date;
using Nop.Services.Stores;
using Nop.Services.Tax;
using Nop.Services.Vendors;
using Nop.Web.Factories;
using Nop.Web.Framework.Mvc.Models;
using Nop.Web.Framework.Security.Captcha;
using Nop.Web.Models.Catalog;
using System.Collections.Generic;
using System.Linq;
namespace Nop.Web.Features
{
public class CustomProductModelFactory : ProductModelFactory
{
private readonly IAclService _aclService;
private readonly ICompareProductsService _compareProductsService;
private readonly IStoreMappingService _storeMappingService;
public CustomProductModelFactory(
ISpecificationAttributeService specificationAttributeService, ICategoryService categoryService, IManufacturerService manufacturerService,
IProductService productService, IVendorService vendorService, IProductTemplateService productTemplateService,
IProductAttributeService productAttributeService, IWorkContext workContext, IStoreContext storeContext,
ITaxService taxService, ICurrencyService currencyService, IPictureService pictureService,
ILocalizationService localizationService, IMeasureService measureService, IPriceCalculationService priceCalculationService,
IPriceFormatter priceFormatter, IWebHelper webHelper, IDateTimeHelper dateTimeHelper,
IProductTagService productTagService, IAclService aclService, IStoreMappingService storeMappingService,
IPermissionService permissionService, IDownloadService downloadService, IProductAttributeParser productAttributeParser,
IDateRangeService dateRangeService, MediaSettings mediaSettings, CatalogSettings catalogSettings,
VendorSettings vendorSettings, CustomerSettings customerSettings, CaptchaSettings captchaSettings,
OrderSettings orderSettings, SeoSettings seoSettings, IStaticCacheManager cacheManager,
ICompareProductsService compareProductsService)
: base(specificationAttributeService, categoryService, manufacturerService,
productService, vendorService, productTemplateService,
productAttributeService, workContext, storeContext,
taxService, currencyService, pictureService,
localizationService, measureService, priceCalculationService,
priceFormatter, webHelper, dateTimeHelper,
productTagService, aclService, storeMappingService,
permissionService, downloadService, productAttributeParser,
dateRangeService, mediaSettings, catalogSettings,
vendorSettings, customerSettings, captchaSettings,
orderSettings, seoSettings, cacheManager)
{
_aclService = aclService;
_compareProductsService = compareProductsService;
_storeMappingService = storeMappingService;
}