Loading...
Area: Optimizely Commerce
Applies to versions: 14 and higher
Other versions:

Order management

Recommended reading 
Note: This documentation is for the preview version of the upcoming release of CMS 12/Commerce 14/Search & Navigation 14. Features included here might not be complete, and might be changed before becoming available in the public release. This documentation is provided for evaluation purposes only.

The Order Management user interface lets customer representatives manage orders manually when needed. Order Management is available from the Optimizely Commerce top menu.

    ordermanagementscreen.png

    From Order Management you create and modify carts and purchase orders, and access information on customer profiles. See the Optimizely User Guide.

    Extending the search result display

    When adding a new line item to a cart or an order, a user finds the correct one by searching for it. If a product has many variants, the system helps the user select the correct one by displaying variant-specific information (for example size or color) for each search result. However, those properties differ from site to site. The system does a "best guess" by inspecting content types.

    If you want more control over what is shown, use the EPiServer.Commerce.Catalog.IEntryInformation interface. By implementing IEntryInformation, and replacing our default implementation, you can customize which properties are displayed. The interface returns a dictionary that should contain the names of properties to show, as well as a string representation of their value, suitable to be shown to the user.

    In addition to the displayed variant-specific information, each search result contains a More Details link. This link points to the respective product page on the website. To change the URL the link points to, modify the GetProductUrl method and register the IEntryInformation class with [ServiceConfiguration(typeof(IEntryInformation), Lifecycle = ServiceInstanceScope.Singleton)].

    public class CustomEntryInformation : IEntryInformation
    {   
        IRelationRepository _relationRepository = ServiceLocation.ServiceLocator.Current.GetInstance<IRelationRepository>();
        IUrlResolver _urlResolver = ServiceLocation.ServiceLocator.Current.GetInstance<IUrlResolver>();
    
        IEntryInformation _defaultImplementation;
        public CustomEntryInformation(IEntryInformation defaultImplementation)
        {
            _defaultImplementation = defaultImplementation;
        }
    
        public IDictionary<string, string> GetCustomProperties(EntryContentBase entry)
        {
            var myVariant = entry as MyVariant;
            if (myVariant == null)
            {
                return _defaultImplementation.GetCustomProperties(entry);
            }
    
            return new Dictionary<string, string>() {
                { nameof(myVariant.Size), myVariant.Size.ToString() },
                { nameof(myVariant.Color), myVariant.Color } };
         }
    
         public string GetProductUrl(EntryContentBase entry)
         {
             var productLink = entry is VariationContent ?  
             entry.GetParentProducts(_relationRepository).FirstOrDefault() : entry.ContentLink;
             if (productLink == null)
             {
                return string.Empty;
             }
    
             var urlBuilder = new UrlBuilder(_urlResolver.GetUrl(productLink));
             if (entry.Code != null)
             {
                urlBuilder.QueryCollection.Add("variationCode", entry.Code);
             }
    
             return urlBuilder.ToString();
         }
    }
    
    public class MyVariant : VariationContent
    {
        public virtual int Size { get; set; }
        public virtual string Color { get; set; }
        public virtual int IntegrationCode { get; set; }
    }

    Related topics

    Do you find this information helpful? Please log in to provide feedback.

    Last updated: Jul 02, 2021

    Recommended reading