コード例 #1
0
        /// <summary>
        /// Displays the price.
        /// </summary>
        /// <param name="price">The price.</param>
        protected virtual void DisplayPrice(decimal price)
        {
            ShoppingCartSettings shoppingCartSettings = Sitecore.Ecommerce.Context.Entity.GetConfiguration <ShoppingCartSettings>();
            GeneralSettings      generalSetting       = Sitecore.Ecommerce.Context.Entity.GetConfiguration <GeneralSettings>();

            Assert.IsNotNull(this.Currency, "Unable to display price. Currency cannot be null.");
            Assert.IsNotNullOrEmpty(this.Currency.Code, "Unable to display price. Currency code cannot be null or empty.");

            this.lblShippingCost.Text = MainUtil.FormatPrice(price, generalSetting.DisplayCurrencyOnPrices, shoppingCartSettings.PriceFormatString, this.Currency.Code);
        }
コード例 #2
0
        /// <summary>
        /// Gets the lit total price text.
        /// </summary>
        /// <param name="dataItem">The data item.</param>
        /// <returns>The ShoppingCart line total price.</returns>
        protected string ShoppingCartLineTotalPrice(object dataItem)
        {
            ProductLine productLine = dataItem as ProductLine;

            if (productLine == null)
            {
                Log.Warn("Product line is null.", this);
                return("-");
            }

            return(this.Settings.ShowPriceIncVAT
               ?
                   MainUtil.FormatPrice(productLine.Totals.TotalPriceIncVat, false, this.Settings.PriceFormatString)
               :
                   MainUtil.FormatPrice(productLine.Totals.TotalPriceExVat, false, this.Settings.PriceFormatString));
        }
コード例 #3
0
        /// <summary>
        /// Gets the single price.
        /// </summary>
        /// <param name="ni">The ni.</param>
        /// <returns>The single price.</returns>
        public string GetSinglePrice(XPathNodeIterator ni)
        {
            string value = "-";

            try
            {
                Totals productPricesList = this.GetProductTotals(ni);

                if (productPricesList != null && productPricesList.PriceExVat != decimal.Zero)
                {
                    value = MainUtil.FormatPrice(productPricesList.PriceExVat, true);
                }
            }
            catch (Exception ex)
            {
                Log.Error("Unable to resolve single price.", ex, this);
            }

            return(value);
        }
コード例 #4
0
        /// <summary>
        /// Gets the list price.
        /// </summary>
        /// <param name="ni">The ni.</param>
        /// <returns>The list price.</returns>
        public string GetListPrice(XPathNodeIterator ni)
        {
            string value = "-";

            try
            {
                GeneralSettings settings          = Context.Entity.GetConfiguration <GeneralSettings>();
                Totals          productPricesList = this.GetProductTotals(ni);

                if (productPricesList != null && productPricesList.PriceExVat != decimal.Zero)
                {
                    value = MainUtil.FormatPrice(productPricesList.PriceExVat + productPricesList.DiscountExVat, settings.DisplayCurrencyOnPrices);
                }
            }
            catch (Exception ex)
            {
                Log.Error("Unable to resolve product list price.", ex, this);
            }

            return(value);
        }
コード例 #5
0
 /// <summary>
 /// Formats the price.
 /// </summary>
 /// <param name="price">The price.</param>
 /// <returns>Returns formated price.</returns>
 protected virtual string FormatPrice(object price)
 {
     return(MainUtil.FormatPrice(price, GeneralSettings.DisplayCurrencyOnPrices, ShoppingCartSettings.PriceFormatString, this.Currency.Code));
 }