Posted on 29/06/2022 16:28:19
							
							
						 
							Hi Martin,
yes, you can use the Live integration subscribers.
In the Live integration you can implement the custom product provider like that for the getting specific product information requests:
using Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Configuration;
using Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Products;
using Dynamicweb.Ecommerce.Integration;
using Dynamicweb.Ecommerce.Prices;
using Dynamicweb.Ecommerce.Products;
namespace Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Examples
{
    /// <summary>
    /// Class CustomProductProvider.
    /// </summary>
    /// <seealso cref="Products.ProductProviderBase" />
    public class CustomProductProvider : ProductProviderBase
    {
        /// <summary>
        /// Gets the product identifier.
        /// </summary>
        /// <param name="product">The product.</param>
        /// <returns>System.String.</returns>
        public override string GetProductIdentifier(Settings settings, Product product)
        {
            return GetProductIdentifier(settings, product, null);
        }
        /// <summary>
        /// Gets the product identifier.
        /// </summary>
        /// <param name="product">The product.</param>
        /// <param name="unitId">The product unit Id.</param>
        /// <returns>System.String.</returns>
        public override string GetProductIdentifier(Settings settings, Product product, string unitId)
        {
            string unit = string.IsNullOrEmpty(unitId) ? string.Empty : $"-{unitId}";
            return $"{product.Id}-{product.LanguageId}-{product.Number}{unit}";
        }
    }
}
For the order requests you need to subscribe to:
Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Notifications.Orders.OnAfterGenerateOrderXml
and have the code like that to change the variant id string in the output xml nodes:
using Dynamicweb.Extensibility.Notifications;
using Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Notifications;
using Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Configuration;
using System.Xml;
namespace Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Examples.Notifications
{
    /// <summary>
    /// Class OrderAfterGenerateXmlSubscriber.
    /// </summary>
    /// <seealso cref="NotificationSubscriber" />
    [Subscribe(Order.OnAfterGenerateOrderXml)]
    public class OrderAfterGenerateXmlSubscriber : NotificationSubscriber
    {
        /// <summary>
        /// Call to invoke observer.
        /// </summary>
        /// <param name="notification">The notification.</param>
        /// <param name="args">The args.</param>
        public override void OnNotify(string notification, NotificationArgs args)
        {
            var myArgs = (Order.OnAfterGenerateOrderXmlArgs)args;            
            if (myArgs?.Document != null)
            {
                var settings = SettingsManager.GetSettingsByShop(myArgs.Order.ShopId);
                if (settings != null && !settings.ErpControlsShipping)
                {
                    var order = myArgs.Order;
                    var shipping = Services.Shippings.GetShipping(order.ShippingMethodId);
                    if (shipping != null)
                    {
                        var nodes = myArgs.Document.SelectNodes("//item [@table='EcomOrders']/column[@columnName='OrderLineProductVariantId']");
                        if (nodes != null)
                        {
                            // TODO: Add code here to remove node text
                        }
                    }
                }
            }
        }
    }
}
BR, Dmitrij