Example #1
0
        /// <summary>
        /// Gets the URL.
        /// </summary>
        /// <param name="entry">The entry.</param>
        /// <param name="relationRepository">The relation repository.</param>
        /// <param name="urlResolver">The URL resolver.</param>
        /// <param name="language">The language.</param>
        /// <returns>The Url for the <param name="entry"></param>.</returns>
        /// <exception cref="T:System.Web.HttpException">The Web application is running under IISĀ 7 in Integrated mode.</exception>
        /// <exception cref="T:System.InvalidOperationException">The current <see cref="T:System.Uri" /> instance is not an absolute instance.</exception>
        /// <exception cref="T:System.ArgumentException">The specified <see cref="UriPartial.Authority"/> is not valid.</exception>
        /// <exception cref="T:System.ArgumentNullException">Parent products are <see langword="null" />.</exception>
        /// <exception cref="T:System.NotSupportedException">The query collection is read-only.</exception>
        internal static string GetUrl(
            this EntryContentBase entry,
            IRelationRepository relationRepository,
            UrlResolver urlResolver,
            string language)
        {
            ContentReference parentLink = entry.GetParentProducts(relationRepository: relationRepository).FirstOrDefault();

            ContentReference productLink = entry is VariationContent
                                               ? entry.GetParentProducts(relationRepository : relationRepository)
                                           .FirstOrDefault() ?? entry.ContentLink
                                               : entry.ContentLink;

            UrlBuilder urlBuilder = string.IsNullOrEmpty(value: language)
                                        ? new UrlBuilder(urlResolver.GetUrl(contentLink: productLink))
                                        : new UrlBuilder(
                urlResolver.GetUrl(contentLink: productLink, language: language));

            if (parentLink != null && entry.Code != null)
            {
                urlBuilder.QueryCollection.Add("variationCode", value: entry.Code);
            }

            Global.UrlRewriteProvider.ConvertToExternal(url: urlBuilder, null, toEncoding: Encoding.UTF8);

            string externalUrl = HttpContext.Current == null
                                     ? UriSupport.AbsoluteUrlBySettings(urlBuilder.ToString())
                                     : $"{HttpContext.Current.Request.Url.GetLeftPart(part: UriPartial.Authority)}{urlBuilder}";

            return(externalUrl);
        }
