本文整理汇总了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;
}
示例2: GetProductVariantName
public string GetProductVariantName(ShoppingCartItem shoppingCartItem)
{
ProductVariant productVariant = shoppingCartItem.ProductVariant;
if (productVariant != null)
return productVariant.FullProductName;
return "Not available";
}
示例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(" ");
sb.Append(discountString);
}
return sb.ToString();
}
示例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;
}
示例5: GetProductUrl
public string GetProductUrl(ShoppingCartItem shoppingCartItem)
{
var productVariant = shoppingCartItem.ProductVariant;
if (productVariant != null)
return SEOHelper.GetProductUrl(productVariant.ProductId);
return string.Empty;
}
示例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);
}
示例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();
}
示例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(" ");
sb.Append(discountString);
}
}
return sb.ToString();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}