/// <summary> /// Overrides the creation of <see cref="StoreLineItemModel"/>. /// </summary> /// <param name="lineItem"> /// The <see cref="StoreLineItemModel"/>. /// </param> /// <param name="item"> /// The <see cref="ILineItem"/>. /// </param> /// <returns> /// The modified <see cref="StoreLineItemModel"/>. /// </returns> protected override StoreLineItemModel OnCreate(StoreLineItemModel lineItem, ILineItem item) { if (item.LineItemType == LineItemType.Product) { // Get the product key from the extended data collection // This is added internally when the product was added to the basket var productKey = item.ExtendedData.GetProductKey(); // Get an instantiated IProductContent for use in the basket table design var product = item.LineItemType == LineItemType.Product ? this.GetProductContent(productKey) : null; // Get a list of choices the customer made. This can also be done by looking at the variant (Attributes) // but this is a bit quicker and is something commonly done. var customerChoices = item.GetProductOptionChoicePairs(); // Modifiy the BasketItemModel generated in the base factory lineItem.Product = product; lineItem.ProductKey = productKey; lineItem.CustomerOptionChoices = customerChoices; } return(base.OnCreate(lineItem, item)); }