當前位置: 首頁>>代碼示例>>C#>>正文


C# Orders.ShoppingCartItem類代碼示例

本文整理匯總了C#中NopSolutions.NopCommerce.BusinessLogic.Orders.ShoppingCartItem的典型用法代碼示例。如果您正苦於以下問題:C# ShoppingCartItem類的具體用法?C# ShoppingCartItem怎麽用?C# ShoppingCartItem使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ShoppingCartItem類屬於NopSolutions.NopCommerce.BusinessLogic.Orders命名空間,在下文中一共展示了ShoppingCartItem類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetAttributeDescription

 public string GetAttributeDescription(ShoppingCartItem shoppingCartItem)
 {
     string result = ProductAttributeHelper.FormatAttributes(shoppingCartItem.ProductVariant, shoppingCartItem.AttributesXml, customer, "<br />");
     if (!String.IsNullOrEmpty(result))
         result = "<br />" + result;
     return result;
 }
開發者ID:robbytarigan,項目名稱:ToyHouse,代碼行數:7,代碼來源:CustomerShoppingCart.ascx.cs

示例2: GetProductVariantName

 public string GetProductVariantName(ShoppingCartItem shoppingCartItem)
 {
     ProductVariant productVariant = shoppingCartItem.ProductVariant;
     if (productVariant != null)
         return productVariant.FullProductName;
     return "Not available";
 }
開發者ID:robbytarigan,項目名稱:ToyHouse,代碼行數:7,代碼來源:CustomerShoppingCart.ascx.cs