Example #2
0
        public virtual ProductTileViewModel GetProductTileViewModel(EntryContentBase entry)
        {
            if (entry == null)
            {
                throw new ArgumentNullException(nameof(entry));
            }

            if (entry is PackageContent)
            {
                return(CreateProductViewModelForEntry((PackageContent)entry));
            }

            if (entry is ProductContent)
            {
                var product = (ProductContent)entry;
                var variant = GetAvailableVariants(product.GetVariants()).FirstOrDefault();

                return(CreateProductViewModelForVariant(product, variant));
            }

            if (entry is VariationContent)
            {
                ProductContent product    = null;
                var            parentLink = entry.GetParentProducts(_relationRepository).SingleOrDefault();
                if (!ContentReference.IsNullOrEmpty(parentLink))
                {
                    product = _contentLoader.Get <ProductContent>(parentLink);
                }

                return(CreateProductViewModelForVariant(product, (VariationContent)entry));
            }

            throw new ArgumentException("BundleContent is not supported", nameof(entry));
        }
        public static ProductTileViewModel GetProductTileViewModel(this EntryContentBase entry, IMarket market, Currency currency)
        {
            var placedPrice = entry.Prices()
                              .Where(id => id.MarketId == market.MarketId)
                              .OrderBy(sort => sort.UnitPrice.Amount)
                              .FirstOrDefault(x => x.UnitPrice.Currency == currency);
            var entryRecommendations = entry as IProductRecommendations;
            var product   = entry;
            var entryUrl  = "";
            var firstCode = placedPrice != null && placedPrice.EntryContent is VariationContent ? (placedPrice.EntryContent as VariationContent).Code : "";
            var type      = typeof(GenericProduct);

            if (entry is GenericProduct)
            {
                entryUrl = UrlResolver.Value.GetUrl(product.ContentLink);
            }

            if (entry is GenericBundle)
            {
                type      = typeof(GenericBundle);
                firstCode = product.Code;
                entryUrl  = UrlResolver.Value.GetUrl(product.ContentLink);
            }

            if (entry is GenericPackage)
            {
                type      = typeof(GenericPackage);
                firstCode = product.Code;
                entryUrl  = UrlResolver.Value.GetUrl(product.ContentLink);
            }

            if (entry is GenericVariant)
            {
                var variantEntry = entry as GenericVariant;
                type     = typeof(GenericVariant);
                product  = ContentLoader.Value.Get <EntryContentBase>(entry.GetParentProducts().FirstOrDefault()) as GenericProduct;
                entryUrl = UrlResolver.Value.GetUrl(product.ContentLink) + "?variationCode=" + variantEntry.Code;
            }

            return(new ProductTileViewModel
            {
                ProductId = product.ContentLink.ID,
                Brand = entry.Property.Keys.Contains("Brand") ? entry.Property["Brand"]?.Value?.ToString() ?? "" : "",
                Code = product.Code,
                DisplayName = entry.DisplayName,
                Description = entry.Property.Keys.Contains("Description") ? entry.Property["Description"]?.Value != null ? ((XhtmlString)entry.Property["Description"].Value).ToHtmlString() : "" : "",
                LongDescription = ShortenLongDescription(entry.Property.Keys.Contains("LongDescription") ? entry.Property["LongDescription"]?.Value != null ? ((XhtmlString)entry.Property["LongDescription"].Value).ToHtmlString() : "" : ""),
                PlacedPrice = placedPrice?.UnitPrice ?? new Money(0, currency),
                DiscountedPrice = placedPrice == null ? new Money(0, currency) : PromotionService.Value.GetDiscountPrice(placedPrice.EntryContent.GetCatalogKey(), market.MarketId, currency).UnitPrice,
                FirstVariationCode = firstCode,
                ImageUrl = AssetUrlResolver.Value.GetAssetUrl <IContentImage>(entry),
                Url = entryUrl,
                IsAvailable = entry.Prices().Where(price => price.MarketId == market.MarketId)
                              .Any(x => x.UnitPrice.Currency == currency),
                OnSale = entry.Property.Keys.Contains("OnSale") && ((bool?)entry.Property["OnSale"]?.Value ?? false),
                NewArrival = entry.Property.Keys.Contains("NewArrival") && ((bool?)entry.Property["NewArrival"]?.Value ?? false),
                ShowRecommendations = entryRecommendations != null ? entryRecommendations.ShowRecommendations : true,
                EntryType = type
            });
        }
Example #4
0
        public virtual ProductTileViewModel GetProductTileViewModel(EntryContentBase entry)
        {
            if (entry is PackageContent)
            {
                return(CreateProductViewModelForEntry((PackageContent)entry));
            }

            if (entry is ProductContent)
            {
                var product = (ProductContent)entry;
                var variant = _contentLoader.GetItems(product.GetVariants(), _preferredCulture).
                              Cast <VariationContent>().FirstOrDefault();

                return(CreateProductViewModelForVariant(product, variant));
            }

            if (entry is VariationContent)
            {
                var parentLink = entry.GetParentProducts(_relationRepository).SingleOrDefault();
                var product    = _contentLoader.Get <ProductContent>(parentLink);

                return(CreateProductViewModelForVariant(product, (VariationContent)entry));
            }

            throw new ArgumentException("BundleContent is not supported", "entry");
        }
