//fill in additional values (not existing in the entity)
orderItemModel.Sku = _productService.FormatSku(orderItem.Product, orderItem.AttributesXml);
@if (!string.IsNullOrEmpty(item.Sku))
{
<p>
<strong>@T("Admin.Orders.Products.SKU")</strong><text>:</text>
@item.Sku
</p>
}
protected virtual void GetSkuMpnGtin(Product product, string attributesXml,
out string sku, out string manufacturerPartNumber, out string gtin)
{
if (product == null)
throw new ArgumentNullException(nameof(product));
sku = null;
manufacturerPartNumber = null;
gtin = null;
if (!string.IsNullOrEmpty(attributesXml) &&
product.ManageInventoryMethod == ManageInventoryMethod.ManageStockByAttributes)
{
//manage stock by attribute combinations
//let's find appropriate record
var combination = _productAttributeParser.FindProductAttributeCombination(product, attributesXml);
if (combination != null)
{
sku = combination.Sku;
manufacturerPartNumber = combination.ManufacturerPartNumber;
gtin = combination.Gtin;
}
}
if (string.IsNullOrEmpty(sku))
sku = product.Sku;
if (string.IsNullOrEmpty(manufacturerPartNumber))
manufacturerPartNumber = product.ManufacturerPartNumber;
if (string.IsNullOrEmpty(gtin))
gtin = product.Gtin;
}