Esempio n. 1
0
        /// <summary>
        /// Will get variant information from a single product. This json will mostly be used to create variant selection drop downs in the frontend
        /// </summary>
        /// <param name="variants"></param>
        /// <returns>A json blob with a dictionary of products and their variants. This dictionary will only contain a single product</returns>
        ///

        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="storeId"></param>
        /// <param name="product"></param>
        /// <param name="onlyValid"></param>
        /// <returns></returns>
        public static string GetVariantJson <T>(long storeId, T product, bool onlyValid = true) where T : class
        {
            IVariantService <T, VariantPublishedContent> variantService = DependencyContainer.Instance.Resolve <IVariantService <T, VariantPublishedContent> >();

            return(variantService.GetVariantJson(storeId, new List <T> {
                product
            }, onlyValid));
        }
Esempio n. 2
0
        /// <summary>
        /// Will get variant information from several products. This json will mostly be used to create variant selection drop downs in the frontend
        /// </summary>
        /// <param name="variants"></param>
        /// <returns>A json blob with a dictionary of products and their variants</returns>
        public static string GetVariantJson <T>(long storeId, IEnumerable <T> products, bool onlyValid = true)
        {
            IVariantService <T, VariantPublishedContent> variantService = DependencyContainer.Instance.Resolve <IVariantService <T, VariantPublishedContent> >();

            return(variantService.GetVariantJson(storeId, products, onlyValid));
        }