public override void FixtureSetup()
        {
            base.FixtureSetup();

            DbPreTestDataWorker.DeleteAllEntityCollections();

            _service = MerchelloContext.Current.Services.EntityCollectionService;

            this._query = ProxyQueryManager.Current.Instance <ProductCollectionTreeQuery>();

            var providerKey = Constants.ProviderKeys.EntityCollection.StaticProductCollectionProviderKey;

            root1 = _service.CreateEntityCollectionWithKey(EntityType.Product, providerKey, "root1", false);

            root2 = _service.CreateEntityCollectionWithKey(EntityType.Product, providerKey, "root2", false);

            a           = _service.CreateEntityCollection(EntityType.Product, providerKey, "a", false);
            a.ParentKey = root1.Key;

            b           = _service.CreateEntityCollection(EntityType.Product, providerKey, "b", false);
            b.ParentKey = root1.Key;

            c           = _service.CreateEntityCollection(EntityType.Product, providerKey, "c", false);
            c.ParentKey = root1.Key;

            _service.Save(new [] { a, b, c });

            a1           = _service.CreateEntityCollection(EntityType.Product, providerKey, "a1", false);
            a1.ParentKey = a.Key;

            a2           = _service.CreateEntityCollection(EntityType.Product, providerKey, "a2", false);
            a2.ParentKey = a.Key;

            _service.Save(new[] { a1, a2 });

            a1a           = _service.CreateEntityCollection(EntityType.Product, providerKey, "a1a", false);
            a1a.ParentKey = a1.Key;


            a1b           = _service.CreateEntityCollection(EntityType.Product, providerKey, "a1b", false);
            a1b.ParentKey = a1.Key;

            _service.Save(new[] { a1a, a1b });


            c1           = _service.CreateEntityCollection(EntityType.Product, providerKey, "c1", false);
            c1.ParentKey = c.Key;

            c2           = _service.CreateEntityCollection(EntityType.Product, providerKey, "c2", false);
            c2.ParentKey = c.Key;

            _service.Save(new[] { c1, c2 });

            c2a           = _service.CreateEntityCollection(EntityType.Product, providerKey, "c2a", false);
            c2a.ParentKey = c2.Key;

            _service.Save(c2a);

            _merchello = new MerchelloHelper();
        }
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            DbPreTestDataWorker.DeleteAllProducts();
            DbPreTestDataWorker.DeleteAllEntityCollections();

            _productService          = DbPreTestDataWorker.ProductService;
            _entityCollectionService = DbPreTestDataWorker.EntityCollectionService;

            _product = DbPreTestDataWorker.MakeExistingProduct();
            _product.ProductOptions.Add(new ProductOption("Color"));
            _product.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Black", "Blk"));
            _product.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Blue", "Blu"));
            _product.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Red", "Red"));
            _product.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Green", "Gre"));
            _product.ProductOptions.Add(new ProductOption("Size"));
            _product.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Small", "Sm"));
            _product.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Medium", "M"));
            _product.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Large", "Lg"));
            _product.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("X-Large", "XL"));
            _product.Height    = 20;
            _product.Weight    = 20;
            _product.Length    = 20;
            _product.Width     = 20;
            _product.Shippable = true;
            _productService.Save(_product);
        }
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            DbPreTestDataWorker.DeleteAllProducts();
            DbPreTestDataWorker.DeleteAllEntityCollections();

            _productService = DbPreTestDataWorker.ProductService;
            _entityCollectionService = DbPreTestDataWorker.EntityCollectionService;

            _product = DbPreTestDataWorker.MakeExistingProduct();
            _product.ProductOptions.Add(new ProductOption("Color"));
            _product.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Black", "Blk"));
            _product.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Blue", "Blu"));
            _product.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Red", "Red"));
            _product.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Green", "Gre"));
            _product.ProductOptions.Add(new ProductOption("Size"));
            _product.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Small", "Sm"));
            _product.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Medium", "M"));
            _product.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Large", "Lg"));
            _product.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("X-Large", "XL"));
            _product.Height = 20;
            _product.Weight = 20;
            _product.Length = 20;
            _product.Width = 20;
            _product.Shippable = true;
            _productService.Save(_product);
        }
 /// <summary>
 /// The entity collection service on deleted.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 private void EntityCollectionServiceOnDeleted(IEntityCollectionService sender, DeleteEventArgs<IEntityCollection> e)
 {
     if (!EntityCollectionProviderResolver.HasCurrent) return;
     foreach (var collection in e.DeletedEntities)
     {
         EntityCollectionProviderResolver.Current.RemoveFromCache(collection.Key);
     }
 }
 /// <summary>
 /// The entity collection service on saved.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 private void EntityCollectionServiceOnSaved(IEntityCollectionService sender, SaveEventArgs<IEntityCollection> e)
 {
     if (!EntityCollectionProviderResolver.HasCurrent) return;
     foreach (var collection in e.SavedEntities)
     {
         EntityCollectionProviderResolver.Current.AddOrUpdateCache(collection);
     }
 }
