public void Get_ProductTypes() { var productTypeHandler = new MozuDataConnector.Domain.Handlers.ProductTypeHandler(); var productTypes = productTypeHandler.GetProductTypes(_apiContext.TenantId, _apiContext.SiteId, _apiContext.MasterCatalogId, 0, 20, null, null).Result; }
public void Update_Sunglasses_Style_Property_ProductType() { var productTypeName = "Sunglasses"; var filter = string.Format("name eq '{0}'", productTypeName); var productTypeHandler = new MozuDataConnector.Domain.Handlers.ProductTypeHandler(); var productTypes = productTypeHandler.GetProductTypes(_apiContext.TenantId, _apiContext.SiteId, _apiContext.MasterCatalogId, 0, 20, null, null).Result; var existingProductType = productTypes.SingleOrDefault(a => a.Name == productTypeName); if (existingProductType != null) { var attributeHandler = new MozuDataConnector.Domain.Handlers.AttributeHandler(); var attributeStyle = attributeHandler.GetAttributes(_apiContext.TenantId, _apiContext.SiteId, _apiContext.MasterCatalogId, 0, 1, null, "attributeFQN eq 'tenant~sunglass-style'").Result.First(); AttributeInProductType productTypePropertyStyle = new AttributeInProductType() { AttributeFQN = attributeStyle.AttributeFQN, IsInheritedFromBaseType = false, AttributeDetail = attributeStyle, IsHiddenProperty = false, IsMultiValueProperty = true, IsRequiredByAdmin = false, Order = 0, VocabularyValues = new System.Collections.Generic.List <AttributeVocabularyValueInProductType>() }; var productTypePropertyStyleValues = "Pilot|Rectangle|Rimless"; var seq = 30; foreach (var value in productTypePropertyStyleValues.Split('|')) { productTypePropertyStyle.VocabularyValues.Add(new AttributeVocabularyValueInProductType() { Value = value, Order = 0, VocabularyValueDetail = new AttributeVocabularyValue() { Content = new AttributeVocabularyValueLocalizedContent() { LocaleCode = "en-US", StringValue = value }, Value = value, ValueSequence = seq++ } }); } existingProductType.Properties.Add(productTypePropertyStyle); var newProductType = productTypeHandler.UpdateProductType(_apiContext.TenantId, _apiContext.SiteId, _apiContext.MasterCatalogId, existingProductType).Result; } }
public void Get_Purse_ProductType() { var filter = "name eq " + "'Purse'"; var productTypeHandler = new MozuDataConnector.Domain.Handlers.ProductTypeHandler(); var productTypes = productTypeHandler.GetProductTypes(_apiContext.TenantId, _apiContext.SiteId, _apiContext.MasterCatalogId, 0, 20, null, filter).Result; }
public void Update_Sunglasses_Protection_Property_ProductType() { var productTypeName = "Sunglasses"; var filter = string.Format("name eq '{0}'", productTypeName); var productTypeHandler = new MozuDataConnector.Domain.Handlers.ProductTypeHandler(); var productTypes = productTypeHandler.GetProductTypes(_apiContext.TenantId, _apiContext.SiteId, _apiContext.MasterCatalogId, 0, 20, null, null).Result; var existingProductType = productTypes.SingleOrDefault(a => a.Name == productTypeName); if (existingProductType != null) { var attributeHandler = new MozuDataConnector.Domain.Handlers.AttributeHandler(); var attributeProtection = attributeHandler.GetAttributes(_apiContext.TenantId, _apiContext.SiteId, _apiContext.MasterCatalogId, 0, 1, null, "attributeFQN eq 'tenant~sunglass-protection'").Result.First(); AttributeInProductType productTypePropertyProtection = new AttributeInProductType() { AttributeFQN = attributeProtection.AttributeFQN, IsInheritedFromBaseType = false, AttributeDetail = attributeProtection, IsHiddenProperty = false, IsMultiValueProperty = false, IsRequiredByAdmin = false, Order = 0 }; existingProductType.Properties.Add(productTypePropertyProtection); var newProductType = productTypeHandler.UpdateProductType(_apiContext.TenantId, _apiContext.SiteId, _apiContext.MasterCatalogId, existingProductType).Result; } }
public void Add_Sunglasses_ProductType() { var productTypeName = "Sunglasses"; var filter = string.Format("name eq '{0}'", productTypeName); var productTypeHandler = new MozuDataConnector.Domain.Handlers.ProductTypeHandler(); var productTypes = productTypeHandler.GetProductTypes(_apiContext.TenantId, _apiContext.SiteId, _apiContext.MasterCatalogId, 0, 20, null, null).Result; var existingProductType = productTypes.SingleOrDefault(a => a.Name == productTypeName); if (existingProductType == null) { var productType = new ProductType() { Name = productTypeName, GoodsType = "Physical", MasterCatalogId = _apiContext.MasterCatalogId, Options = new System.Collections.Generic.List <AttributeInProductType>(), Properties = new System.Collections.Generic.List <AttributeInProductType>(), Extras = null, IsBaseProductType = false, ProductUsages = new System.Collections.Generic.List <string> { "Standard", "Configurable", "Bundle", "Component" }, }; var newProductType = productTypeHandler.AddProductType(_apiContext.TenantId, _apiContext.SiteId, _apiContext.MasterCatalogId, productType).Result; } }
public void Add_Sunglasses_Product() { var productTypeHandler = new MozuDataConnector.Domain.Handlers.ProductTypeHandler(); var productTypes = productTypeHandler.GetProductTypes(_apiContext.TenantId, _apiContext.SiteId, _apiContext.MasterCatalogId, 0, 20, null, "name eq 'Sunglasses'").Result; var existingProductType = productTypes.SingleOrDefault(a => a.Name == "Sunglasses"); if (existingProductType != null) { var productCode = "LUC-SUN-003"; var productHandler = new MozuDataConnector.Domain.Handlers.ProductHandler(); var existingProduct = productHandler.GetProduct(_apiContext.TenantId, _apiContext.SiteId, _apiContext.MasterCatalogId, productCode).Result; if (existingProduct == null) { var product = new Product() { ProductCode = productCode, ProductUsage = "Configurable", FulfillmentTypesSupported = new System.Collections.Generic.List <string> { "DirectShip" }, MasterCatalogId = 1,//_apiContext.MasterCatalogId, ProductTypeId = existingProductType.Id, IsValidForProductType = true, ProductInCatalogs = new System.Collections.Generic.List <ProductInCatalogInfo> { new ProductInCatalogInfo() { CatalogId = 1, IsActive = true, IsContentOverridden = false, Content = new ProductLocalizedContent() { LocaleCode = "en-US", ProductName = "Commander Sunglasses", ProductShortDescription = "This minimalistic design is a great fit for those seeking adventure.", }, IsPriceOverridden = false, Price = new ProductPrice() { Price = 685.00m, SalePrice = 615.00m }, IsseoContentOverridden = false, SeoContent = new ProductLocalizedSEOContent() { LocaleCode = "en-US", MetaTagTitle = "Euro Commander Sunglasses", SeoFriendlyUrl = "euro-commander-sunglasses" }, } }, HasConfigurableOptions = true, HasStandAloneOptions = false, IsVariation = false, IsTaxable = false, InventoryInfo = new ProductInventoryInfo() { ManageStock = false }, IsRecurring = false, SupplierInfo = new ProductSupplierInfo() { Cost = new ProductCost() { Cost = 0m, IsoCurrencyCode = "USD" } }, IsPackagedStandAlone = false, StandAlonePackageType = "CUSTOM", PublishingInfo = new ProductPublishingInfo() { PublishedState = "Live" }, Content = new ProductLocalizedContent() { LocaleCode = "en-US", ProductShortDescription = "This minimalistic design is a great fit for those seeking adventure.", ProductName = "Commander Sunglasses", }, SeoContent = new ProductLocalizedSEOContent() { LocaleCode = "en-US", MetaTagTitle = "Euro Commander Sunglasses", SeoFriendlyUrl = "euro-commander-sunglasses" }, Price = new ProductPrice() { Price = 685.00m, SalePrice = 615.00m }, PricingBehavior = new ProductPricingBehaviorInfo() { DiscountsRestricted = false }, PackageWeight = new Mozu.Api.Contracts.Core.Measurement() { Unit = "lbs", Value = .5m }, PackageLength = new Mozu.Api.Contracts.Core.Measurement() { Unit = "in", Value = 3.75m }, PackageWidth = new Mozu.Api.Contracts.Core.Measurement() { Unit = "in", Value = 5.5m }, PackageHeight = new Mozu.Api.Contracts.Core.Measurement() { Unit = "in", Value = 1.85m } }; var newProduct = productHandler.AddProduct(_apiContext.TenantId, _apiContext.SiteId, _apiContext.MasterCatalogId, product).Result; } } }
public void Update_Sunglasses_Color_Options_ProductType() { var productTypeName = "Sunglasses"; var filter = string.Format("name eq '{0}'", productTypeName); var productTypeHandler = new MozuDataConnector.Domain.Handlers.ProductTypeHandler(); var productTypes = productTypeHandler.GetProductTypes(_apiContext.TenantId, _apiContext.SiteId, _apiContext.MasterCatalogId, 0, 20, null, null).Result; var existingProductType = productTypes.SingleOrDefault(a => a.Name == productTypeName); if (existingProductType != null) { var attributeHandler = new MozuDataConnector.Domain.Handlers.AttributeHandler(); var attributeColor = attributeHandler.GetAttributes(_apiContext.TenantId, _apiContext.SiteId, _apiContext.MasterCatalogId, 0, 1, null, "attributeFQN eq 'tenant~color'").Result.First(); AttributeInProductType productTypeOptionColor = new AttributeInProductType() { AttributeFQN = attributeColor.AttributeFQN, IsInheritedFromBaseType = false, AttributeDetail = attributeColor, IsHiddenProperty = false, IsMultiValueProperty = false, IsRequiredByAdmin = false, Order = 0, VocabularyValues = new System.Collections.Generic.List <AttributeVocabularyValueInProductType>() }; productTypeOptionColor.VocabularyValues.Add(new AttributeVocabularyValueInProductType() { Value = "Black", Order = 0, VocabularyValueDetail = new AttributeVocabularyValue() { Content = new AttributeVocabularyValueLocalizedContent() { LocaleCode = "en-US", StringValue = "Black" }, Value = "Black", ValueSequence = 10 } }); productTypeOptionColor.VocabularyValues.Add(new AttributeVocabularyValueInProductType() { Value = "Brown", Order = 0, VocabularyValueDetail = new AttributeVocabularyValue() { Content = new AttributeVocabularyValueLocalizedContent() { LocaleCode = "en-US", StringValue = "Brown" }, Value = "Brown", ValueSequence = 11 } }); existingProductType.Options.Add(productTypeOptionColor); var newProductType = productTypeHandler.UpdateProductType(_apiContext.TenantId, _apiContext.SiteId, _apiContext.MasterCatalogId, existingProductType).Result; } }