diff --git a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Dynamicweb.Ecommerce.DynamicwebLiveIntegration.csproj b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Dynamicweb.Ecommerce.DynamicwebLiveIntegration.csproj index c96f75e..792b6a2 100644 --- a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Dynamicweb.Ecommerce.DynamicwebLiveIntegration.csproj +++ b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Dynamicweb.Ecommerce.DynamicwebLiveIntegration.csproj @@ -1,6 +1,6 @@  - 10.21.5 + 10.21.6 1.0.0.0 Live Integration Live Integration diff --git a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/XmlGenerators/OrderXmlGenerator.cs b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/XmlGenerators/OrderXmlGenerator.cs index 1287a1a..632c4a4 100644 --- a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/XmlGenerators/OrderXmlGenerator.cs +++ b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/XmlGenerators/OrderXmlGenerator.cs @@ -336,7 +336,7 @@ private void CreateOrderLineXml(Settings currentSettings, XmlNode orderLinesNode AddChildXmlNode(itemNode, "OrderLineBomItemId", orderline.BomItemId); AddChildXmlNode(itemNode, "OrderLineGiftCardCode", orderline.GiftCardCode); AddChildXmlNode(itemNode, "OrderLineIsGiftCardDiscount", (!string.IsNullOrEmpty(orderline.GiftCardCode)).ToString(), isCustomField: true); - AddChildXmlNode(itemNode, "OrderLineFieldValues", OrderLineFieldValuesToXml(orderline.OrderLineFieldValues).InnerXml); + AddChildXmlNode(itemNode, "OrderLineFieldValues", OrderLineFieldValuesToXml(orderline.OrderLineFieldValues).DocumentElement); if (!settings.ErpControlsDiscount && orderline.IsDiscount()) { AddChildXmlNode(itemNode, "OrderLineDiscountId", orderline.DiscountId); diff --git a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/XmlGenerators/XmlGenerator.cs b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/XmlGenerators/XmlGenerator.cs index cf1b69d..fc55d3f 100644 --- a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/XmlGenerators/XmlGenerator.cs +++ b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/XmlGenerators/XmlGenerator.cs @@ -38,6 +38,26 @@ protected static void AddChildXmlNode(XmlElement parent, string nodeName, string parent.AppendChild(node); } + protected static void AddChildXmlNode(XmlElement parent, string nodeName, XmlNode nodeValue, bool isInformationalOnly = false, bool isCustomField = false) + { + if (parent.OwnerDocument == null) + { + throw new InvalidOperationException("Cannot call this method without an xml document associated with the parent element."); + } + + var node = parent.OwnerDocument.CreateElement("column"); + node.SetAttribute("columnName", nodeName); + + Dictionary attributes = BuildAttributes(isInformationalOnly, isCustomField); + foreach (var attribute in attributes) + { + node.SetAttribute(attribute.Key, attribute.Value); + } + + node.AppendChild(parent.OwnerDocument.ImportNode(nodeValue, deep: true)); + parent.AppendChild(node); + } + /// /// Builds the XML document. ///