Пример #1
0
        private static void IndexProductVariant(IProductVariant productVariant)
        {
            var cache = new VirtualProductContentCache();

            cache.ClearVirtualCache(productVariant.ProductKey);
            ProductIndexer.ReIndexNode(productVariant.SerializeToXml().Root, IndexTypes.ProductVariant);
        }
Пример #2
0
        private static void DeleteProductVariantFromIndex(IProductVariant productVariant)
        {
            var cache = new VirtualProductContentCache();

            cache.ClearVirtualCache(productVariant.ProductKey);
            ProductIndexer.DeleteFromIndex(((ProductVariant)productVariant).ExamineId.ToString(CultureInfo.InvariantCulture));
        }
Пример #3
0
        /// <summary>
        /// Removes a product with all of its variants from the index
        /// </summary>
        static void ProductServiceDeleted(IProductService sender, DeleteEventArgs <IProduct> e)
        {
            var cache = new VirtualProductContentCache();

            cache.ClearVirtualCache(e);
            e.DeletedEntities.ForEach(DeleteProductFromIndex);
        }
Пример #4
0
        /// <summary>
        /// Adds or updates a product with all of its variants to the index
        /// </summary>
        static void ProductServiceSaved(IProductService sender, SaveEventArgs <IProduct> e)
        {
            var cache = new VirtualProductContentCache();

            cache.ClearVirtualCache(e);
            e.SavedEntities.ForEach(IndexProduct);
        }
Пример #5
0
        /// <summary>
        /// Removes a product with all of its variants from the index
        /// </summary>
        static void ProductServiceDeleted(IProductService sender, DeleteEventArgs <IProduct> e)
        {
            var cache = new VirtualProductContentCache();

            cache.ClearVirtualCache(e);
            foreach (var eDeletedEntity in e.DeletedEntities)
            {
                DeleteProductFromIndex(eDeletedEntity);
            }
        }
Пример #6
0
        /// <summary>
        /// Adds or updates a product with all of its variants to the index
        /// </summary>
        static void ProductServiceSaved(IProductService sender, SaveEventArgs <IProduct> e)
        {
            var cache = new VirtualProductContentCache();

            cache.ClearVirtualCache(e);
            foreach (var eSavedEntity in e.SavedEntities)
            {
                IndexProduct(eSavedEntity);
            }
        }
Пример #7
0
        /// <summary>
        /// The product option repository re index.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The product keys.
        /// </param>
        /// <remarks>
        /// REFACTOR v3
        /// </remarks>
        private void ProductOptionRepositoryReIndex(ProductOptionRepository sender, Core.Events.ObjectEventArgs <IEnumerable <Guid> > e)
        {
            var keys = e.EventObject;

            if (MerchelloContext.HasCurrent)
            {
                var products     = MerchelloContext.Current.Services.ProductService.GetByKeys(keys).ToArray();
                var contentCache = new VirtualProductContentCache();
                foreach (var p in products)
                {
                    IndexProduct(p);

                    // we also need to refresh the published product cache
                    contentCache.ClearVirtualCache(p);
                }
            }
        }
Пример #8
0
 /// <summary>
 /// Adds or updates a product with all of its variants to the index
 /// </summary>        
 static void ProductServiceSaved(IProductService sender, SaveEventArgs<IProduct> e)
 {
     var cache = new VirtualProductContentCache();
     cache.ClearVirtualCache(e);
     e.SavedEntities.ForEach(IndexProduct);
 }
Пример #9
0
 /// <summary>
 /// Removes a product with all of its variants from the index
 /// </summary>   
 static void ProductServiceDeleted(IProductService sender, DeleteEventArgs<IProduct> e)
 {
     var cache = new VirtualProductContentCache();
     cache.ClearVirtualCache(e);
     e.DeletedEntities.ForEach(DeleteProductFromIndex);
 }
Пример #10
0
 private static void IndexProductVariant(IProductVariant productVariant)
 {
     var cache = new VirtualProductContentCache();
     cache.ClearVirtualCache(productVariant.ProductKey);
     ProductIndexer.ReIndexNode(productVariant.SerializeToXml().Root, IndexTypes.ProductVariant);
 }
Пример #11
0
 private static void DeleteProductVariantFromIndex(IProductVariant productVariant)
 {
     var cache = new VirtualProductContentCache();
     cache.ClearVirtualCache(productVariant.ProductKey);
     ProductIndexer.DeleteFromIndex(((ProductVariant)productVariant).ExamineId.ToString(CultureInfo.InvariantCulture));
 }