示例3: GetShoppingCartItemSubTotalString

        public string GetShoppingCartItemSubTotalString(ShoppingCartItem shoppingCartItem)
        {
            Customer customer = shoppingCartItem.CustomerSession.Customer;
            StringBuilder sb = new StringBuilder();
            decimal taxRate = decimal.Zero;
            decimal shoppingCartItemSubTotalWithDiscountBase = TaxManager.GetPrice(shoppingCartItem.ProductVariant, PriceHelper.GetSubTotal(shoppingCartItem, customer, true), customer, out taxRate);
            decimal shoppingCartItemSubTotalWithDiscount = CurrencyManager.ConvertCurrency(shoppingCartItemSubTotalWithDiscountBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
            string subTotalString = PriceHelper.FormatPrice(shoppingCartItemSubTotalWithDiscount);

            sb.Append(subTotalString);

            decimal shoppingCartItemDiscountBase = TaxManager.GetPrice(shoppingCartItem.ProductVariant, PriceHelper.GetDiscountAmount(shoppingCartItem, customer), customer, out taxRate);
            if (shoppingCartItemDiscountBase > decimal.Zero)
            {
                decimal shoppingCartItemDiscount = CurrencyManager.ConvertCurrency(shoppingCartItemDiscountBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                string discountString = PriceHelper.FormatPrice(shoppingCartItemDiscount);

                sb.Append("<br />");
                //sb.Append(GetLocaleResourceString("ShoppingCart.ItemYouSave"));
                sb.Append("Saved:");
                sb.Append("&nbsp;&nbsp;");
                sb.Append(discountString);
            }
            return sb.ToString();
        }
開發者ID:netmatrix01,項目名稱:Innocent,代碼行數:25,代碼來源:CurrentShoppingCarts.ascx.cs

示例4: GetProductVariantUrl

 public string GetProductVariantUrl(ShoppingCartItem shoppingCartItem)
 {
     string result = string.Empty;
     if (shoppingCartItem == null)
         return result;
     ProductVariant productVariant = shoppingCartItem.ProductVariant;
     if (productVariant != null)
         result = "ProductVariantDetails.aspx?ProductVariantID=" + productVariant.ProductVariantId.ToString();
     else
         result = "Not available. Product variant ID=" + shoppingCartItem.ProductVariantId.ToString();
     return result;
 }
開發者ID:fathurxzz,項目名稱:aleqx,代碼行數:12,代碼來源:CustomerWishlist.ascx.cs

示例5: GetProductUrl

 public string GetProductUrl(ShoppingCartItem shoppingCartItem)
 {
     var productVariant = shoppingCartItem.ProductVariant;
     if (productVariant != null)
         return SEOHelper.GetProductUrl(productVariant.ProductId);
     return string.Empty;
 }
開發者ID:robbytarigan,項目名稱:ToyHouse,代碼行數:7,代碼來源:Wishlist.ascx.cs

示例6: GetDiscountAmount

 /// <summary>
 /// Gets discount amount
 /// </summary>
 /// <param name="shoppingCartItem">The shopping cart item</param>
 /// <param name="customer">The customer</param>
 /// <returns>Discount amount</returns>
 public static decimal GetDiscountAmount(ShoppingCartItem shoppingCartItem, Customer customer)
 {
     Discount appliedDiscount = null;
     return GetDiscountAmount(shoppingCartItem, customer, out appliedDiscount);
 }
開發者ID:netmatrix01,項目名稱:Innocent,代碼行數:11,代碼來源:PriceHelper.cs

示例7: GetShoppingCartItemUnitPriceString

        public string GetShoppingCartItemUnitPriceString(ShoppingCartItem shoppingCartItem)
        {
            StringBuilder sb = new StringBuilder();
            decimal taxRate = decimal.Zero;
            decimal shoppingCartUnitPriceWithDiscountBase = TaxManager.GetPrice(shoppingCartItem.ProductVariant, PriceHelper.GetUnitPrice(shoppingCartItem, customer, true), customer, out taxRate);
            decimal shoppingCartUnitPriceWithDiscount = CurrencyManager.ConvertCurrency(shoppingCartUnitPriceWithDiscountBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
            string unitPriceString = PriceHelper.FormatPrice(shoppingCartUnitPriceWithDiscount);

            sb.Append(unitPriceString);
            return sb.ToString();
        }
開發者ID:fathurxzz,項目名稱:aleqx,代碼行數:11,代碼來源:CustomerWishlist.ascx.cs

示例8: GetShoppingCartItemSubTotalString

        public string GetShoppingCartItemSubTotalString(ShoppingCartItem shoppingCartItem)
        {
            var sb = new StringBuilder();
            if (shoppingCartItem.ProductVariant.CallForPrice)
            {
                sb.Append("<span class=\"productPrice\">");
                sb.Append(GetLocaleResourceString("Products.CallForPrice"));
                sb.Append("</span>");
            }
            else
            {
                //sub total
                decimal taxRate = decimal.Zero;
                decimal shoppingCartItemSubTotalWithDiscountBase = this.TaxService.GetPrice(shoppingCartItem.ProductVariant, PriceHelper.GetSubTotal(shoppingCartItem, true), out taxRate);
                decimal shoppingCartItemSubTotalWithDiscount = this.CurrencyService.ConvertCurrency(shoppingCartItemSubTotalWithDiscountBase, this.CurrencyService.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                string subTotalString = PriceHelper.FormatPrice(shoppingCartItemSubTotalWithDiscount);

                sb.Append("<span class=\"productPrice\">");
                sb.Append(subTotalString);
                sb.Append("</span>");

                //display an applied discount amount
                decimal shoppingCartItemSubTotalWithoutDiscountBase = this.TaxService.GetPrice(shoppingCartItem.ProductVariant, PriceHelper.GetSubTotal(shoppingCartItem, false), out taxRate);
                decimal shoppingCartItemDiscountBase = shoppingCartItemSubTotalWithoutDiscountBase - shoppingCartItemSubTotalWithDiscountBase;
                if (shoppingCartItemDiscountBase > decimal.Zero)
                {
                    decimal shoppingCartItemDiscount = this.CurrencyService.ConvertCurrency(shoppingCartItemDiscountBase, this.CurrencyService.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                    string discountString = PriceHelper.FormatPrice(shoppingCartItemDiscount);

                    sb.Append("<br />");
                    sb.Append(GetLocaleResourceString("Wishlist.ItemYouSave"));
                    sb.Append("&nbsp;&nbsp;");
                    sb.Append(discountString);
                }
            }
            return sb.ToString();
        }
開發者ID:robbytarigan,項目名稱:ToyHouse,代碼行數:37,代碼來源:Wishlist.ascx.cs

示例9: GetDiscountAmount

        /// <summary>
        /// Gets discount amount
        /// </summary>
        /// <param name="shoppingCartItem">The shopping cart item</param>
        /// <param name="customer">The customer</param>
        /// <returns>Discount amount</returns>
        public static decimal GetDiscountAmount(ShoppingCartItem shoppingCartItem, Customer customer)
        {
            decimal discountAmount = decimal.Zero;
            ProductVariant productVariant = shoppingCartItem.ProductVariant;
            if (productVariant != null)
            {
                decimal attributesTotalPrice = decimal.Zero;

                ProductVariantAttributeValueCollection pvaValues = ProductAttributeHelper.ParseProductVariantAttributeValues(shoppingCartItem.AttributesXML);
                foreach (ProductVariantAttributeValue pvaValue in pvaValues)
                {
                    attributesTotalPrice += pvaValue.PriceAdjustment;
                }

                decimal productVariantDiscountAmount = GetDiscountAmount(productVariant, customer, attributesTotalPrice);
                discountAmount = productVariantDiscountAmount * shoppingCartItem.Quantity;
            }

            discountAmount = Math.Round(discountAmount, 2);
            return discountAmount;
        }
開發者ID:juliakolesen,項目名稱:voobrazi.by,代碼行數:27,代碼來源:PriceHelper.cs

示例10: GetUnitPrice

        /// <summary>
        /// Gets the shopping cart unit price (one item)
        /// </summary>
        /// <param name="shoppingCartItem">The shopping cart item</param>
        /// <param name="customer">The customer</param>
        /// <param name="includeDiscounts">A value indicating whether include discounts or not for price computation</param>
        /// <returns>Shopping cart unit price (one item)</returns>
        public static decimal GetUnitPrice(ShoppingCartItem shoppingCartItem, Customer customer, bool includeDiscounts)
        {
            decimal finalPrice = decimal.Zero;
            ProductVariant productVariant = shoppingCartItem.ProductVariant;
            if (productVariant != null)
            {
                decimal attributesTotalPrice = decimal.Zero;

                ProductVariantAttributeValueCollection pvaValues = ProductAttributeHelper.ParseProductVariantAttributeValues(shoppingCartItem.AttributesXML);
                foreach (ProductVariantAttributeValue pvaValue in pvaValues)
                {
                    attributesTotalPrice += pvaValue.PriceAdjustment;
                }
                finalPrice = GetFinalPrice(productVariant, customer, attributesTotalPrice, includeDiscounts);

                if (productVariant.TierPrices.Count > 0)
                {
                    decimal tierPrice = GetTierPrice(productVariant, shoppingCartItem.Quantity);
                    finalPrice = Math.Min(finalPrice, tierPrice);
                }
            }

            finalPrice = Math.Round(finalPrice, 2);

            return finalPrice;
        }
開發者ID:juliakolesen,項目名稱:voobrazi.by,代碼行數:33,代碼來源:PriceHelper.cs

示例11: GetSubTotal

 /// <summary>
 /// Gets the shopping cart item sub total
 /// </summary>
 /// <param name="shoppingCartItem">The shopping cart item</param>
 /// <param name="customer">The customer</param>
 /// <param name="includeDiscounts">A value indicating whether include discounts or not for price computation</param>
 /// <returns>Shopping cart item sub total</returns>
 public static decimal GetSubTotal(ShoppingCartItem shoppingCartItem, Customer customer, bool includeDiscounts)
 {
     return GetUnitPrice(shoppingCartItem, customer, includeDiscounts) * shoppingCartItem.Quantity;
 }
開發者ID:juliakolesen,項目名稱:voobrazi.by,代碼行數:11,代碼來源:PriceHelper.cs

示例12: GetUnitPrice

        /// <summary>
        /// Gets the shopping cart unit price (one item)
        /// </summary>
        /// <param name="shoppingCartItem">The shopping cart item</param>
        /// <param name="customer">The customer</param>
        /// <param name="includeDiscounts">A value indicating whether include discounts or not for price computation</param>
        /// <returns>Shopping cart unit price (one item)</returns>
        public static decimal GetUnitPrice(ShoppingCartItem shoppingCartItem, Customer customer,
            bool includeDiscounts)
        {
            decimal finalPrice = decimal.Zero;
            var productVariant = shoppingCartItem.ProductVariant;
            if (productVariant != null)
            {
                decimal attributesTotalPrice = decimal.Zero;

                var pvaValues = ProductAttributeHelper.ParseProductVariantAttributeValues(shoppingCartItem.AttributesXml);
                foreach (var pvaValue in pvaValues)
                {
                    attributesTotalPrice += pvaValue.PriceAdjustment;
                }

                if (productVariant.CustomerEntersPrice)
                {
                    finalPrice = shoppingCartItem.CustomerEnteredPrice;
                }
                else
                {
                    finalPrice = GetFinalPrice(productVariant,
                        customer,
                        attributesTotalPrice,
                        includeDiscounts,
                        shoppingCartItem.Quantity);
                }
            }

            finalPrice = Math.Round(finalPrice, 2);

            return finalPrice;
        }
開發者ID:netmatrix01,項目名稱:Innocent,代碼行數:40,代碼來源:PriceHelper.cs

示例13: GetSubTotal

 /// <summary>
 /// Gets the shopping cart item sub total
 /// </summary>
 /// <param name="shoppingCartItem">The shopping cart item</param>
 /// <param name="includeDiscounts">A value indicating whether include discounts or not for price computation</param>
 /// <returns>Shopping cart item sub total</returns>
 public static decimal GetSubTotal(ShoppingCartItem shoppingCartItem, bool includeDiscounts)
 {
     var customer = NopContext.Current.User;
     return GetSubTotal(shoppingCartItem, customer, includeDiscounts);
 }
開發者ID:netmatrix01,項目名稱:Innocent,代碼行數:11,代碼來源:PriceHelper.cs

示例14: GetProductVariantImageUrl

 public string GetProductVariantImageUrl(ShoppingCartItem shoppingCartItem)
 {
     string pictureUrl = String.Empty;
     var productVariant = shoppingCartItem.ProductVariant;
     if (productVariant != null)
     {
         var productVariantPicture = productVariant.Picture;
         pictureUrl = this.PictureService.GetPictureUrl(productVariantPicture, this.SettingManager.GetSettingValueInteger("Media.ShoppingCart.ThumbnailImageSize", 80), false);
         if (String.IsNullOrEmpty(pictureUrl))
         {
             var product = productVariant.Product;
             var picture = product.DefaultPicture;
             if (picture != null)
             {
                 pictureUrl = this.PictureService.GetPictureUrl(picture, this.SettingManager.GetSettingValueInteger("Media.ShoppingCart.ThumbnailImageSize", 80));
             }
             else
             {
                 pictureUrl = this.PictureService.GetDefaultPictureUrl(this.SettingManager.GetSettingValueInteger("Media.ShoppingCart.ThumbnailImageSize", 80));
             }
         }
     }
     return pictureUrl;
 }
開發者ID:robbytarigan,項目名稱:ToyHouse,代碼行數:24,代碼來源:Wishlist.ascx.cs

示例15: GetRecurringDescription

 public string GetRecurringDescription(ShoppingCartItem shoppingCartItem)
 {
     string result = string.Empty;
     if (shoppingCartItem.ProductVariant.IsRecurring)
     {
         result = string.Format(GetLocaleResourceString("Wishlist.RecurringPeriod"), shoppingCartItem.ProductVariant.CycleLength, ((RecurringProductCyclePeriodEnum)shoppingCartItem.ProductVariant.CyclePeriod).ToString());
         if (!String.IsNullOrEmpty(result))
             result = "<br />" + result;
     }
     return result;
 }
開發者ID:robbytarigan,項目名稱:ToyHouse,代碼行數:11,代碼來源:Wishlist.ascx.cs


注:本文中的NopSolutions.NopCommerce.BusinessLogic.Orders.ShoppingCartItem類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。