Posted on 21/12/2021 09:05:45
Hi Martin,
yes, you can keep the DynamicwebLiveIntegration dll and use the extensibility points from it.
You can create the Custom Product fields in Dynamicweb and then Enable the sending Custom Product fields in the request in the Live integration setttings,
so once the custom fields are populated in the BC and are present in the reponse then they automatically will be stored back in the Live integration
productInfo[productField.SystemName] object, so you can then access it in the newly created Ecommerce.Products.ProductTemplateExtender by the coed like this:
using Dynamicweb.Ecommerce.Integration;
using Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Configuration;
using Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Products;
using Dynamicweb.Ecommerce.Prices;
using Dynamicweb.Rendering;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Dynamicweb.Ecommerce.DynamicwebLiveIntegration.TemplateExtenders
{
/// <summary>
///
/// </summary>
public class ProductTemplateExtender : Ecommerce.Products.ProductTemplateExtender
{
/// <summary>
///
/// </summary>
/// <param name="template"></param>
public override void ExtendTemplate(Template template)
{
if (template.TagExists("YourTagName"))
{
if (Global.IsIntegrationActive)
{
var productInfo = ProductManager.GetProductInfo(Product);
if(productInfo != null) {
string customFieldValue = productInfo["ProductFieldSystemName"].ToString();
template.SetTag("YourTagName", customFieldValue);
}
}
}
}
In the BC exension you can subscribe to those events in order to add your custom fields values:
ProductsPublisher.OnAddItemCustomerOnBeforeAddItemUOM(item, pXmlNode, node); //This is available only in the last released 1.2.0.20 version
OR
ProductsPublisher.OnAddProductInfoXmlNode(pXmlNode, item, customer);
then in one of those subscribers you will need to modify the
pXmlNode
so fill the custom fields xml tags with the appropriate BC values using the AL XML functions.
BR, Dmitrij