protected virtual string GetProductViewTrackingScript(IContent content, Guid userId)
        {
            if (content == null)
            {
                throw new ArgumentNullException("content");
            }
            EntryContentBase entry = content as EntryContentBase;

            if (entry is VariationContent)
            {
                // Get parent product
                var parentProducts = GetParentProductsForVariation(entry as VariationContent);
                var productContent = parentProducts.FirstOrDefault();
                // This implementation will use the first one
                if (productContent != null)
                {
                    entry = productContent;
                }
            }

            string        productCode      = entry.Code;
            List <string> parentCategories = entry.GetParentCategoryCodes(entry.Language.Name);

            return(GenerateClickUrl(userId, productCode, parentCategories));
        }
Пример #2
0
        protected virtual List <SannsynUpdateEntityModel> GetUpdateModels(Dictionary <string, EntryContentBase> indexableContentItems)
        {
            List <SannsynUpdateEntityModel> sannsynObjects = new List <SannsynUpdateEntityModel>();

            foreach (var indexableContentItem in indexableContentItems)
            {
                EntryContentBase         product          = indexableContentItem.Value;
                List <string>            parentCategories = product.GetParentCategoryCodes(product.Language.Name);
                SannsynUpdateEntityModel model            = new SannsynUpdateEntityModel();
                model.Customer = product.Code;
                model.Tags     = new List <string> {
                    Constants.Tags.ItemCat
                };
                model.EntityIDs = parentCategories;
                sannsynObjects.Add(model);
            }
            return(sannsynObjects);
        }