Example #5
0
        public virtual CartItemViewModel CreateCartItemViewModel(ICart cart, ILineItem lineItem, EntryContentBase entry)
        {
            var basePrice = lineItem.Properties["BasePrice"] != null?decimal.Parse(lineItem.Properties["BasePrice"].ToString()) : 0;

            var optionPrice = lineItem.Properties["OptionPrice"] != null?decimal.Parse(lineItem.Properties["OptionPrice"].ToString()) : 0;

            var viewModel = new CartItemViewModel
            {
                Code                = lineItem.Code,
                DisplayName         = lineItem.DisplayName,
                ImageUrl            = entry.GetAssets <IContentImage>(_contentLoader, _urlResolver).FirstOrDefault() ?? "",
                DiscountedPrice     = GetDiscountedPrice(cart, lineItem),
                BasePrice           = new Money(basePrice, _currencyService.GetCurrentCurrency()),
                OptionPrice         = new Money(optionPrice, _currencyService.GetCurrentCurrency()),
                PlacedPrice         = new Money(lineItem.PlacedPrice, _currencyService.GetCurrentCurrency()),
                Quantity            = lineItem.Quantity,
                Url                 = entry.GetUrl(_relationRepository, _urlResolver),
                Entry               = entry,
                IsAvailable         = _pricingService.GetCurrentPrice(entry.Code).HasValue,
                DiscountedUnitPrice = GetDiscountedUnitPrice(cart, lineItem),
                IsGift              = lineItem.IsGift,
                Description         = entry["Description"] != null ? entry["Description"].ToString() : "",
                IsDynamicProduct    = lineItem.Properties["VariantOptionCodes"] != null
            };

            var productLink = entry is VariationContent?
                              entry.GetParentProducts(_relationRepository).FirstOrDefault() :
                                  entry.ContentLink;

            if (_contentLoader.TryGet(productLink, out EntryContentBase catalogContent))
            {
                var product = catalogContent as GenericProduct;
                if (product != null)
                {
                    viewModel.Brand = GetBrand(product);
                    var variant = entry as GenericVariant;
                    if (variant != null)
                    {
                        viewModel.AvailableSizes = GetAvailableSizes(product, variant);
                    }
                }
            }

            return(viewModel);
        }
Example #6
0
        public static string GetUrl(this EntryContentBase entry, IRelationRepository relationRepository, UrlResolver urlResolver)
        {
            var productLink = entry is VariationContent?
                              entry.GetParentProducts(relationRepository).FirstOrDefault() :
                                  entry.ContentLink;

            if (productLink == null)
            {
                return(string.Empty);
            }

            var urlBuilder = new UrlBuilder(urlResolver.GetUrl(productLink));

            if (entry.Code != null)
            {
                urlBuilder.QueryCollection.Add("variationCode", entry.Code);
            }

            return(urlBuilder.ToString());
        }
        private void UpdateOrderLines(IList <OrderLine> orderLines, CheckoutConfiguration checkoutConfiguration)
        {
            foreach (var lineItem in orderLines)
            {
                if (lineItem != null && lineItem.Type.Equals("physical"))
                {
                    EntryContentBase entryContent = null;
                    FashionProduct   product      = null;
                    if (!string.IsNullOrEmpty(lineItem.Reference))
                    {
                        var contentLink = _referenceConverter.Service.GetContentLink(lineItem.Reference);
                        if (!ContentReference.IsNullOrEmpty(contentLink))
                        {
                            entryContent = _contentRepository.Service.Get <EntryContentBase>(contentLink);

                            var parentLink =
                                entryContent.GetParentProducts(_relationRepository.Service).SingleOrDefault();
                            product = _contentRepository.Service.Get <FashionProduct>(parentLink);
                        }
                    }

                    var patchedOrderLine = (PatchedOrderLine)lineItem;
                    if (patchedOrderLine.ProductIdentifiers == null)
                    {
                        patchedOrderLine.ProductIdentifiers = new PatchedProductIdentifiers();
                    }


                    patchedOrderLine.ProductIdentifiers.Brand = product?.Brand;
                    patchedOrderLine.ProductIdentifiers.GlobalTradeItemNumber  = "GlobalTradeItemNumber test";
                    patchedOrderLine.ProductIdentifiers.ManuFacturerPartNumber = "ManuFacturerPartNumber test";
                    patchedOrderLine.ProductIdentifiers.CategoryPath           = "test / test";

                    if (checkoutConfiguration.SendProductAndImageUrl && entryContent != null)
                    {
                        ((PatchedOrderLine)lineItem).ProductUrl = SiteUrlHelper.GetAbsoluteUrl()
                                                                  + entryContent.GetUrl(_relationRepository.Service, _urlResolver.Service);
                    }
                }
            }
        }
