コード例 #1
0
        public void Get_Purse_Product()
        {
            var productHandler = new MozuDataConnector.Domain.Handlers.ProductHandler();

            var products = productHandler.GetProduct(_apiContext.TenantId, _apiContext.SiteId,
                                                     _apiContext.MasterCatalogId, "LUC-sun-002").Result;
        }
コード例 #2
0
        public void Get_Products()
        {
            var productHandler = new MozuDataConnector.Domain.Handlers.ProductHandler();

            var products = productHandler.GetProducts(_apiContext.TenantId, _apiContext.SiteId,
                                                      _apiContext.MasterCatalogId, 0, 20, null, null).Result;
        }
コード例 #3
0
        public void Update_Sunglasses_Options_Product()
        {
            var productCode = "LUC-SUN-001";

            var productHandler  = new MozuDataConnector.Domain.Handlers.ProductHandler();
            var existingProduct = productHandler.GetProduct(_apiContext.TenantId, _apiContext.SiteId,
                                                            _apiContext.MasterCatalogId, productCode).Result;

            if (existingProduct != null)
            {
                existingProduct.Options = new System.Collections.Generic.List <ProductOption>();

                existingProduct.Options.Add(new ProductOption()
                {
                    AttributeFQN = "tenant~color",
                    Values       = new System.Collections.Generic.List <ProductOptionValue>()
                    {
                        new ProductOptionValue()
                        {
                            Value = "Black",
                            AttributeVocabularyValueDetail = new AttributeVocabularyValue()
                            {
                                Value   = "Black",
                                Content = new AttributeVocabularyValueLocalizedContent()
                                {
                                    LocaleCode  = "en-US",
                                    StringValue = "Black"
                                },
                            }
                        },
                        new ProductOptionValue()
                        {
                            Value = "Brown",
                            AttributeVocabularyValueDetail = new AttributeVocabularyValue()
                            {
                                Value   = "Brown",
                                Content = new AttributeVocabularyValueLocalizedContent()
                                {
                                    LocaleCode  = "en-US",
                                    StringValue = "Brown"
                                },
                            }
                        }
                    }
                });

                var newProduct = productHandler.UpdateProduct(_apiContext.TenantId, _apiContext.SiteId,
                                                              _apiContext.MasterCatalogId, existingProduct).Result;
            }
        }
コード例 #4
0
        public void Update_Sunglasses_Properties_Product()
        {
            var productCode = "LUC-SUN-001";

            var productHandler  = new MozuDataConnector.Domain.Handlers.ProductHandler();
            var existingProduct = productHandler.GetProduct(_apiContext.TenantId, _apiContext.SiteId,
                                                            _apiContext.MasterCatalogId, productCode).Result;

            if (existingProduct != null)
            {
                existingProduct.Properties = new System.Collections.Generic.List <ProductProperty>();

                existingProduct.Properties.Add(new ProductProperty()
                {
                    AttributeFQN = "tenant~product-crosssell",
                    Values       = new System.Collections.Generic.List <ProductPropertyValue>()
                    {
                        new ProductPropertyValue()
                        {
                            Value   = "LUC-SCF-001",
                            Content = new ProductPropertyValueLocalizedContent()
                            {
                                LocaleCode  = "en-US",
                                StringValue = "LUC-SCF-001"
                            },
                        }
                    }
                });

                existingProduct.Properties.Add(new ProductProperty()
                {
                    AttributeFQN = "tenant~sunglass-protection",
                    Values       = new System.Collections.Generic.List <ProductPropertyValue>()
                    {
                        new ProductPropertyValue()
                        {
                            Value   = "90% UV Protected",
                            Content = new ProductPropertyValueLocalizedContent()
                            {
                                LocaleCode  = "en-US",
                                StringValue = "90% UV Protected"
                            },
                        }
                    }
                });

                existingProduct.Properties.Add(new ProductProperty()
                {
                    AttributeFQN = "tenant~sunglass-style",
                    Values       = new System.Collections.Generic.List <ProductPropertyValue>()
                    {
                        new ProductPropertyValue()
                        {
                            Value = "Pilot",
                            AttributeVocabularyValueDetail = new AttributeVocabularyValue()
                            {
                                Content = new AttributeVocabularyValueLocalizedContent()
                                {
                                    LocaleCode  = "en-US",
                                    StringValue = "Pilot"
                                },
                            },
                        },
                        new ProductPropertyValue()
                        {
                            Value = "Rectangle",
                            AttributeVocabularyValueDetail = new AttributeVocabularyValue()
                            {
                                Content = new AttributeVocabularyValueLocalizedContent()
                                {
                                    LocaleCode  = "en-US",
                                    StringValue = "Rectangle"
                                },
                            },
                        }
                    }
                });

                var newProduct = productHandler.UpdateProduct(_apiContext.TenantId, _apiContext.SiteId,
                                                              _apiContext.MasterCatalogId, existingProduct).Result;
            }
        }
コード例 #5
0
        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;
                }
            }
        }