public FindProduct GetFindProduct(IMarket market)
        {
            List <VariationContent> productVariants = GetVariants(this);
            var variations = GetFashionVariants(productVariants, market);

            var    language = (Language == null ? string.Empty : Language.Name);
            string sizeType = string.IsNullOrEmpty(SizeType) ? "" : SizeType.First().ToString(CultureInfo.InvariantCulture);

            var findProduct = new FindProduct(this, language);

            findProduct.Description = Description;
            findProduct.Color       = FacetColor == null ? new List <string>() : FacetColor.Split(',').ToList();
            findProduct.Sizes       =
                variations.Select(x => x.Size == null ? string.Empty : x.Size.TrimEnd('-')).Distinct().ToList();
            findProduct.SizeType  = sizeType;
            findProduct.SizeUnit  = SizeUnit;
            findProduct.Fit       = Fit;
            findProduct.SizesList = CreateSizeList(variations.Select(x => x.Size).Distinct().ToList(), SizeUnit,
                                                   sizeType);

            EPiServer.Commerce.SpecializedProperties.Price defaultPrice = productVariants.GetDefaultPrice(market);

            findProduct.DefaultPrice       = productVariants.GetDisplayPrice(market);
            findProduct.DefaultPriceAmount = productVariants.GetDefaultPriceAmount(market);
            findProduct.DiscountedPrice    = productVariants.GetDiscountDisplayPrice(defaultPrice, market);

            // TODO: Set if not the same as default price
            findProduct.DiscountedPriceAmount = 0;

            findProduct.CustomerClubPrice = productVariants.GetCustomerClubDisplayPrice(market);
            findProduct.Variants          = variations;
            findProduct.NewItemText       = NewItemText;
            return(findProduct);
        }
Пример #2
0
        public FindProduct GetFindProduct(IMarket market)
        {
            List <VariationContent> productVariants = GetVariants(this);
            var variations = GetFashionVariants(productVariants, market);

            var    language = (Language == null ? string.Empty : Language.Name);
            string sizeType = string.IsNullOrEmpty(SizeType) ? "" : SizeType.First().ToString(CultureInfo.InvariantCulture);

            var findProduct = new FindProduct(this, language);

            findProduct.Description = Description;
            findProduct.Color       = FacetColor == null ? new List <string>() : FacetColor.Split(',').ToList();
            findProduct.Sizes       =
                variations.Select(x => x.Size == null ? string.Empty : x.Size.TrimEnd('-')).Distinct().ToList();
            findProduct.SizeType  = sizeType;
            findProduct.SizeUnit  = SizeUnit;
            findProduct.Fit       = Fit;
            findProduct.SizesList = CreateSizeList(variations.Select(x => x.Size).Distinct().ToList(), SizeUnit,
                                                   sizeType);

            findProduct.SetPriceData(productVariants, market);

            findProduct.Variants    = variations;
            findProduct.NewItemText = NewItemText;
            return(findProduct);
        }