public ProductOverviewModel() { ProductPrice = new ProductPriceModel(); DefaultPictureModel = new PictureModel(); ProductSpecificationModel = new ProductSpecificationModel(); ReviewOverviewModel = new ProductReviewOverviewModel(); }
public ProductDetailsModel() { DefaultPictureModel = new PictureModel(); PictureModels = new List <PictureModel>(); GiftCard = new GiftCardModel(); ProductPrice = new ProductPriceModel(); AddToCart = new AddToCartModel(); ProductAttributes = new List <ProductAttributeModel>(); AssociatedProducts = new List <ProductDetailsModel>(); VendorModel = new VendorBriefInfoModel(); Breadcrumb = new ProductBreadcrumbModel(); ProductTags = new List <ProductTagModel>(); ProductSpecificationModel = new ProductSpecificationModel(); ProductManufacturers = new List <ManufacturerBriefInfoModel>(); ProductReviewOverview = new ProductReviewOverviewModel(); TierPrices = new List <TierPriceModel>(); ProductEstimateShipping = new ProductEstimateShippingModel(); }
public static IList<ProductSpecificationModel> PrepareProductSpecificationModel(this Controller controller, IWorkContext workContext, ISpecificationAttributeService specificationAttributeService, ICacheManager cacheManager, Product product) { if (product == null) throw new ArgumentNullException("product"); string cacheKey = string.Format(ModelCacheEventConsumer.PRODUCT_SPECS_MODEL_KEY, product.Id, workContext.WorkingLanguage.Id); return cacheManager.Get(cacheKey, () => specificationAttributeService.GetProductSpecificationAttributes(product.Id, 0, null, true) .Select(psa => { var m = new ProductSpecificationModel { SpecificationAttributeId = psa.SpecificationAttributeOption.SpecificationAttributeId, SpecificationAttributeName = psa.SpecificationAttributeOption.SpecificationAttribute.GetLocalized(x => x.Name), ColorSquaresRgb = psa.SpecificationAttributeOption.ColorSquaresRgb }; switch (psa.AttributeType) { case SpecificationAttributeType.Option: m.ValueRaw = HttpUtility.HtmlEncode(psa.SpecificationAttributeOption.GetLocalized(x => x.Name)); break; case SpecificationAttributeType.CustomText: m.ValueRaw = HttpUtility.HtmlEncode(psa.CustomValue); break; case SpecificationAttributeType.CustomHtmlText: m.ValueRaw = psa.CustomValue; break; case SpecificationAttributeType.Hyperlink: m.ValueRaw = string.Format("<a href='{0}' target='_blank'>{0}</a>", psa.CustomValue); break; default: break; } return m; }).ToList() ); }