Пример #1
0
        public static IList <ExcelProductUKViewModel> GenerateToExcelUK(IUnitOfWork db,
                                                                        IBarcodeService barcodeService,
                                                                        IMarketCategoryService categoryService,
                                                                        StyleViewModel model,
                                                                        DateTime when,
                                                                        out string filename)
        {
            var gbpExchangeRate = PriceHelper.GBPtoUSD;

            var models = new List <ExcelProductUKViewModel>();

            var parent = new ExcelProductUKViewModel();
            var childs = new List <ExcelProductUKViewModel>();

            var sizes = model.StyleItems.Items;

            //Size Group, Size Range
            var             hasKids2      = sizes.Any(s => ItemExportHelper.GetSizeGroupByName(s.SizeGroupName, true) == ExportSizeGroup.Kids2);
            ExportSizeGroup?sizeGroup     = sizes.Any() ? (ExportSizeGroup?)ItemExportHelper.GetSizeGroupByName(sizes.Last().SizeGroupName, false) : null;
            var             sizeGroupName = ItemExportHelper.GetSizeGroupName(sizeGroup);

            var sizeRange = ItemExportHelper.GetSizeRangeName(sizes.Select(s => s.Size).ToList(), hasKids2);

            var firstSize = sizes.Any() ? sizes[0].Size : String.Empty;


            //Features Values
            var features = model.Features.Select(f => new FeatureValueDTO()
            {
                FeatureId = f.FeatureId,
                Value     = f.Value,
            }).ToList();
            var allFeatureValues = db.FeatureValues.GetAllFeatureValueByItemType(1);

            var gender    = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.GENDER);
            var itemStyle = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.ITEMSTYLE);
            var sleeve    = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.SLEEVE);
            var material  = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.MATERIAL);

            var color1      = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.COLOR1);
            var mainLicense = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.MAIN_LICENSE);
            var subLicense  = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.SUB_LICENSE1);
            //var shippingSize = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.SHIPPING_SIZE);

            var materialComposition = ItemExportHelper.GetFeatureTextValue(features, StyleFeatureHelper.MATERIAL_COMPOSITION);

            var sizeType     = ItemExportHelper.GetSizeType(firstSize);
            var categoryInfo = categoryService.GetCategory(MarketType.AmazonEU, MarketplaceKeeper.AmazonUkMarketplaceId, itemStyle, gender, sizeType);
            //var itemType = ItemExportHelper.GetItemType(itemStyle);

            var brandName = ItemExportHelper.GetBrandName(mainLicense, subLicense);

            var newItemType   = categoryInfo.Key1;// ItemExportHelper.ItemTypeConverter(firstSize ?? "", itemType, itemStyle, gender);
            var newDepartment = StringHelper.GetFirstNotEmpty(categoryInfo.Key2, ItemExportHelper.DepartmentConverter(gender, newItemType, sizeType));


            var searchTerms = model.SearchTerms;       // ItemExportHelper.BuildSearchTerms(itemStyle, material, sleeve);
            var keyFeatures = model.GetBulletPoints(); // ItemExportHelper.BuildKeyFeatures(mainLicense, subLicense, material);


            var hasCotton = StringHelper.GetInOneOfStrings("Cotton", new List <string>()
            {
                searchTerms,
                model.Name,
                model.Description,
                material
            });

            if (String.IsNullOrEmpty(materialComposition))
            {
                if (hasCotton)
                {
                    materialComposition = "Cotton";
                }
                else
                {
                    materialComposition = "Polyester";
                }
            }


            //--------------------------
            //Parent item
            //--------------------------
            parent.SKU  = model.StyleId;
            parent.ASIN = "";

            parent.Title = model.Name + "," + (!String.IsNullOrEmpty(sizeGroupName) ? " " + ItemExportHelper.FormatSizeGroupName(sizeGroupName) : String.Empty) + " " + sizeRange;
            //If it causes name length to exceed maximum allowed, please drop words “Kids” or Toddler”
            var inlcudeSizeGroup = true;

            if (parent.Title.Length > ItemExportHelper.MaxItemNameLength)
            {
                parent.Title     = model.Name + ", " + sizeRange;
                inlcudeSizeGroup = false;
            }

            parent.ProductId = "";
            parent.BrandName = brandName;

            parent.ClothingType = "sleepwear"; // = newItemType;

            var images      = new List <string>();
            var swatchImage = "";

            if (model.ImageSet != null)
            {
                images = model.ImageSet.Images
                         .Where(im => im.Category != (int)StyleImageCategories.Swatch)
                         .OrderByDescending(im => ImageHelper.GetSortIndex(im.Category))
                         .ThenByDescending(im => im.IsDefault)
                         .ThenBy(im => im.Id)
                         .Select(im => im.ImageUrl)
                         .ToList();
                swatchImage = model.ImageSet.Images
                              .FirstOrDefault(im => im.Category == (int)StyleImageCategories.Swatch)?.ImageUrl;

                parent.MainImageURL   = images.Count > 0 ? images[0] : "";
                parent.OtherImageUrl1 = images.Count > 1 ? images[1] : "";
                parent.OtherImageUrl2 = images.Count > 2 ? images[2] : "";
                parent.OtherImageUrl3 = images.Count > 3 ? images[3] : "";
                //parent.SwatchImageUrl = swatchImage;
            }

            parent.Color      = "";
            parent.Department = newDepartment;

            parent.Size = "";
            parent.MaterialComposition = materialComposition;
            parent.Description         = model.Description;
            parent.Update        = "Update";
            parent.StandardPrice = "";
            //parent.SuggestedPrice = model.MSRP.ToString("G");
            parent.Currency = "GBP";

            parent.Quantity = "";

            parent.RecommendedBrowseNodes1 = ExcelProductUKViewModel.GetRecommendedBrowseNodes1(newDepartment, firstSize, newItemType);

            parent.SearchTerms1 = searchTerms;

            parent.KeyProductFeatures1 = keyFeatures.Count > 0 ? keyFeatures[0] : "";
            parent.KeyProductFeatures2 = keyFeatures.Count > 1 ? keyFeatures[1] : "";
            parent.KeyProductFeatures3 = keyFeatures.Count > 2 ? keyFeatures[2] : "";
            parent.KeyProductFeatures4 = keyFeatures.Count > 3 ? keyFeatures[3] : "";
            parent.KeyProductFeatures5 = keyFeatures.Count > 4 ? keyFeatures[4] : "";


            parent.Parentage        = "Parent";
            parent.ParentSKU        = "";
            parent.RelationshipType = "";
            parent.VariationTheme   = "Size";

            //--------------------------
            //Child items
            //--------------------------
            foreach (var size in sizes)
            {
                var child = new ExcelProductUKViewModel();
                child.SKU = model.StyleId + "-" + ItemExportHelper.ConvertSizeForStyleId(size.Size, hasKids2);
                if (size.AutoGeneratedBarcode)
                {
                    var newBarcode = BarcodeHelper.GenerateBarcode(barcodeService, child.SKU, when);
                    if (!String.IsNullOrEmpty(newBarcode))
                    {
                        if (size.Barcodes == null)
                        {
                            size.Barcodes = new List <BarcodeDTO>();
                        }
                        size.Barcodes.Insert(0, new BarcodeDTO()
                        {
                            Barcode = newBarcode
                        });
                    }
                }

                child.UPC = (size.Barcodes != null && size.Barcodes.Any()) ? size.Barcodes.FirstOrDefault().Barcode : String.Empty;

                child.Title = model.Name + "," + (inlcudeSizeGroup ? " " + ItemExportHelper.FormatSizeGroupName(size.SizeGroupName) : "") + " Size " + ItemExportHelper.ConvertSizeForItemName(size.Size, hasKids2);

                child.ProductId = "UPC";
                child.BrandName = brandName;

                child.ClothingType = "sleepwear";// newItemType;

                child.MainImageURL   = images.Count > 0 ? images[0] : "";
                child.OtherImageUrl1 = images.Count > 1 ? images[1] : "";
                child.OtherImageUrl2 = images.Count > 2 ? images[2] : "";
                child.OtherImageUrl3 = images.Count > 3 ? images[3] : "";
                //child.SwatchImageUrl = swatchImage;

                child.Color      = ItemExportHelper.PrepareColor(String.IsNullOrEmpty(size.Color) ? color1 : size.Color);
                child.Department = newDepartment;

                child.Size = ExcelProductUKViewModel.SizeConverter(size.Size, material);
                child.MaterialComposition = materialComposition;
                child.Description         = model.Description;
                child.Update        = "Update";
                child.StandardPrice = PriceHelper.Convert(model.Price, gbpExchangeRate, true).ToString("G");
                //child.SuggestedPrice = model.MSRP.ToString("G");
                child.Currency = "GBP";

                child.Quantity = size.Quantity.ToString();

                child.RecommendedBrowseNodes1 = ExcelProductUKViewModel.GetRecommendedBrowseNodes1(newDepartment, child.Size, newItemType);

                child.KeyProductFeatures1 = parent.KeyProductFeatures1;
                child.KeyProductFeatures2 = parent.KeyProductFeatures2;
                child.KeyProductFeatures3 = parent.KeyProductFeatures3;
                child.KeyProductFeatures4 = parent.KeyProductFeatures4;
                child.KeyProductFeatures5 = parent.KeyProductFeatures5;

                child.SearchTerms1 = parent.SearchTerms1;
                //child.SearchTerms2 = parent.SearchTerms2;
                //child.SearchTerms3 = parent.SearchTerms3;
                //child.SearchTerms4 = parent.SearchTerms4;
                //child.SearchTerms5 = parent.SearchTerms5;

                child.Parentage        = "Child";
                child.ParentSKU        = parent.SKU;
                child.RelationshipType = "Variation";
                child.VariationTheme   = "Size";

                childs.Add(child);
            }


            models.Add(parent);
            models.AddRange(childs);

            filename = model.StyleId + "_" + subLicense;
            filename = filename.Replace(" ", "") + "_UK.xls";
            return(models); //ExcelHelper.ExportIntoFile(HttpContext.Current.Server.MapPath(UKTemplatePath), models);
        }
        public static IList <ExcelWFSProductUSViewModel> GenerateToExcelUS(IUnitOfWork db,
                                                                           IBarcodeService barcodeService,
                                                                           IMarketCategoryService categoryService,
                                                                           StyleViewModel model,
                                                                           DateTime when,
                                                                           out string filename)
        {
            /*
             *  1.	Item_sku:
             *      a.	First row = Style
             *      b.	Other rows – Style-%size%, i.e. K123123-2T, K123123-3T..
             *  2.	Item name:
             *      a.	First Raw - %Name% + “,”+%Size Group% (Infant, Toddler, Kids)+”Sizes”+%Size_Range%” (example: Planes Boys 'Turn Up the Heat' Coat Style Pajama Set, Toddler Sizes 2T-4T)
             *      b.	Other rows: %Name% + “,”+%Size Group% (Infant, Toddler, Kids)+%Size% (i.e. Planes Boys 'Turn Up the Heat' Coat Style Pajama Set, Toddler Size 2T)
             *  3.	external_product_id – barcode (empty for first raw)
             *  4.	external_product_id_type – harcoded “UPC” (empty for first raw)
             *  16.	brand_name - Main License
             *  17.	item_type – use same logic as you use when you generate xls from ASIN
             *  18.	main_image_url – upload image to server, and insert public URL to this image here
             *  19.	Color - %Color%
             *  20.	Department_name - use same logic as you use when you generate xls from ASIN
             *  21.	Size - %size%
             *  22.	update_delete – “Update”
             *  23.	standard_price - %price%
             *  24.	list_price -- %MSRP%
             *  25.	currency – “USD”
             *  26.	quantity – “%Quantity%
             *  27.	bullet_point1 – “Authentic ”+ %Main License% +” product with reliable quality and durability
             *  28.	bullet_point2 – “Featuring “+%sublicense%
             *  29.	bullet_point3 – if(Material  != Cotton) “Flame resistant” else “100% Cotton”
             *  30.	bullet_point4 – “Machine Wash, Easy Care”
             *  31.	generic_keywords1 = if(Item style = pajama) “ sleepwear, pj, jummie, new, %sleeve%”
             *      if(nightgown) “night, gown, night-gown, sleepwear, pj, jummie, new, %sleeve%, dress up”
             *  32.	“Gift, present, 2015, cozy ” If(Material =fleece) “Fleece, microfleece, warm, winter spring”
             *  33.	parent_child, parent_sku, relationship_type, variation_theme – same logic as you use when you generate xls from ASIN
             *  34.	if More then one picture provided insert their URL into other_image_url1, other_image_url2, other_image_url3
             */

            var models = new List <ExcelWFSProductUSViewModel>();

            var parent = new ExcelWFSProductUSViewModel();
            var childs = new List <ExcelWFSProductUSViewModel>();

            var sizes = model.StyleItems.Items;

            //Size Group, Size Range
            var             hasKids2      = sizes.Any(s => ItemExportHelper.GetSizeGroupByName(s.SizeGroupName, true) == ExportSizeGroup.Kids2);
            ExportSizeGroup?sizeGroup     = sizes.Any() ? (ExportSizeGroup?)ItemExportHelper.GetSizeGroupByName(sizes.Last().SizeGroupName, false) : null;
            var             sizeGroupName = ItemExportHelper.GetSizeGroupName(sizeGroup);
            var             sizeRange     = ItemExportHelper.GetSizeRangeName(sizes.Select(s => s.Size).ToList(), hasKids2);
            var             firstSize     = sizes.Any() ? sizes[0].Size : String.Empty;

            //Features Values
            var features = model.Features.Select(f => new FeatureValueDTO()
            {
                FeatureId = f.FeatureId,
                Value     = f.Value,
            }).ToList();
            var allFeatureValues = db.FeatureValues.GetAllFeatureValueByItemType(1);

            var gender      = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.GENDER);
            var itemStyle   = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.ITEMSTYLE);
            var sleeve      = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.SLEEVE);
            var material    = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.MATERIAL);
            var color1      = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.COLOR1);
            var mainLicense = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.MAIN_LICENSE);
            var subLicense  = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.SUB_LICENSE1);
            //var shippingSize = ItemExportHelper.GetFeatureValue(features, allFeatureValues, Feature.SHIPPING_SIZE);

            //var itemType = ItemExportHelper.GetItemType(itemStyle);
            var sizeType     = ItemExportHelper.GetSizeType(firstSize);
            var categoryInfo = categoryService.GetCategory(MarketType.Amazon, MarketplaceKeeper.AmazonComMarketplaceId, itemStyle, gender, sizeType);

            var brandName = ItemExportHelper.GetBrandName(mainLicense, subLicense);

            var    newItemType   = categoryInfo.Key1;// ItemExportHelper.ItemTypeConverter(firstSize ?? "", itemType, itemStyle, gender);
            var    newDepartment = StringHelper.GetFirstNotEmpty(categoryInfo.Key2, ItemExportHelper.DepartmentConverter(gender, newItemType, sizeType));
            string clothingType  = categoryInfo.Key3;

            var searchTerms = model.SearchTerms;       // ItemExportHelper.BuildSearchTerms(itemStyle, material, sleeve);
            var keyFeatures = model.GetBulletPoints(); // ItemExportHelper.BuildKeyFeatures(mainLicense, subLicense, material);


            //--------------------------
            //Parent item
            //--------------------------
            parent.SKU  = model.StyleId;
            parent.ASIN = "";

            parent.Title = model.Name + "," + (!String.IsNullOrEmpty(sizeGroupName) ? " " + ItemExportHelper.FormatSizeGroupName(sizeGroupName) : String.Empty) + " " + sizeRange;
            //If it causes name length to exceed maximum allowed, please drop words “Kids” or Toddler”
            var inlcudeSizeGroup = true;

            if (parent.Title.Length > ItemExportHelper.MaxItemNameLength)
            {
                parent.Title     = model.Name + ", " + sizeRange;
                inlcudeSizeGroup = false;
            }


            parent.ProductId = "";
            parent.BrandName = brandName;

            parent.Type = newItemType;


            var images      = new List <string>();
            var swatchImage = "";

            if (model.ImageSet != null)
            {
                images = model.ImageSet.Images
                         .Where(im => im.Category != (int)StyleImageCategories.Swatch)
                         .OrderByDescending(im => ImageHelper.GetSortIndex(im.Category))
                         .ThenByDescending(im => im.IsDefault)
                         .ThenBy(im => im.Id)
                         .Select(im => im.ImageUrl)
                         .ToList();
                swatchImage = model.ImageSet.Images
                              .FirstOrDefault(im => im.Category == (int)StyleImageCategories.Swatch)?.ImageUrl;

                parent.MainImageURL   = images.Count > 0 ? images[0] : "";
                parent.OtherImageUrl1 = images.Count > 1 ? images[1] : "";
                parent.OtherImageUrl2 = images.Count > 2 ? images[2] : "";
                parent.OtherImageUrl3 = images.Count > 3 ? images[3] : "";
                parent.SwatchImageUrl = swatchImage;
            }

            parent.Color      = "";// color1;
            parent.Department = newDepartment;

            parent.Size           = "";
            parent.Description    = model.Description;
            parent.Update         = "Update";
            parent.StandardPrice  = "";
            parent.SuggestedPrice = Math.Round(model.MSRP).ToString("G");
            parent.Currency       = "USD";

            parent.Quantity = "";

            parent.KeyProductFeatures1 = keyFeatures.Count > 0 ? keyFeatures[0] : "";
            parent.KeyProductFeatures2 = keyFeatures.Count > 1 ? keyFeatures[1] : "";
            parent.KeyProductFeatures3 = keyFeatures.Count > 2 ? keyFeatures[2] : "";
            parent.KeyProductFeatures4 = keyFeatures.Count > 3 ? keyFeatures[3] : "";
            parent.KeyProductFeatures5 = keyFeatures.Count > 4 ? keyFeatures[4] : "";

            parent.SearchTerms1 = searchTerms;
            //parent.SearchTerms3 = "";
            //parent.SearchTerms4 = "";
            //parent.SearchTerms5 = "";

            parent.Parentage        = "Parent";
            parent.ParentSKU        = "";
            parent.RelationshipType = "";
            parent.VariationTheme   = "Size";
            parent.FeedProductType  = clothingType;

            //--------------------------
            //Child items
            //--------------------------
            foreach (var size in sizes)
            {
                var child = new ExcelWFSProductUSViewModel();
                child.SKU = model.StyleId + "-" + ItemExportHelper.ConvertSizeForStyleId(size.Size, hasKids2);

                child.StyleItemId = size.Id;
                child.StyleId     = model.Id;

                if (size.AutoGeneratedBarcode)
                {
                    var newBarcode = BarcodeHelper.GenerateBarcode(barcodeService, child.SKU, when);
                    if (!String.IsNullOrEmpty(newBarcode))
                    {
                        if (size.Barcodes == null)
                        {
                            size.Barcodes = new List <BarcodeDTO>();
                        }
                        size.Barcodes.Insert(0, new BarcodeDTO()
                        {
                            Barcode = newBarcode
                        });
                    }
                }

                child.ASIN = (size.Barcodes != null && size.Barcodes.Any()) ? size.Barcodes.FirstOrDefault().Barcode : String.Empty;

                child.Title = model.Name + "," + (inlcudeSizeGroup ? " " + ItemExportHelper.FormatSizeGroupName(size.SizeGroupName) : "") + " Size " + ItemExportHelper.ConvertSizeForItemName(size.Size, hasKids2);

                child.ProductId = "UPC";
                child.BrandName = brandName;

                child.Type = newItemType;

                child.MainImageURL   = images.Count > 0 ? images[0] : "";
                child.OtherImageUrl1 = images.Count > 1 ? images[1] : "";
                child.OtherImageUrl2 = images.Count > 2 ? images[2] : "";
                child.OtherImageUrl3 = images.Count > 3 ? images[3] : "";
                child.SwatchImageUrl = swatchImage;

                child.Color      = ItemExportHelper.PrepareColor(String.IsNullOrEmpty(size.Color) ? color1 : size.Color);
                child.Department = newDepartment;

                child.Size           = size.Size;
                child.Description    = model.Description;
                child.Update         = "Update";
                child.StandardPrice  = model.Price.ToString("G");
                child.SuggestedPrice = Math.Round(model.MSRP).ToString("G");
                child.Currency       = "USD";

                child.Quantity = size.Quantity.ToString();

                child.KeyProductFeatures1 = parent.KeyProductFeatures1;
                child.KeyProductFeatures2 = parent.KeyProductFeatures2;
                child.KeyProductFeatures3 = parent.KeyProductFeatures3;
                child.KeyProductFeatures4 = parent.KeyProductFeatures4;
                child.KeyProductFeatures5 = parent.KeyProductFeatures5;

                child.SearchTerms1 = parent.SearchTerms1;
                //child.SearchTerms1 = parent.SearchTerms1;
                //child.SearchTerms2 = parent.SearchTerms2;
                //child.SearchTerms3 = parent.SearchTerms3;
                //child.SearchTerms4 = parent.SearchTerms4;
                //child.SearchTerms5 = parent.SearchTerms5;

                child.Parentage        = "Child";
                child.ParentSKU        = parent.SKU;
                child.RelationshipType = "Variation";
                child.VariationTheme   = "Size";

                child.FeedProductType = clothingType;

                childs.Add(child);
            }

            models.Add(parent);
            models.AddRange(childs);

            filename = model.StyleId + "_" + subLicense;
            filename = filename.Replace(" ", "") + "_US.xls";


            return(models);
        }
        public static IList <ExcelProductWalmartViewModel> GenerateToExcelWalmart(IUnitOfWork db,
                                                                                  IBarcodeService barcodeService,
                                                                                  StyleViewModel model,
                                                                                  DateTime when,
                                                                                  out string filename)
        {
            var models = new List <ExcelProductWalmartViewModel>();

            var childs = new List <ExcelProductWalmartViewModel>();

            var sizes = model.StyleItems.Items;

            //Size Group, Size Range
            var             hasKids2      = sizes.Any(s => ItemExportHelper.GetSizeGroupByName(s.SizeGroupName, true) == ExportSizeGroup.Kids2);
            ExportSizeGroup?sizeGroup     = sizes.Any() ? (ExportSizeGroup?)ItemExportHelper.GetSizeGroupByName(sizes.Last().SizeGroupName, false) : null;
            var             sizeGroupName = ItemExportHelper.GetSizeGroupName(sizeGroup);
            var             sizeRange     = ItemExportHelper.GetSizeRangeName(sizes.Select(s => s.Size).ToList(), hasKids2);
            var             firstSize     = sizes.Any() ? sizes[0].Size : String.Empty;

            //Features Values
            var features = model.Features.Select(f => new FeatureValueDTO()
            {
                FeatureId = f.FeatureId,
                Value     = f.Value,
            }).ToList();
            var allFeatureValues = db.FeatureValues.GetAllFeatureValueByItemType(1);

            var gender      = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.GENDER);
            var itemStyle   = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.ITEMSTYLE);
            var sleeve      = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.SLEEVE);
            var material    = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.MATERIAL);
            var color1      = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.COLOR1);
            var mainLicense = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.MAIN_LICENSE);
            var subLicense  = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.SUB_LICENSE1);
            //var shippingSize = ItemExportHelper.GetFeatureValue(features, allFeatureValues, Feature.SHIPPING_SIZE);

            //var itemType = ItemExportHelper.GetItemType(itemStyle);

            var brandName = ItemExportHelper.GetBrandName(mainLicense, subLicense);

            //var newItemType = ItemExportHelper.ItemTypeConverter(firstSize ?? "", itemType, itemStyle, gender);
            //var newDepartment = ItemExportHelper.DepartmentConverter(newItemType, gender, firstSize);


            var searchTerms = model.SearchTerms;       // ItemExportHelper.BuildSearchTerms(itemStyle, material, sleeve);
            var keyFeatures = model.GetBulletPoints(); // ItemExportHelper.BuildKeyFeatures(mainLicense, subLicense, material);


            ////--------------------------
            ////Parent item
            ////--------------------------
            //parent.SKU = model.StyleId;
            //parent.ASIN = "";
            //parent.Title = model.Name
            //               + (!String.IsNullOrEmpty(sizeGroupName) ? ", " + ItemExportHelper.FormatSizeGroupName(sizeGroupName) : String.Empty)
            //               + " " + sizeRange;

            //parent.ProductId = "";
            //parent.BrandName = brandName;

            //parent.Type = newItemType;

            //if (model.ImageSet != null)
            //{
            //    parent.MainImageURL = model.ImageSet.Image1Url;
            //    parent.OtherImageUrl1 = model.ImageSet.Image2Url;
            //    parent.OtherImageUrl2 = model.ImageSet.Image3Url;
            //    parent.OtherImageUrl3 = model.ImageSet.Image4Url;
            //}

            //parent.Color = "";// color1;
            //parent.Department = newDepartment;

            //parent.Size = "";
            //parent.Description = model.Description;
            //parent.Update = "Update";
            //parent.StandardPrice = "";
            //parent.SuggestedPrice = model.MSRP.ToString("G");
            //parent.Currency = "USD";

            //parent.Quantity = "";

            //parent.KeyProductFeatures1 = keyFeatures.Count > 0 ? keyFeatures[0] : "";
            //parent.KeyProductFeatures2 = keyFeatures.Count > 1 ? keyFeatures[1] : "";
            //parent.KeyProductFeatures3 = keyFeatures.Count > 2 ? keyFeatures[2] : "";
            //parent.KeyProductFeatures4 = keyFeatures.Count > 3 ? keyFeatures[3] : "";
            //parent.KeyProductFeatures5 = keyFeatures.Count > 4 ? keyFeatures[4] : "";

            //parent.SearchTerms1 = searchTerms;
            ////parent.SearchTerms3 = "";
            ////parent.SearchTerms4 = "";
            ////parent.SearchTerms5 = "";

            //parent.Parentage = "Parent";
            //parent.ParentSKU = "";
            //parent.RelationshipType = "";
            //parent.VariationTheme = "Size";

            //--------------------------
            //Child items
            //--------------------------
            foreach (var size in sizes)
            {
                var child = new ExcelProductWalmartViewModel();
                child.SKU = model.StyleId + "-" + ItemExportHelper.ConvertSizeForStyleId(size.Size, hasKids2);

                if (size.AutoGeneratedBarcode)
                {
                    var newBarcode = BarcodeHelper.GenerateBarcode(barcodeService, child.SKU, when);
                    if (!String.IsNullOrEmpty(newBarcode))
                    {
                        if (size.Barcodes == null)
                        {
                            size.Barcodes = new List <BarcodeDTO>();
                        }
                        size.Barcodes.Insert(0, new BarcodeDTO()
                        {
                            Barcode = newBarcode
                        });
                    }
                }

                child.ProductIdType    = "UPC";
                child.ProductId        = (size.Barcodes != null && size.Barcodes.Any()) ? size.Barcodes.FirstOrDefault().Barcode : String.Empty;
                child.Title            = model.Name + ", " + ItemExportHelper.FormatSizeGroupName(size.SizeGroupName) + " Size " + ItemExportHelper.ConvertSizeForItemName(size.Size, hasKids2);
                child.LongDescription  = String.IsNullOrEmpty(model.Description) ? child.Title : model.Description;
                child.ShortDescription = String.IsNullOrEmpty(model.Description) ? child.Title : model.Description;
                child.ShelfDescription = String.IsNullOrEmpty(model.Description) ? child.Title : model.Description;
                child.Brand            = brandName;

                if (model.ImageSet != null)
                {
                    child.MainImageUrl = model.ImageSet.Image1Url;
                    //child.OtherImageUrl1 = model.ImageSet.Image2Url;
                    //child.OtherImageUrl2 = model.ImageSet.Image3Url;
                    //child.OtherImageUrl3 = model.ImageSet.Image4Url;
                }
                child.MainImageAltText = child.Title;

                child.Color = ItemExportHelper.PrepareColor(String.IsNullOrEmpty(size.Color) ? color1 : size.Color);


                child.ClothingSize  = size.Size;
                child.PriceCurrency = "USD";
                child.PriceAmount   = 99.99M; //TODO: price

                child.MinAdvertisedPriceAmount   = child.PriceAmount;
                child.MinAdvertisedPriceCurrency = child.PriceCurrency;

                child.VariantGroupId        = model.StyleId;
                child.VariantAttributeNames = "ClothingSize"; //TODO: add optional Color

                child.ProductTaxCode = "2038345";

                child.ShippingWeightValue = size.Weight.ToString();
                child.ShippingWeightUnit  = "OZ";

                childs.Add(child);
            }

            models.AddRange(childs);

            filename = model.StyleId + "_" + subLicense;
            filename = filename.Replace(" ", "") + "_Walmart" + Path.GetExtension(TemplatePath);

            return(models);
        }