本文整理汇总了C#中ExtendedDataCollection.DefinesProductVariant方法的典型用法代码示例。如果您正苦于以下问题:C# ExtendedDataCollection.DefinesProductVariant方法的具体用法?C# ExtendedDataCollection.DefinesProductVariant怎么用?C# ExtendedDataCollection.DefinesProductVariant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExtendedDataCollection
的用法示例。
在下文中一共展示了ExtendedDataCollection.DefinesProductVariant方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddItem
/// <summary>
/// Adds a <see cref="ProductVariantDisplay"/> to the item cache
/// </summary>
/// <param name="productVariant">
/// The product variant to be added
/// </param>
/// <param name="name">
/// The name.
/// </param>
/// <param name="quantity">
/// The quantity to be represented
/// </param>
/// <param name="extendedData">
/// The extended Data.
/// </param>
public void AddItem(ProductVariantDisplay productVariant, string name, int quantity, ExtendedDataCollection extendedData)
{
if (EnableDataModifiers)
{
var attempt = _productDataModifier.Value.Modify(productVariant);
if (attempt.Success)
{
var modified = attempt.Result as ProductVariantDisplay;
if (modified != null)
{
extendedData.MergeDataModifierLogs(modified);
if (!extendedData.DefinesProductVariant()) extendedData.AddProductVariantValues(modified);
productVariant = modified;
}
}
}
else
{
extendedData.MergeDataModifierLogs(productVariant);
if (!extendedData.DefinesProductVariant()) extendedData.AddProductVariantValues(productVariant);
}
var price = productVariant.OnSale ? extendedData.GetSalePriceValue() : extendedData.GetPriceValue();
AddItem(string.IsNullOrEmpty(name) ? productVariant.Name : name, productVariant.Sku, quantity, price, extendedData);
}
示例2: AddItem
/// <summary>
/// Adds a line item to the wish list
/// </summary>
/// <param name="productVariant">
/// The product Variant.
/// </param>
/// <param name="name">
/// The name.
/// </param>
/// <param name="quantity">
/// The quantity.
/// </param>
/// <param name="extendedData">
/// The extended Data.
/// </param>
public void AddItem(IProductVariant productVariant, string name, int quantity, ExtendedDataCollection extendedData)
{
if (!extendedData.DefinesProductVariant()) extendedData.AddProductVariantValues(productVariant);
var onSale = productVariant.OnSale ? extendedData.GetSalePriceValue() : extendedData.GetPriceValue();
AddItem(string.IsNullOrEmpty(name) ? productVariant.Name : name, productVariant.Sku, quantity, onSale, extendedData);
}
示例3: AddItem
/// <summary>
/// Adds a line item to the basket
/// </summary>
public void AddItem(IProductVariant productVariant, string name, int quantity, ExtendedDataCollection extendedData)
{
if(!extendedData.DefinesProductVariant()) extendedData.AddProductVariantValues(productVariant);
AddItem(
string.IsNullOrEmpty(name) ? productVariant.Name : name,
productVariant.Sku,
quantity,
productVariant.OnSale ?
extendedData.GetSalePriceValue()
: extendedData.GetPriceValue(), extendedData); // get the price information from extended data in case it has been overriden
//productVariant.SalePrice.Value : productVariant.Price
}