Example #6
0
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            _entityCollectionService = DbPreTestDataWorker.EntityCollectionService;
            _customerService         = DbPreTestDataWorker.CustomerService;
            _resolver    = EntityCollectionProviderResolver.Current;
            _providerKey = _resolver.GetProviderKey <StaticCustomerCollectionProvider>();
        }
Example #7
0
        private void EntityCollectionServiceOnCreated(IEntityCollectionService sender, Core.Events.NewEventArgs <IEntityCollection> e)
        {
            if (!EntityCollectionProviderResolver.HasCurrent)
            {
                return;
            }

            EntityCollectionProviderResolver.Current.AddOrUpdateCache(e.Entity);
        }
Example #8
0
 private void EntityCollectionServiceOnDeleted(IEntityCollectionService sender, DeleteEventArgs <IEntityCollection> e)
 {
     if (!EntityCollectionProviderResolver.HasCurrent)
     {
         return;
     }
     foreach (var collection in e.DeletedEntities)
     {
         EntityCollectionProviderResolver.Current.RemoveFromCache(collection.Key);
     }
 }
 /// <summary>
 /// The entity collection service on saved.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 private void EntityCollectionServiceOnSaved(IEntityCollectionService sender, SaveEventArgs <IEntityCollection> e)
 {
     if (!EntityCollectionProviderResolver.HasCurrent)
     {
         return;
     }
     foreach (var collection in e.SavedEntities)
     {
         EntityCollectionProviderResolver.Current.AddOrUpdateCache(collection);
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="EntityCollectionApiController"/> class.
        /// </summary>
        /// <param name="merchelloContext">
        /// The merchello context.
        /// </param>
        /// <param name="umbracoContext">
        /// The umbraco context.
        /// </param>
        public EntityCollectionApiController(IMerchelloContext merchelloContext, UmbracoContext umbracoContext)
            : base(merchelloContext, umbracoContext)
        {
            Mandate.ParameterNotNull(merchelloContext, "merchelloContext");

            _entityCollectionService = merchelloContext.Services.EntityCollectionService;

            _resolver = EntityCollectionProviderResolver.Current;

            _merchello = new MerchelloHelper(merchelloContext, false);

            this.Initialize();
        }
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            DbPreTestDataWorker.DeleteAllEntityCollections();

            _service = MerchelloContext.Current.Services.EntityCollectionService;

            this._query = ProxyQueryManager.Current.Instance<ProductCollectionTreeQuery>();

            var providerKey = Constants.ProviderKeys.EntityCollection.StaticProductCollectionProviderKey;

            root1 = _service.CreateEntityCollectionWithKey(EntityType.Product, providerKey, "root1", false);

            root2 = _service.CreateEntityCollectionWithKey(EntityType.Product, providerKey, "root2", false);

            a = _service.CreateEntityCollection(EntityType.Product, providerKey, "a", false);
            a.ParentKey = root1.Key;

            b = _service.CreateEntityCollection(EntityType.Product, providerKey, "b", false);
            b.ParentKey = root1.Key;

            c = _service.CreateEntityCollection(EntityType.Product, providerKey, "c", false);
            c.ParentKey = root1.Key;

            _service.Save(new [] { a, b, c });

            a1 = _service.CreateEntityCollection(EntityType.Product, providerKey, "a1", false);
            a1.ParentKey = a.Key;

            a2 = _service.CreateEntityCollection(EntityType.Product, providerKey, "a2", false);
            a2.ParentKey = a.Key;

            _service.Save(new[] { a1, a2 });

            a1a = _service.CreateEntityCollection(EntityType.Product, providerKey, "a1a", false);
            a1a.ParentKey = a1.Key;

            a1b = _service.CreateEntityCollection(EntityType.Product, providerKey, "a1b", false);
            a1b.ParentKey = a1.Key;

            _service.Save(new[] { a1a, a1b });

            c1 = _service.CreateEntityCollection(EntityType.Product, providerKey, "c1", false);
            c1.ParentKey = c.Key;

            c2 = _service.CreateEntityCollection(EntityType.Product, providerKey, "c2", false);
            c2.ParentKey = c.Key;

            _service.Save(new[] { c1, c2 });

            c2a = _service.CreateEntityCollection(EntityType.Product, providerKey, "c2a", false);
            c2a.ParentKey = c2.Key;

            _service.Save(c2a);

            _merchello = new MerchelloHelper();
        }
Example #12
0
        private void EntityCollectionDeleted(IEntityCollectionService sender, DeleteEventArgs <Core.Models.Interfaces.IEntityCollection> e)
        {
            var merchello = new MerchelloHelper();

            ((ProductFilterGroupQuery)merchello.Filters.Product).ClearFilterTreeCache();
        }
        private void EntityCollectionServiceOnCreated(IEntityCollectionService sender, Core.Events.NewEventArgs<IEntityCollection> e)
        {
            if (!EntityCollectionProviderResolver.HasCurrent) return;

            EntityCollectionProviderResolver.Current.AddOrUpdateCache(e.Entity);
        }
Example #14
0
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            #region clean up
            _detachedContentTypeService = ((ServiceContext)MerchelloContext.Current.Services).DetachedContentTypeService;

            var existingContentTypes = _detachedContentTypeService.GetAll();
            foreach (var t in existingContentTypes)
            {
                ((ServiceContext)MerchelloContext.Current.Services).DetachedContentTypeService.Delete(t);
            }

            DbPreTestDataWorker.DeleteAllProducts();
            DbPreTestDataWorker.DeleteAllEntityCollections();
            #endregion

            var catalog = DbPreTestDataWorker.WarehouseCatalog;

            var detachedContentType =
                ((ServiceContext)MerchelloContext.Current.Services).DetachedContentTypeService
                .CreateDetachedContentTypeWithKey(EntityType.Product, new Guid(), "TEST");

            _productService          = DbPreTestDataWorker.ProductService;
            _entityCollectionService = DbPreTestDataWorker.EntityCollectionService;

            var collection1 =
                _entityCollectionService.CreateEntityCollection(
                    EntityType.Product,
                    Core.Constants.ProviderKeys.EntityCollection.StaticProductCollectionProviderKey,
                    "Collection1");

            var collection2 =
                _entityCollectionService.CreateEntityCollection(
                    EntityType.Product,
                    Core.Constants.ProviderKeys.EntityCollection.StaticProductCollectionProviderKey,
                    "Collection2");

            this._original                    = DbPreTestDataWorker.MakeExistingProduct();
            _original.Barcode                 = "barcode";
            _original.Manufacturer            = "manufacturer";
            _original.ManufacturerModelNumber = "modelnumber";
            _original.CostOfGoods             = 1M;
            _original.OnSale                  = false;
            _original.SalePrice               = 2M;
            _original.Taxable                 = true;
            _original.Shippable               = true;
            _original.Height                  = 2;
            _original.Weight                  = 2;
            _original.Width                   = 2;
            _original.Length                  = 2;
            _original.Available               = true;
            _original.Download                = false;
            _original.OutOfStockPurchase      = true;
            _original.AddToCatalogInventory(catalog);
            this._original.ProductOptions.Add(new ProductOption("Color"));
            this._original.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Black", "Blk"));
            this._original.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Blue", "Blu"));
            this._original.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Red", "Red"));
            this._original.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Green", "Gre"));
            this._original.ProductOptions.Add(new ProductOption("Size"));
            this._original.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Small", "Sm"));
            this._original.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Medium", "M"));
            this._original.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Large", "Lg"));
            this._original.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("X-Large", "XL"));
            this._original.Height    = 20;
            this._original.Weight    = 20;
            this._original.Length    = 20;
            this._original.Width     = 20;
            this._original.Shippable = true;
            _productService.Save(this._original);

            _original.AddToCollection(collection1);
            _original.AddToCollection(collection2);

            this._original.DetachedContents.Add(
                new ProductVariantDetachedContent(
                    this._original.ProductVariantKey,
                    detachedContentType,
                    "en-US",
                    new DetachedDataValuesCollection(
                        new[]
            {
                new KeyValuePair <string, string>(
                    "description",
                    "\"<p><span>Made with real avocados, this Avocado Moisturizing Bar is great for dry skin. Layers of color are achieved by using oxide colorants. Scented with Wasabi Fragrance Oil, this soap smells slightly spicy, making it a great choice for both men and women. To ensure this soap does not overheat, place in the freezer to keep cool and prevent gel phase.</span></p>\""),
                new KeyValuePair <string, string>(
                    "brief",
                    "\"Avocado Moisturizing Bar is great for dry skin.\""),
                new KeyValuePair <string, string>(
                    "image",
                    "{ \"focalPoint\": { \"left\": 0.5, \"top\": 0.5 }, \"src\": \"/media/1035/avocadobars.jpg\" }"),
            }))
            {
                CanBeRendered = true
            });

            this._original.DetachedContents.Add(
                new ProductVariantDetachedContent(
                    this._original.ProductVariantKey,
                    detachedContentType,
                    "en-GB",
                    new DetachedDataValuesCollection(
                        new[]
            {
                new KeyValuePair <string, string>(
                    "description",
                    "\"<p><span>Made with real avocados, this Avocado Moisturizing Bar is great for dry skin. Layers of color are achieved by using oxide colorants. Scented with Wasabi Fragrance Oil, this soap smells slightly spicy, making it a great choice for both men and women. To ensure this soap does not overheat, place in the freezer to keep cool and prevent gel phase.</span></p>\""),
                new KeyValuePair <string, string>(
                    "brief",
                    "\"Avocado Moisturizing Bar is great for dry skin.\""),
                new KeyValuePair <string, string>(
                    "image",
                    "{ \"focalPoint\": { \"left\": 0.5, \"top\": 0.5 }, \"src\": \"/media/1035/avocadobars.jpg\" }"),
            }))
            {
                CanBeRendered = true
            });

            var firstVariant = _original.ProductVariants.First();

            firstVariant.DetachedContents.Add(
                new ProductVariantDetachedContent(
                    firstVariant.Key,
                    detachedContentType,
                    "en-US",
                    new DetachedDataValuesCollection(
                        new[]
            {
                new KeyValuePair <string, string>(
                    "description",
                    "\"<p><span>US ENGLISH VARIANT Made with real avocados, this Avocado Moisturizing Bar is great for dry skin. Layers of color are achieved by using oxide colorants. Scented with Wasabi Fragrance Oil, this soap smells slightly spicy, making it a great choice for both men and women. To ensure this soap does not overheat, place in the freezer to keep cool and prevent gel phase.</span></p>\""),
                new KeyValuePair <string, string>(
                    "brief",
                    "\"Avocado Moisturizing Bar is great for dry skin.\""),
                new KeyValuePair <string, string>(
                    "image",
                    "{ \"focalPoint\": { \"left\": 0.5, \"top\": 0.5 }, \"src\": \"/media/1035/avocadobars.jpg\" }"),
            }))
            {
                CanBeRendered = true
            });

            firstVariant.DetachedContents.Add(
                new ProductVariantDetachedContent(
                    firstVariant.Key,
                    detachedContentType,
                    "en-GB",
                    new DetachedDataValuesCollection(
                        new[]
            {
                new KeyValuePair <string, string>(
                    "description",
                    "\"<p><span>GB ENGLISH VARIANT Made with real avocados, this Avocado Moisturizing Bar is great for dry skin. Layers of color are achieved by using oxide colorants. Scented with Wasabi Fragrance Oil, this soap smells slightly spicy, making it a great choice for both men and women. To ensure this soap does not overheat, place in the freezer to keep cool and prevent gel phase.</span></p>\""),
                new KeyValuePair <string, string>(
                    "brief",
                    "\"Avocado Moisturizing Bar is great for dry skin.\""),
                new KeyValuePair <string, string>(
                    "image",
                    "{ \"focalPoint\": { \"left\": 0.5, \"top\": 0.5 }, \"src\": \"/media/1035/avocadobars.jpg\" }"),
            }))
            {
                CanBeRendered = true
            });

            _productService.Save(this._original);
        }
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            _entityCollectionService = DbPreTestDataWorker.EntityCollectionService;
            _customerService = DbPreTestDataWorker.CustomerService;
            _resolver = EntityCollectionProviderResolver.Current;
            _providerKey = _resolver.GetProviderKey<StaticCustomerCollectionProvider>();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="EntityCollectionApiController"/> class.
        /// </summary>
        /// <param name="merchelloContext">
        /// The merchello context.
        /// </param>
        /// <param name="umbracoContext">
        /// The umbraco context.
        /// </param>
        public EntityCollectionApiController(IMerchelloContext merchelloContext, UmbracoContext umbracoContext)
            : base(merchelloContext, umbracoContext)
        {
            Mandate.ParameterNotNull(merchelloContext, "merchelloContext");

            _entityCollectionService = merchelloContext.Services.EntityCollectionService;

            _resolver = EntityCollectionProviderResolver.Current;

            _merchello = new MerchelloHelper(merchelloContext, false);

            this.Initialize();
        }
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            #region clean up
            _detachedContentTypeService = ((ServiceContext)MerchelloContext.Current.Services).DetachedContentTypeService;

            var existingContentTypes = _detachedContentTypeService.GetAll();
            foreach (var t in existingContentTypes)
            {
                ((ServiceContext)MerchelloContext.Current.Services).DetachedContentTypeService.Delete(t);
            }

            DbPreTestDataWorker.DeleteAllProducts();
            DbPreTestDataWorker.DeleteAllEntityCollections();
            #endregion

            var catalog = DbPreTestDataWorker.WarehouseCatalog;

            var detachedContentType =
                ((ServiceContext)MerchelloContext.Current.Services).DetachedContentTypeService
                    .CreateDetachedContentTypeWithKey(EntityType.Product, new Guid(), "TEST");

            _productService = DbPreTestDataWorker.ProductService;
            _entityCollectionService = DbPreTestDataWorker.EntityCollectionService;

            var collection1 =
                _entityCollectionService.CreateEntityCollection(
                EntityType.Product,
                Core.Constants.ProviderKeys.EntityCollection.StaticProductCollectionProviderKey,
                "Collection1");

            var collection2 =
                _entityCollectionService.CreateEntityCollection(
                EntityType.Product,
                Core.Constants.ProviderKeys.EntityCollection.StaticProductCollectionProviderKey,
                "Collection2");

            this._original = DbPreTestDataWorker.MakeExistingProduct();
            _original.Barcode = "barcode";
            _original.Manufacturer = "manufacturer";
            _original.ManufacturerModelNumber = "modelnumber";
            _original.CostOfGoods = 1M;
            _original.OnSale = false;
            _original.SalePrice = 2M;
            _original.Taxable = true;
            _original.Shippable = true;
            _original.Height = 2;
            _original.Weight = 2;
            _original.Width = 2;
            _original.Length = 2;
            _original.Available = true;
            _original.Download = false;
            _original.OutOfStockPurchase = true;
            _original.AddToCatalogInventory(catalog);
            this._original.ProductOptions.Add(new ProductOption("Color"));
            this._original.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Black", "Blk"));
            this._original.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Blue", "Blu"));
            this._original.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Red", "Red"));
            this._original.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Green", "Gre"));
            this._original.ProductOptions.Add(new ProductOption("Size"));
            this._original.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Small", "Sm"));
            this._original.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Medium", "M"));
            this._original.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Large", "Lg"));
            this._original.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("X-Large", "XL"));
            this._original.Height = 20;
            this._original.Weight = 20;
            this._original.Length = 20;
            this._original.Width = 20;
            this._original.Shippable = true;
            _productService.Save(this._original);

            _original.AddToCollection(collection1);
            _original.AddToCollection(collection2);

            this._original.DetachedContents.Add(
                new ProductVariantDetachedContent(
                    this._original.ProductVariantKey,
                    detachedContentType,
                    "en-US",
                    new DetachedDataValuesCollection(
                        new[]
                            {
                                new KeyValuePair<string, string>(
                                    "description",
                                    "\"<p><span>Made with real avocados, this Avocado Moisturizing Bar is great for dry skin. Layers of color are achieved by using oxide colorants. Scented with Wasabi Fragrance Oil, this soap smells slightly spicy, making it a great choice for both men and women. To ensure this soap does not overheat, place in the freezer to keep cool and prevent gel phase.</span></p>\""),
                                new KeyValuePair<string, string>(
                                    "brief",
                                    "\"Avocado Moisturizing Bar is great for dry skin.\""),
                                new KeyValuePair<string, string>(
                                    "image",
                                    "{ \"focalPoint\": { \"left\": 0.5, \"top\": 0.5 }, \"src\": \"/media/1035/avocadobars.jpg\" }"),
                            }))
                {
                    CanBeRendered = true
                });

            this._original.DetachedContents.Add(
                new ProductVariantDetachedContent(
                    this._original.ProductVariantKey,
                    detachedContentType,
                    "en-GB",
                    new DetachedDataValuesCollection(
                        new[]
                            {
                                new KeyValuePair<string, string>(
                                    "description",
                                    "\"<p><span>Made with real avocados, this Avocado Moisturizing Bar is great for dry skin. Layers of color are achieved by using oxide colorants. Scented with Wasabi Fragrance Oil, this soap smells slightly spicy, making it a great choice for both men and women. To ensure this soap does not overheat, place in the freezer to keep cool and prevent gel phase.</span></p>\""),
                                new KeyValuePair<string, string>(
                                    "brief",
                                    "\"Avocado Moisturizing Bar is great for dry skin.\""),
                                new KeyValuePair<string, string>(
                                    "image",
                                    "{ \"focalPoint\": { \"left\": 0.5, \"top\": 0.5 }, \"src\": \"/media/1035/avocadobars.jpg\" }"),
                            }))
                {
                    CanBeRendered = true
                });

            var firstVariant = _original.ProductVariants.First();

            firstVariant.DetachedContents.Add(
                new ProductVariantDetachedContent(
                    firstVariant.Key,
                    detachedContentType,
                    "en-US",
                    new DetachedDataValuesCollection(
                        new[]
                            {
                                new KeyValuePair<string, string>(
                                    "description",
                                    "\"<p><span>US ENGLISH VARIANT Made with real avocados, this Avocado Moisturizing Bar is great for dry skin. Layers of color are achieved by using oxide colorants. Scented with Wasabi Fragrance Oil, this soap smells slightly spicy, making it a great choice for both men and women. To ensure this soap does not overheat, place in the freezer to keep cool and prevent gel phase.</span></p>\""),
                                new KeyValuePair<string, string>(
                                    "brief",
                                    "\"Avocado Moisturizing Bar is great for dry skin.\""),
                                new KeyValuePair<string, string>(
                                    "image",
                                    "{ \"focalPoint\": { \"left\": 0.5, \"top\": 0.5 }, \"src\": \"/media/1035/avocadobars.jpg\" }"),
                            }))
                {
                    CanBeRendered = true
                });

            firstVariant.DetachedContents.Add(
                new ProductVariantDetachedContent(
                    firstVariant.Key,
                    detachedContentType,
                    "en-GB",
                    new DetachedDataValuesCollection(
                        new[]
                            {
                                new KeyValuePair<string, string>(
                                    "description",
                                    "\"<p><span>GB ENGLISH VARIANT Made with real avocados, this Avocado Moisturizing Bar is great for dry skin. Layers of color are achieved by using oxide colorants. Scented with Wasabi Fragrance Oil, this soap smells slightly spicy, making it a great choice for both men and women. To ensure this soap does not overheat, place in the freezer to keep cool and prevent gel phase.</span></p>\""),
                                new KeyValuePair<string, string>(
                                    "brief",
                                    "\"Avocado Moisturizing Bar is great for dry skin.\""),
                                new KeyValuePair<string, string>(
                                    "image",
                                    "{ \"focalPoint\": { \"left\": 0.5, \"top\": 0.5 }, \"src\": \"/media/1035/avocadobars.jpg\" }"),
                            }))
                {
                    CanBeRendered = true
                });

            _productService.Save(this._original);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ProductCollectionQuery"/> class.
 /// </summary>
 /// <param name="entityCollectionService">
 /// The entity collection service.
 /// </param>
 /// <param name="cache">
 /// The cache.
 /// </param>
 public ProductCollectionQuery(IEntityCollectionService entityCollectionService, ICacheProvider cache)
     : base(entityCollectionService, cache)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ProxyCollectionQueryBase"/> class.
 /// </summary>
 /// <param name="entityCollectionService">
 /// The entity Collection Service.
 /// </param>
 /// <param name="cache">
 /// The cache.
 /// </param>
 protected ProxyCollectionQueryBase(IEntityCollectionService entityCollectionService, ICacheProvider cache)
     : base(cache)
 {
     Ensure.ParameterNotNull(entityCollectionService, "The EntityCollectionService was null");
     this.Service = entityCollectionService;
 }
 public EntityCollectionController(IEntityCollectionService entityCollectionService)
 {
     _entityCollectionService = entityCollectionService;
 }
 private void EntityCollectionDeleted(IEntityCollectionService sender, DeleteEventArgs<Core.Models.Interfaces.IEntityCollection> e)
 {
     var merchello = new MerchelloHelper();
     ((ProductFilterGroupQuery)merchello.Filters.Product).ClearFilterTreeCache();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ProxyCollectionQueryBase"/> class.
 /// </summary>
 /// <param name="entityCollectionService">
 /// The entity Collection Service.
 /// </param>
 /// <param name="cache">
 /// The cache.
 /// </param>
 protected ProxyCollectionQueryBase(IEntityCollectionService entityCollectionService, ICacheProvider cache)
     : base(cache)
 {
     Ensure.ParameterNotNull(entityCollectionService, "The EntityCollectionService was null");
     this.Service = entityCollectionService;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ManagedCollectionsResolver"/> class.
 /// </summary>
 public ManagedCollectionsResolver()
 {
     _entityCollectionService = MerchelloContext.Current.Services.EntityCollectionService;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ProductCollectionQuery"/> class.
 /// </summary>
 /// <param name="entityCollectionService">
 /// The entity collection service.
 /// </param>
 /// <param name="cache">
 /// The cache.
 /// </param>
 public ProductCollectionQuery(IEntityCollectionService entityCollectionService, ICacheProvider cache)
     : base(entityCollectionService, cache)
 {
 }