示例#1
0
        public static void CartRetrieved(string cartId)
        {
            var id = 0;

            if (int.TryParse(cartId, out id))
            {
                var shoppingCart = ShoppingCartProvider.GetShoppingCart(StaticDistributorID, StaticLocale, id);
                if (HLConfigManager.Configurations.DOConfiguration.IsChina)
                {
                    var SKUsToRemove = new List <string>(new[]
                    {
                        HLConfigManager.Configurations.APFConfiguration.DistributorSku,
                        HLConfigManager.Configurations.APFConfiguration.SupervisorSku,
                        HLConfigManager.Configurations.DOConfiguration.TodayMagazineSku,
                        HLConfigManager.Configurations.DOConfiguration.TodayMagazineSecondarySku,
                        HLConfigManager.Configurations.DOConfiguration.HFFHerbalifeSku
                    });
                    SKUsToRemove.AddRange(HLConfigManager.Configurations.DOConfiguration.HFFSkuList);

                    foreach (var cartitem in shoppingCart.CartItems)
                    {
                        SKU_V01 sku;
                        if (SkuCollection != null && SkuCollection.TryGetValue(cartitem.SKU, out sku))
                        {
                            if (!sku.IsPurchasable)
                            {
                                SKUsToRemove.Add(sku.SKU);
                            }
                        }
                    }


                    SKUsToRemove.RemoveAll(x => x.ToString().Equals(string.Empty));
                    shoppingCart.DeleteItemsFromCart(SKUsToRemove.ToList());
                    if (shoppingCart.IsSavedCart)
                    {
                        HLRulesManager.Manager.ProcessSavedCartManagementRules(shoppingCart, ShoppingCartRuleReason.CartRetrieved);
                    }
                }
                if (shoppingCart.IsSavedCart || shoppingCart.IsFromCopy)
                {
                    HLRulesManager.Manager.ProcessSavedCartManagementRules(shoppingCart, ShoppingCartRuleReason.CartRetrieved);
                }
            }
        }
示例#2
0
        public static MyHLShoppingCart UnfilteredCartRetrieved(int cartId)
        {
            var shoppingCart = ShoppingCartProvider.GetShoppingCart(StaticDistributorID, StaticLocale, cartId);

            if (shoppingCart != null && shoppingCart.CartItems != null)
            {
                if (HLConfigManager.Configurations.DOConfiguration.IsChina)
                {
                    var SKUsToRemove = new List <string>(new[]
                    {
                        HLConfigManager.Configurations.APFConfiguration.DistributorSku,
                        HLConfigManager.Configurations.APFConfiguration.SupervisorSku,
                        HLConfigManager.Configurations.DOConfiguration.TodayMagazineSku,
                        HLConfigManager.Configurations.DOConfiguration.TodayMagazineSecondarySku,
                        HLConfigManager.Configurations.DOConfiguration.HFFHerbalifeSku
                    });


                    foreach (var cartitem in shoppingCart.CartItems)
                    {
                        SKU_V01 sku;
                        if (SkuCollection != null && SkuCollection.TryGetValue(cartitem.SKU, out sku))
                        {
                            if (!sku.IsPurchasable)
                            {
                                SKUsToRemove.Add(sku.SKU);
                            }
                        }
                    }
                    SKUsToRemove.RemoveAll(x => x.ToString().Equals(string.Empty));
                    shoppingCart.DeleteItemsFromCart(SKUsToRemove.ToList());
                }
                return(shoppingCart);
            }
            return(new MyHLShoppingCart());
        }