Esempio n. 1
0
        public CartShopModel()
        {
            CurrentCart = CurrentCart.Create(SnuffoSettings.STORE_NAME);
            if (CurrentCart.HasCartItems())
            {
                var items = CurrentCart.GetCartItemsByCookieId();
                if (!items.IsNullOrEmpty())
                {
                    CartItems = items.OrderBy(c => c.Name);
                    var productIds = items.Select(x => x.ProductId);
                    Subtotal = items.Sum(x => (x.Quantity * x.UnitPrice));
                }

                var checkoutUrl = $"/{CurrentUser.LanguageCode}/cart/checkout-address/";
                CheckoutUrl = (!CurrentUser.IsAuthenticated)
                    ? $"/{CurrentUser.LanguageCode}/cart/checkout-login/?returnUrl={checkoutUrl}"
                    : checkoutUrl;
            }
        }