コード例 #1
0
        public bool ProductsRemoveOption(Product p, string optionBvin)
        {
            Option opt = ProductOptions.Find(optionBvin);

            if (opt == null)
            {
                return(false);
            }

            bool result = ProductsXOptions.RemoveOptionFromProduct(p.Bvin, optionBvin);

            ProductsReloadOptions(p);

            // delete an option if it's not shared
            if (result)
            {
                if (!opt.IsShared)
                {
                    result = ProductOptions.Delete(opt.Bvin);
                }
            }

            if (opt.IsVariant)
            {
                VariantsValidate(p);
            }

            return(result);
        }
コード例 #2
0
        //Product Options

        public bool ProductsAddOption(Product p, string optionBvin)
        {
            Option opt = ProductOptions.Find(optionBvin);

            if (opt == null)
            {
                return(false);
            }

            bool result = ProductsXOptions.AddOptionToProduct(p.Bvin, optionBvin);

            ProductsReloadOptions(p);

            if (opt.IsVariant)
            {
                VariantsValidate(p);
            }

            return(result);
        }