protected virtual void AddCommerceComponents(Customer.FoundationContact contact, CommerceHeaderViewModel viewModel) { if (_databaseMode.DatabaseMode == DatabaseMode.ReadOnly) { viewModel.MiniCart = new MiniCartViewModel(); viewModel.WishListMiniCart = new MiniWishlistViewModel(); viewModel.SharedMiniCart = new MiniCartViewModel(); return; } viewModel.MiniCart = _cartViewModelFactory.CreateMiniCartViewModel( _cartService.LoadCart(_cartService.DefaultCartName, true)?.Cart); viewModel.WishListMiniCart = _cartViewModelFactory.CreateMiniWishListViewModel( _cartService.LoadCart(_cartService.DefaultWishListName, true)?.Cart); var organizationId = contact?.FoundationOrganization?.OrganizationId.ToString(); if (!organizationId.IsNullOrEmpty()) { viewModel.SharedMiniCart = _cartViewModelFactory.CreateMiniCartViewModel( _cartService.LoadCart(_cartService.DefaultSharedCartName, organizationId, true)?.Cart, true); viewModel.ShowSharedCart = true; } }
public ActionResult Index(IContent currentContent) { var cart = _cartService.LoadCart(_cartService.DefaultCartName); var wishlist = _cartService.LoadCart(_cartService.DefaultWishListName); var startPage = _contentLoader.Get <StartPage>(ContentReference.StartPage); var viewModel = new NavigationViewModel { StartPage = startPage, CurrentContentLink = currentContent?.ContentLink, UserLinks = new LinkItemCollection(), MiniCart = _cartViewModelFactory.CreateMiniCartViewModel(cart), WishListMiniCart = _cartViewModelFactory.CreateWishListMiniCartViewModel(wishlist) }; if (HttpContext.User.Identity.IsAuthenticated) { var rightMenuItems = startPage.RightMenu; //if (rightMenuItems != null) //{ // viewModel.UserLinks.AddRange(rightMenuItems); //} viewModel.UserLinks.Add(new LinkItem { Href = _urlHelper.Action("SignOut", "Login"), Text = _localizationService.GetString("/Header/Account/SignOut") }); } else { viewModel.UserLinks.Add(new LinkItem { Href = _urlHelper.Action("Index", "Login", new { returnUrl = currentContent != null ? _urlHelper.ContentUrl(currentContent.ContentLink) : "/" }), Text = _localizationService.GetString("/Header/Account/SignIn") }); } return(PartialView(viewModel)); }
public ActionResult MiniCartDetails() { var viewModel = _cartViewModelFactory.CreateMiniCartViewModel(Cart); return(PartialView("_MiniCartDetails", viewModel)); }
public ActionResult MiniCartDetails() { var viewModel = _cartViewModelFactory.CreateMiniCartViewModel(CartWithValidationIssues.Cart); return(PartialView(b2cMinicart, viewModel)); }
public ActionResult LoadMiniSharedCart() { var viewModel = _cartViewModelFactory.CreateMiniCartViewModel(SharedCart.Cart, true); return(PartialView("~/Features/Shared/Foundation/Header/_MiniSharedCartItems.cshtml", viewModel)); }