Developer forum

Forum » Dynamicweb 10 » Data integration import - Mismatch EcomProduct columns and EcomProducFields

Data integration import - Mismatch EcomProduct columns and EcomProducFields

Barend Mosch
Reply

Hi there,

I'm having an issue where we're importing new custom ProductFields via the data integration and using a custom provider as source and the Dynamicweb Provider as destination.
The productFields are correctly imported (they are visible in the EcomProductField and in the environment under 'Global custom fields'.

The product design or configuration has not been updated after the integration job, so there is a difference between the amount of productfields and columns on the EcomProducts table.

Trying to open a group in the PIM results in an undefined error

Saving a newly made custom field does create the column in the EcomProducts. Is there a way to make this automated?
For example: 
'ProductState' is added a custom field, which is not there in the EcomProducts design



Also found this issue using the excel provider as source and importing 1 test productField.
DW 10.15.13
Kind regards!
Barend Mosch,
Bluedesk


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Barend,
the custom fields creation at import is present in the XML provider so you can consider to use that provider as a source. There is a "config" xml section for the custom fields creation.
BR, Dmitrij

 
Barend Mosch
Reply

Thanks Dmitriy, I'll see if that works for a more generic solution. Wasn't aware of the config section.

The import in question uses a custom sourcedata integration build in code that connects to an API and sets up the mapping from the API data. So changing the source is not a possibility.

Is there another way to import ProductFields directly to the database while also changing the EcomProducts design? Im noticing the EcomProducts columns are getting updated whenever a custom field is saved (via the backend or API), so Im thinking about using the API to create the fields, instead of the data integration, but still would prefer the data integration.

Can the data integration trigger an save on each of the affected record?

Kind regards

 
Barend Mosch
Reply

Thanks Dmitriy, I'll see if that works for a more generic solution. Wasn't aware of the config section.

The import in question uses a custom sourcedata integration build in code that connects to an API and sets up the mapping from the API data. So changing the source is not a possibility.

Is there another way to import ProductFields directly to the database while also changing the EcomProducts design? Im noticing the EcomProducts columns are getting updated whenever a custom field is saved (via the backend or API), so Im thinking about using the API to create the fields, instead of the data integration, but still would prefer the data integration.

Can the data integration trigger an save on each of the affected record?

Kind regards

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply
This post has been marked as an answer

Hi Barend,
you can use this sample code to create the product custom field before the import:

using System;
using System.Linq;
using System.Xml;
using Dynamicweb.Core;
using Dynamicweb.Ecommerce.Orders;
using Dynamicweb.Ecommerce.Products;
private static void ImportProductField()
        {
            var productField = new ProductField();            
            productField.Name = "Custom Field Name";            
            productField.SystemName = "Custom Field SystemName";            
            productField.TemplateName = "Custom Field TemplateName";
            //https://doc.dynamicweb.com/Default.aspx?ID=12900#21220
            var typeid = 1; //Text
            productField.TypeId = Converter.ToInt32(typeid);
            productField.Save(string.Empty);
        }

BR, Dmitrij

Votes for this answer: 1
 
Barend Mosch
Reply

Hey Dmitriy,

Yes, using the API, (the above code) should be work. I tested it with another client is this is fine. Although, this replaces the adding the productfields via the data integration, is that correct?


Thanks!

 

 

You must be logged in to post in the forum