/// <summary> /// Fills strands div element with attributes depending on given template type. /// </summary> /// <param name="strandsWebTemplateTypeEnum">Type of template</param> private void FillTemplateAttributes(StrandsWebTemplateTypeEnum strandsWebTemplateTypeEnum) { switch (strandsWebTemplateTypeEnum) { case StrandsWebTemplateTypeEnum.Home: // Selected widget doesn't need any item ID break; case StrandsWebTemplateTypeEnum.Product: // Current document ID will be sent to Strands if (CheckForProductPage()) // This template should not be displayed on documents not related with products { strandsRecs.Attributes.Add("item", CurrentDocument.NodeID.ToString()); } break; case StrandsWebTemplateTypeEnum.Cart: // Items IDs passed to Strands will be obtained from shopping cart var cartItems = StrandsProductsProvider.GetItemIDsFromCurrentShoppingCart().ToList(); if (!cartItems.Any()) { HandleError(GetString("strands.recommendations.cart.noitem")); break; } strandsRecs.Attributes.Add("item", GetItemsStringForMultipleItems(cartItems)); break; case StrandsWebTemplateTypeEnum.Order: // Items IDs passed to Strands will be obtained from last order of current contact var orderItems = StrandsProductsProvider.GetItemsIDsFromRecentOrder().ToList(); if (!orderItems.Any()) { HandleError(GetString("strands.recommendations.order.noorder")); break; } strandsRecs.Attributes.Add("item", GetItemsStringForMultipleItems(orderItems)); break; case StrandsWebTemplateTypeEnum.Category: // No items will be passed to Strands, only dfilter parameter will be set if (CheckForProductPage()) // This template should not be displayed on documents not related with products { string category = StrandsCatalogPropertiesMapper.GetItemCategory(CurrentDocument); strandsRecs.Attributes.Add("dfilter", string.Format("category::{0}", category)); } break; } }
/// <summary> /// Fills strands div element with attributes depending on given template type. /// </summary> /// <param name="strandsWebTemplateTypeEnum">Type of template</param> private void FillTemplateAttributes(StrandsWebTemplateTypeEnum strandsWebTemplateTypeEnum) { switch (strandsWebTemplateTypeEnum) { case StrandsWebTemplateTypeEnum.Home: // Selected widget doesn't need any item ID break; case StrandsWebTemplateTypeEnum.Product: // Current document ID will be sent to Strands if (CheckForProductPage()) // This template should not be displayed on documents not related with products { strandsRecs.Attributes.Add("item", CurrentDocument.DocumentID.ToString()); } break; case StrandsWebTemplateTypeEnum.Cart: // Items IDs passed to Strands will be obtained from shopping cart var cartItems = StrandsProductsProvider.GetItemIDsFromCurrentShoppingCart().ToList(); if (!cartItems.Any()) { HandleError(GetString("strands.recommendations.cart.noitem")); break; } strandsRecs.Attributes.Add("item", GetItemsStringForMultipleItems(cartItems)); break; case StrandsWebTemplateTypeEnum.Order: // Items IDs passed to Strands will be obtained from last order of current contact var orderItems = StrandsProductsProvider.GetItemsIDsFromRecentOrder().ToList(); if (!orderItems.Any()) { HandleError(GetString("strands.recommendations.order.noorder")); break; } strandsRecs.Attributes.Add("item", GetItemsStringForMultipleItems(orderItems)); break; case StrandsWebTemplateTypeEnum.Category: // No items will be passed to Strands, only dfilter parameter will be set if (CheckForProductPage()) // This template should not be displayed on documents not related with products { string category = StrandsCatalogPropertiesMapper.GetItemCategory(CurrentDocument); strandsRecs.Attributes.Add("dfilter", string.Format("category::{0}", category)); } break; } }