Exemplo n.º 1
0
        protected decimal GetBasketSubtotal()
        {
            decimal basketTotal = 0;

            foreach (BasketItem bi in _DisplayedBasketItems)
            {
                basketTotal += TaxHelper.GetShopExtendedPrice(AbleContext.Current.User.Basket, bi);
            }

            return(basketTotal);
        }
Exemplo n.º 2
0
 protected decimal GetItemShopPrice(BasketItem item)
 {
     return(TaxHelper.GetShopExtendedPrice(item.Basket, item));
 }
Exemplo n.º 3
0
        private void BindBasket(Basket basket)
        {
            //GET LIST OF PRODUCTS
            IList <BasketItem> _Products      = new List <BasketItem>();
            decimal            _ProductTotal  = 0;
            decimal            _DiscountTotal = 0;
            bool showTaxLineItems             = GetShowTaxLineItems();

            // MAKE SURE ITEMS ARE PROPERTY SORTED BEFORE DISPLAY
            basket.Items.Sort(new BasketItemComparer());
            foreach (BasketItem item in basket.Items)
            {
                if (item.OrderItemType == OrderItemType.Product)
                {
                    if (!item.IsChildItem)
                    {
                        // ROOT LEVEL ITEMS GET ADDED
                        _Products.Add(item);
                        _ProductTotal += TaxHelper.GetShopExtendedPrice(basket, item);
                    }
                    else
                    {
                        BasketItem rootItem = item.GetParentItem(true);
                        if (rootItem != null && rootItem.Product != null && rootItem.Product.Kit != null && rootItem.Product.Kit.ItemizeDisplay)
                        {
                            // ITEMIZED DISPLAY ENABLED, SHOW THIS CHILD ITEM
                            _Products.Add(item);
                            _ProductTotal += TaxHelper.GetShopExtendedPrice(basket, item);
                        }
                    }
                }
                else if (item.OrderItemType == OrderItemType.Discount)
                {
                    _DiscountTotal += TaxHelper.GetShopExtendedPrice(basket, item);
                }
                else if (item.OrderItemType == OrderItemType.Tax && showTaxLineItems && AbleContext.Current.User.IsAnonymous && !AbleContext.Current.User.PrimaryAddress.IsValid)
                {
                    _Products.Add(item);
                    item.Name = "<span class=\"label\">" + item.Name + " (estimated)</span>";
                }
                else if (item.OrderItemType == OrderItemType.Tax && showTaxLineItems)
                {
                    _Products.Add(item);
                }
            }
            if (_Products.Count > 0)
            {
                //BIND BASKET ITEMS
                BasketRepeater.DataSource = _Products;
                BasketRepeater.DataBind();
                if (_DiscountTotal != 0)
                {
                    Discounts.Text         = _DiscountTotal.LSCurrencyFormat("ulc");
                    DiscountsPanel.Visible = true;
                }
                else
                {
                    DiscountsPanel.Visible = false;
                }
                Discounts.Text = _DiscountTotal.LSCurrencyFormat("ulc");
                SubTotal.Text  = (_ProductTotal + _DiscountTotal).LSCurrencyFormat("ulc");
                //UPDATE CHECKOUT LINK
                //CheckoutLink.NavigateUrl = AbleCommerce.Code.NavigationHelper.GetCheckoutUrl();
                ShowBasket(true);
            }
            else
            {
                ShowBasket(false);
            }
        }