Example #8
0
        public virtual CartItemViewModel CreateCartItemViewModel(ICart cart, ILineItem lineItem, EntryContentBase entry)
        {
            var viewModel = new CartItemViewModel
            {
                Code                = lineItem.Code,
                DisplayName         = entry.DisplayName,
                ImageUrl            = entry.GetAssets <IContentImage>(_contentLoader, _urlResolver).FirstOrDefault() ?? "",
                DiscountedPrice     = GetDiscountedPrice(cart, lineItem),
                PlacedPrice         = _pricingService.GetMoney(lineItem.PlacedPrice),
                Quantity            = lineItem.Quantity,
                Url                 = entry.GetUrl(_relationRepository, _urlResolver),
                Entry               = entry,
                IsAvailable         = _pricingService.GetPrice(entry.Code) != null,
                DiscountedUnitPrice = GetDiscountedUnitPrice(cart, lineItem),
                IsGift              = lineItem.IsGift
            };

            var productLink = entry is VariationContent?
                              entry.GetParentProducts(_relationRepository).FirstOrDefault() :
                                  entry.ContentLink;

            FashionProduct product;

            if (_contentLoader.TryGet(productLink, out product))
            {
                viewModel.Brand = GetBrand(product);
            }

            var variant = entry as FashionVariant;

            if (variant != null)
            {
                viewModel.AvailableSizes = GetAvailableSizes(product, variant);
            }

            return(viewModel);
        }
Example #9
0
        public virtual CartItemViewModel CreateCartItemViewModel(ICart cart, ILineItem lineItem, EntryContentBase entry)
        {
            var viewModel = new CartItemViewModel
            {
                Code                = lineItem.Code,
                DisplayName         = entry.DisplayName,
                ImageUrl            = entry.GetAssets <IContentImage>(_contentLoader, _urlResolver).FirstOrDefault() ?? "",
                DiscountedPrice     = GetDiscountedPrice(cart, lineItem),
                PlacedPrice         = new Money(lineItem.PlacedPrice, _currencyService.GetCurrentCurrency()),
                Quantity            = lineItem.Quantity,
                Url                 = entry.GetUrl(_relationRepository, _urlResolver),
                Entry               = entry,
                IsAvailable         = _pricingService.GetCurrentPrice(entry.Code).HasValue,
                DiscountedUnitPrice = GetDiscountedUnitPrice(cart, lineItem),
                IsGift              = lineItem.IsGift,
                Description         = entry["Description"] != null ? entry["Description"].ToString() : ""
            };

            var productLink = entry is VariationContent?
                              entry.GetParentProducts(_relationRepository).FirstOrDefault() :
                                  entry.ContentLink;

            if (_contentLoader.TryGet(productLink, out GenericProduct product))
            {
                viewModel.Brand = GetBrand(product);
            }

            var variant = entry as GenericVariant;

            if (variant != null)
            {
                viewModel.AvailableSizes = GetAvailableSizes(product, variant);
            }

            viewModel.Description = string.IsNullOrEmpty(viewModel.Description) ? viewModel.Description : product.Description.ToHtmlString();
            return(viewModel);
        }
Example #10
0
 public virtual T GetParentProduct <T>(EntryContentBase entry) where T : ProductContent
 {
     return(Get <T>(entry.GetParentProducts(_relationRepository).SingleOrDefault()));
 }
