Developer forum

Forum » Integration » Import category fields from CSV

Import category fields from CSV

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

I have a CSV file in the following format:

Product ID      Height      Width      Metric
1234            123         234        Yes
2345            456         100        Yes
9033            190         200        No

In reality, I have many different CSV files with many columns, all that differ per CSV.

I would like to import this data to Product Category fields. What is the best solution to do this? If I use CSV => EcomProvider, I need to an import job per column per CSV file which is an awful lot of work. I tried creating multiple table mappings to the same source within a job (so I could map Height, Width and Metric all in one go) but it's only picking up the first table mapping. Even if this would work, it would be a lot of work to set up.

Any suggestions? Should I convert my data to some other format (i.e. row based per product/column combination) and if so, has anyone done that before and would like to share the implementation?

Thanks!


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Imar,
the Product Category fields import was implemented in XML->Ecom provider scenario in tfs# 26772.
So you can create category fields in some category on the fly by defining them in the config section:
<config>
<categoryField id="CategoryField1" templateTag="CategoryField1Tag" label="Category Field1" categoryId="MyCategory" typeId="1" />
<categoryField id="CategoryField2" templateTag="CategoryField2Tag" label="Category Field2" categoryId="MyCategory" typeId="1" />
</config>
this will create MyCategory if it donesn't exist and will create two category fields in it.

Then in Ecom provider you should have a mapping to "EcomProductCategoryFieldValue" table with columns mappings:
FieldValueFieldId, FieldValueProductId OR FieldValueProductNumber (also but not required FieldValueProductLanguageId  - if not present will use DefaultLangiageID, FieldValueProductVariantId - if not present blank value is used)

Also a feature for multiple files import to the same destination table is going to be implemented for XML -> SQL/Dynamicweb/Ecom in tfs# 28696 for 9.2 release.

Regards, Dmitrij

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Dmitriy,

Thanks for that. Although very useful information, it doesn't address the original topic. I have a CSV file, not an XML file. And I think the biggest issue I have is the fact that my category fields are columns, not rows. It would be great if we had some kind of provider that I could point to my CSV file and then tell it to treat each column as a category field so I don't have to create rows first. Does that sound reasonable?

For the time being, is there something you can recommend to make this work? I can supply you a sample CSV if that's helpful?

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Imar,
yes, that is not implemented.
For now I can see some ways like this:
CSV -> XML -> write XSLT to make suitable rows -> import to Ecom
Or
some own csutom app that transforms CSV column based to CSV/XML row based

 
Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply

I would like to add my vote to this too. It came up a couple times recently and it's very time consuming for us to pivot the table from an Excel spreadsheet. It would be great for a provider to take care of all of that plumbing.

I would envision that it would have to be something like this:

  • A provider called ProductCategoryField Provider
  • The table choices would actually be Product Categories (e.g. Clothing)
  • The left-hand side would be the columns in the source (e.g. Excel columns, like Material or Style)
  • The right-hand side would be the Product Category Fields (also like Material or Style)

This would be very a great addition and something that we would put to good use.

Scott

 

 

You must be logged in to post in the forum