Exemplo n.º 1
0
        private IEnumerable <IEntity> GetEntities(CatalogEntryDto.CatalogEntryRow entry, IEnumerable <string> languages, string catalogName,
                                                  ESalesVariantHelper variantHelper)
        {
            foreach (var language in languages)
            {
                var locale     = language.ToESalesLocale();
                var attributes = new List <Attribute>
                {
                    NewAttribute("id", entry.CatalogEntryId + "_" + language),
                    NewAttribute("_id", entry.CatalogEntryId),
                    NewAttribute("code", entry.Code),
                    NewAttribute("name", entry.Name),
                    NewAttribute("_lang", language),
                    NewAttribute("locale", locale),
                    NewAttribute("locale_filter", locale),
                    NewAttribute("startdate", entry.StartDate),
                    NewAttribute("enddate", entry.EndDate),
                    NewAttribute("_classtype", entry.ClassTypeId.ToLowerInvariant()),
                    NewAttribute("_catalog", catalogName),
                    NewAttribute("product_url", _urlResolver.GetEntryUrl(entry, language))
                };
                attributes.AddRange(GetPrices(entry));
                attributes.AddRange(GetNodeEntryRelations(catalogName, new CatalogEntryRowMapper(entry)));
                attributes.AddRange(GetMetaData(entry, language));
                AddAds(entry, attributes);
                AddFacets(attributes);

                var filteredAttributes = FilterConfiguredAttributes(attributes);

                yield return(GetEntity(entry, variantHelper, language, filteredAttributes));
            }
        }