Example #11
0
        public Session Build(Session session, ICart cart, PaymentsConfiguration paymentsConfiguration, IDictionary <string, object> dic = null, bool includePersonalInformation = false)
        {
            if (includePersonalInformation && paymentsConfiguration.CustomerPreAssessment)
            {
                session.Customer = new Customer
                {
                    DateOfBirth = "1980-01-01",
                    Gender      = "Male",
                    LastFourSsn = "1234"
                };
            }
            session.MerchantReference2 = "12345";

            if (paymentsConfiguration.UseAttachments)
            {
                var converter = new IsoDateTimeConverter
                {
                    DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'"
                };


                var customerAccountInfos = new List <Dictionary <string, object> >
                {
                    new Dictionary <string, object>
                    {
                        { "unique_account_identifier", "Test Testperson" },
                        { "account_registration_date", DateTime.Now },
                        { "account_last_modified", DateTime.Now }
                    }
                };

                var emd = new Dictionary <string, object>
                {
                    { "customer_account_info", customerAccountInfos }
                };

                session.Attachment = new Attachment
                {
                    ContentType = "application/vnd.klarna.internal.emd-v2+json",
                    Body        = JsonConvert.SerializeObject(emd, converter)
                };
            }

            if (session.OrderLines != null)
            {
                foreach (var lineItem in session.OrderLines)
                {
                    if (lineItem.Type.Equals("physical"))
                    {
                        EntryContentBase entryContent = null;
                        FashionProduct   product      = null;
                        if (!string.IsNullOrEmpty(lineItem.Reference))
                        {
                            var contentLink = _referenceConverter.Service.GetContentLink(lineItem.Reference);
                            if (!ContentReference.IsNullOrEmpty(contentLink))
                            {
                                entryContent = _contentRepository.Service.Get <EntryContentBase>(contentLink);

                                var parentLink =
                                    entryContent.GetParentProducts(_relationRepository.Service).SingleOrDefault();
                                product = _contentRepository.Service.Get <FashionProduct>(parentLink);
                            }
                        }

                        var patchedOrderLine = (PatchedOrderLine)lineItem;
                        if (patchedOrderLine.ProductIdentifiers == null)
                        {
                            patchedOrderLine.ProductIdentifiers = new PatchedProductIdentifiers();
                        }

                        patchedOrderLine.ProductIdentifiers.Brand = product?.Brand;
                        patchedOrderLine.ProductIdentifiers.GlobalTradeItemNumber  = "GlobalTradeItemNumber test";
                        patchedOrderLine.ProductIdentifiers.ManuFacturerPartNumber = "ManuFacturerPartNumber test";
                        patchedOrderLine.ProductIdentifiers.CategoryPath           = "test / test";

                        if (paymentsConfiguration.SendProductAndImageUrlField && entryContent != null)
                        {
                            ((PatchedOrderLine)lineItem).ProductUrl = SiteUrlHelper.GetAbsoluteUrl() + entryContent.GetUrl(_linksRepository.Service,
                                                                                                                           _urlResolver.Service);
                        }
                    }
                }
            }
            return(session);
        }
