Posted on 30/10/2023 09:14:19
Hi Dimitri.
I want to try to normalize the table imports as much as possible so there is less need for a ton of business logic between the ERP and the CSV files. I figured that if I can make a tablescript which performs lookups on the EcomVariantOptions table (using the incoming fieldvalue that you put the tablescript onto), then you only need to import the EcomProducts.csv and the mapping of variants "VariantOptions" and "VariantOptionsProductRelations" will be performed by the table script itself.
Does that make any sense?
E.g CSV import file
ProductID, ProductName, EAN, Weight, Color
When performing mapping I specify the "VariantHandler" table script for both Weight and Color columns.
That script will then take the value of that rowcolumn, and do a "Select VariantOptionId from EcomVariantOptions where VariantOptionLanguageID = 'LANG1' and VariantOptionName = @rowcolumnvalue".
Based on that result, I will either create a new entry for the incoming value and get the VariantOptionId or use the one retrieved in the select, and then add the relation to the product in EcomVariantOptionsProductRelation
Isnt that a good way to go, or do you see some disadvantages with this approach?