public new void Initialize(BaseCommerceModelRepository repository, List <ProductEntity> productEntityList, bool initializeAsMock = false, string searchKeyword = "") { base.Initialize(repository, productEntityList, initializeAsMock, searchKeyword); PurchasableChildProducts = new List <PurchasableProductSummaryViewModel>(); foreach (var product in productEntityList) { PurchasableProductSummaryViewModel viewModel = this.ModelProvider.GetModel <PurchasableProductSummaryViewModel>(); viewModel.Initialize(product, initializeAsMock); PurchasableChildProducts.Add(viewModel); } }
public static PurchasableProductListJsonResult InitializeMockData(BaseCommerceModelRepository repository, PurchasableProductListJsonResult model) { List <ProductEntity> productEntities = GetProductEntities(); model.Initialize(repository, productEntities, true, ""); foreach (PurchasableProductSummaryViewModel product in model.ChildProducts) { MediaItem item = Sitecore.Context.Database.GetItem(CatalogFeatureConstants.MockDataItems.MockProductId); product.Images.Add(item); product.DisplayName = "Lorem ipsum"; product.Description = "Lorem ipsum"; product.DisplayStartingFrom = true; product.Link = "/"; } return(model); }