Example #12
0
        public static ProductTileViewModel GetProductTileViewModel(this EntryContentBase entry, IMarket market, Currency currency, bool isFeaturedProduct = false)
        {
            var entryRecommendations = entry as IProductRecommendations;
            var product   = entry;
            var entryUrl  = "";
            var firstCode = "";
            var type      = typeof(GenericProduct);

            if (entry is GenericProduct)
            {
                var variants = GetProductVariants(entry);
                if (variants != null && variants.Any())
                {
                    firstCode = variants.First().Code;
                }
                entryUrl = UrlResolver.Value.GetUrl(entry.ContentLink);
            }

            if (entry is GenericBundle)
            {
                type      = typeof(GenericBundle);
                firstCode = product.Code;
                entryUrl  = UrlResolver.Value.GetUrl(product.ContentLink);
            }

            if (entry is GenericPackage)
            {
                type      = typeof(GenericPackage);
                firstCode = product.Code;
                entryUrl  = UrlResolver.Value.GetUrl(product.ContentLink);
            }

            if (entry is GenericVariant)
            {
                var variantEntry = entry as GenericVariant;
                type      = typeof(GenericVariant);
                firstCode = entry.Code;
                var parentLink = entry.GetParentProducts().FirstOrDefault();
                if (ContentReference.IsNullOrEmpty(parentLink))
                {
                    product  = ContentLoader.Value.Get <EntryContentBase>(variantEntry.ContentLink);
                    entryUrl = UrlResolver.Value.GetUrl(variantEntry.ContentLink);
                }
                else
                {
                    product  = ContentLoader.Value.Get <EntryContentBase>(parentLink) as GenericProduct;
                    entryUrl = UrlResolver.Value.GetUrl(product.ContentLink) + "?variationCode=" + variantEntry.Code;
                }
            }

            IPriceValue price = PriceCalculationService.GetSalePrice(firstCode, market.MarketId, currency);

            if (price == null)
            {
                price = GetEmptyPrice(entry, market, currency);
            }
            IPriceValue discountPrice = price;

            if (price.UnitPrice.Amount > 0 && !string.IsNullOrEmpty(firstCode))
            {
                discountPrice = PromotionService.Value.GetDiscountPrice(new CatalogKey(firstCode), market.MarketId, currency);
            }

            bool isAvailable = price.UnitPrice.Amount > 0;

            return(new ProductTileViewModel
            {
                ProductId = product.ContentLink.ID,
                Brand = entry.Property.Keys.Contains("Brand") ? entry.Property["Brand"]?.Value?.ToString() ?? "" : "",
                Code = product.Code,
                DisplayName = entry.DisplayName,
                Description = entry.Property.Keys.Contains("Description") ? entry.Property["Description"]?.Value != null ? ((XhtmlString)entry.Property["Description"].Value).ToHtmlString() : "" : "",
                LongDescription = ShortenLongDescription(entry.Property.Keys.Contains("LongDescription") ? entry.Property["LongDescription"]?.Value != null ? ((XhtmlString)entry.Property["LongDescription"].Value).ToHtmlString() : "" : ""),
                PlacedPrice = price.UnitPrice,
                DiscountedPrice = discountPrice.UnitPrice,
                FirstVariationCode = firstCode,
                ImageUrl = AssetUrlResolver.Value.GetAssetUrl <IContentImage>(entry),
                VideoAssetUrl = AssetUrlResolver.Value.GetAssetUrl <IContentVideo>(entry),
                Url = entryUrl,
                IsAvailable = isAvailable,
                OnSale = entry.Property.Keys.Contains("OnSale") && ((bool?)entry.Property["OnSale"]?.Value ?? false),
                NewArrival = entry.Property.Keys.Contains("NewArrival") && ((bool?)entry.Property["NewArrival"]?.Value ?? false),
                ShowRecommendations = entryRecommendations != null ? entryRecommendations.ShowRecommendations : true,
                EntryType = type,
                ProductStatus = entry.Property.Keys.Contains("ProductStatus") ? entry.Property["ProductStatus"]?.Value?.ToString() ?? "Active" : "Active",
                Created = entry.Created,
                IsFeaturedProduct = isFeaturedProduct
            });
        }
