public IViewComponentResult Invoke(bool?prepareAndDisplayOrderReviewData, ShoppingCartModel overriddenModel)
        {
            //use already prepared (shared) model
            if (overriddenModel != null)
            {
                return(View(overriddenModel));
            }

            //if not passed, then create a new model
            var cart = _shoppingCartService.GetShoppingCart(_workContext.CurrentCustomer, ShoppingCartType.ShoppingCart, _storeContext.CurrentStore.Id);

            var model = new ShoppingCartModel();

            model = _shoppingCartModelFactory.PrepareShoppingCartModel(model, cart,
                                                                       isEditable: false,
                                                                       prepareAndDisplayOrderReviewData: prepareAndDisplayOrderReviewData.GetValueOrDefault());
            return(View(model));
        }
Exemple #2
0
        public IViewComponentResult Invoke(string widgetZone, object additionalData)
        {
            var cart = _workContext.CurrentCustomer.ShoppingCartItems
                       .Where(sci => sci.ShoppingCartType == ShoppingCartType.ShoppingCart)
                       .LimitPerStore(_storeContext.CurrentStore.Id)
                       .ToList();

            var shoppingCartModel = new ShoppingCartModel();

            _shoppingCartModelFactory.PrepareShoppingCartModel(shoppingCartModel, cart,
                                                               isEditable: false,
                                                               prepareAndDisplayOrderReviewData: false);
            ViewBag.ShoppingCartModel = shoppingCartModel;

            var model = _shoppingCartModelFactory.PrepareOrderTotalsModel(cart, (bool)additionalData);

            return(View("~/Views/Shared/Components/OrderTotals/Default.cshtml", model));
        }
Exemple #3
0
        public IViewComponentResult Invoke(bool?prepareAndDisplayOrderReviewData, ShoppingCartModel overriddenModel)
        {
            ViewBag.BonusesBalance = _rewardPointService.GetRewardPointsBalance(_workContext.CurrentCustomer.Id, _storeContext.CurrentStore.Id);
            //use already prepared (shared) model
            if (overriddenModel != null)
            {
                return(View(overriddenModel));
            }

            //if not passed, then create a new model
            var cart = _workContext.CurrentCustomer.ShoppingCartItems
                       .Where(sci => sci.ShoppingCartType == ShoppingCartType.ShoppingCart)
                       .LimitPerStore(_storeContext.CurrentStore.Id)
                       .ToList();

            var model = new ShoppingCartModel();

            model = _shoppingCartModelFactory.PrepareShoppingCartModel(model, cart,
                                                                       isEditable: false,
                                                                       prepareAndDisplayOrderReviewData: prepareAndDisplayOrderReviewData.GetValueOrDefault());
            return(View(model));
        }
 public ShoppingCartModel GetCurrentShoppingCartModel(ShoppingCartModel model, List <ShoppingCartItem> cart)
 {
     model = _shoppingCartModelFactory.PrepareShoppingCartModel(model, cart);
     return(model);
 }