Example #1
0
        private IEntity GetEntity(CatalogEntryDto.CatalogEntryRow entry, ESalesVariantHelper variantHelper, string language,
                                  IEnumerable <Attribute> attributes)
        {
            var keyValue = _keyLookup.Value(entry, language);

            if (variantHelper.IsVariant(entry.CatalogEntryId))
            {
                var productKey = _keyLookup.Value(_catalogSystem.GetCatalogEntry(variantHelper.GetParentProduct(entry.CatalogEntryId)), language);
                return(new Variant(keyValue, productKey, attributes));
            }
            return(new Product(keyValue, attributes));
        }
        public IEnumerable <string> Included(Promotion promotion)
        {
            var settings =
                (Apps_Marketing_Promotions_BuySKUFromCategoryXGetDiscountedShipping.Settings)
                new XmlSerializer(typeof(Apps_Marketing_Promotions_BuySKUFromCategoryXGetDiscountedShipping.Settings)).Deserialize(new MemoryStream(promotion.PromotionRow.Params));

            if (settings == null)
            {
                return(Enumerable.Empty <string>());
            }
            var nodeId   = _catalogSystemMapper.GetCatalogNode(settings.CategoryCode).CatalogNodeId;
            var entryIds = _catalogSystemMapper.GetCatalogRelations(0, nodeId).Select(r => r.CatalogEntryId);

            return(entryIds.Select(ei => _catalogSystemMapper.GetCatalogEntry(ei)).Where(e => e != null).Select(e => e.Code));
        }
Example #3
0
        private IEnumerable <CatalogEntryDto.CatalogEntryRow> AppendMissingVariants(Dictionary <int, CatalogEntryDto.CatalogEntryRow> originalEntries)
        {
            foreach (var entry in originalEntries.Values)
            {
                yield return(entry);

                if (entry.IsActive)
                {
                    foreach (var variant in
                             _eSalesVariantHelper.GetVariants(entry.CatalogEntryId)
                             .Where(variantId => !originalEntries.ContainsKey(variantId))
                             .Select(variantId => _catalogSystemMapper.GetCatalogEntry(variantId))
                             .Where(variant => variant.IsActive))
                    {
                        yield return(variant);
                    }
                }
            }
        }