Example #13
0
        public static ProductTileViewModel GetProductTileViewModel(this EntryContentBase entry, IMarket market, Currency currency, bool isFeaturedProduct = false)
        {
            var prices            = entry.Prices();
            var minPrice          = prices.OrderBy(x => x.UnitPrice).ThenBy(x => x.MinQuantity).FirstOrDefault();
            var discountPriceList = GetDiscountPriceCollection(entry, market, currency);
            var minDiscountPrice  = GetMinDiscountPrice(discountPriceList);

            // if discount price is selected
            var isDiscounted = minDiscountPrice.Value != null
                ? (minDiscountPrice.Value.Price < minPrice.UnitPrice ? true : false)
                : false;

            var entryRecommendations = entry as IProductRecommendations;
            var product   = entry;
            var entryUrl  = "";
            var firstCode = "";
            var type      = typeof(GenericProduct);

            if (entry is GenericProduct)
            {
                entryUrl  = UrlResolver.Value.GetUrl(product.ContentLink);
                firstCode = isDiscounted ? ContentLoader.Value.Get <EntryContentBase>(minDiscountPrice.Key).Code : minPrice.EntryContent.Code;
            }

            if (entry is GenericBundle)
            {
                type      = typeof(GenericBundle);
                firstCode = product.Code;
                entryUrl  = UrlResolver.Value.GetUrl(product.ContentLink);
            }

            if (entry is GenericPackage)
            {
                type      = typeof(GenericPackage);
                firstCode = product.Code;
                entryUrl  = UrlResolver.Value.GetUrl(product.ContentLink);
            }

            if (entry is GenericVariant)
            {
                var variantEntry = entry as GenericVariant;
                type      = typeof(GenericVariant);
                firstCode = entry.Code;
                var parentLink = entry.GetParentProducts().FirstOrDefault();
                if (ContentReference.IsNullOrEmpty(parentLink))
                {
                    product  = ContentLoader.Value.Get <EntryContentBase>(variantEntry.ContentLink);
                    entryUrl = UrlResolver.Value.GetUrl(variantEntry.ContentLink);
                }
                else
                {
                    product  = ContentLoader.Value.Get <EntryContentBase>(parentLink) as GenericProduct;
                    entryUrl = UrlResolver.Value.GetUrl(product.ContentLink) + "?variationCode=" + variantEntry.Code;
                }
            }

            return(new ProductTileViewModel
            {
                ProductId = product.ContentLink.ID,
                Brand = entry.Property.Keys.Contains("Brand") ? entry.Property["Brand"]?.Value?.ToString() ?? "" : "",
                Code = product.Code,
                DisplayName = entry.DisplayName,
                Description = entry.Property.Keys.Contains("Description") ? entry.Property["Description"]?.Value != null ? ((XhtmlString)entry.Property["Description"].Value).ToHtmlString() : "" : "",
                LongDescription = ShortenLongDescription(entry.Property.Keys.Contains("LongDescription") ? entry.Property["LongDescription"]?.Value != null ? ((XhtmlString)entry.Property["LongDescription"].Value).ToHtmlString() : "" : ""),
                PlacedPrice = isDiscounted ? minDiscountPrice.Value.DefaultPrice : (minPrice != null ? minPrice.UnitPrice : new Money(0, currency)),
                DiscountedPrice = isDiscounted ? minDiscountPrice.Value.Price : (minPrice != null ? minPrice.UnitPrice : new Money(0, currency)),
                FirstVariationCode = firstCode,
                ImageUrl = AssetUrlResolver.Value.GetAssetUrl <IContentImage>(entry),
                VideoAssetUrl = AssetUrlResolver.Value.GetAssetUrl <IContentVideo>(entry),
                Url = entryUrl,
                IsAvailable = entry.Prices().Where(price => price.MarketId == market.MarketId)
                              .Any(x => x.UnitPrice.Currency == currency),
                OnSale = entry.Property.Keys.Contains("OnSale") && ((bool?)entry.Property["OnSale"]?.Value ?? false),
                NewArrival = entry.Property.Keys.Contains("NewArrival") && ((bool?)entry.Property["NewArrival"]?.Value ?? false),
                ShowRecommendations = entryRecommendations != null ? entryRecommendations.ShowRecommendations : true,
                EntryType = type,
                ProductStatus = entry.Property.Keys.Contains("ProductStatus") ? entry.Property["ProductStatus"]?.Value?.ToString() ?? "Active" : "Active",
                Created = entry.Created,
                IsFeaturedProduct = isFeaturedProduct
            });
        }