Add order row
This article describes how to customise how order rows are added into the order carrier in the checkout flow plugin.
The default implementation fetches the list price for the article, and uses the article display name as the order row description. You may change the order row description or comments through customisations.
Customise how an order row is added
- Create a project to override the checkout flow info as described in How to create a checkout flow.
- Extend the OrderRowFactory class to change the way an order row is added.
The following example shows how to change the order row description.
using Litium.Foundation.Modules.ECommerce.Plugins.Orders;
using Litium.Foundation.Modules.ProductCatalog.Plugins.PriceCalculator;
using Litium.Foundation.Modules.ECommerce.Carriers;
using Litium.Foundation.Security;
using System;
namespace Litium.Studio.AddOns.Samples.Checkout
{
/// <summary>
/// Sample order row factory extends the default implementation and adds customized comments.
/// </summary>
public class SampleOrderRowFactory:OrderRowFactory
{
/// <summary>
/// Initializes a new instance of the <see cref="SampleOrderRowFactory" /> class.
/// </summary>
public SampleOrderRowFactory(IPriceCalculator priceCalculator) : base(priceCalculator) { }
public override OrderRowCarrier Create(ShoppingCartItemCarrier shoppingCartRow, Guid websiteId, Guid currencyId, Guid customerId, SecurityToken token)
{
//use base class default implementation to create the order row.
var orderRowCarrier = base.Create(shoppingCartRow, websiteId, currencyId, customerId, token);
//Do customizations here.
//For e.g. change comments and description.
orderRowCarrier.Comments = "Changed by sample code!";
orderRowCarrier.OrderRowDescription += " sample";
return orderRowCarrier;
}
}
}