Developer forum

Forum » Development » Custom Modul - Product Import Error

Custom Modul - Product Import Error

Kevin Krämer
Reply

Hi

I have created an application that imports products from an CSV file. Since i have direct access to the database i thought that it would be easier and faster to save it directly in the database. Everything worked fine until now, where i need to manually create a product. Now i get the error that it can't save the product because the id already exist in the database. 

It seems that the id's are generated somewhere else, but i cant figuere out where.

 

- Kevin


Replies

 
Mikkel Ricky
Reply

Do you have any specific reasons for not using the Data Integrations module in Dynamicweb? This module can import (and export) products (and everything else) in Dynamicweb from csv files and other data sources.

Best regards,
Mikkel

 
Kevin Krämer
Reply

As i wrote before, i had direct access to the database, and because i only have worked with DynamicWeb the last 3 months, was it easier for me this way. Also the import only need to run once, and then never againg. So there was no need to go in depth with the data integration module ..

 

- Kevin 

 
Morten Snedker
Reply
This post has been marked as an answer

Hi Kevin,

 

The Data Integration module has its base idea in the way import/export works with SQL Server Management Studio. So the learning curve is quite low. But that aside:

A product has the the composite key ProductID+ProductLanguageID+ProductVariantID. When you create a product in the backend of Dynamicweb, standard behaviour is that ProductID is a "PROD" prefix and then a number, ie "PROD123". The next number for a product is retrieved from table EcomNumbers.

From this table (EcomNumbers) you may locate row with NumberType="PROD" and raise the number in column "NumberCounter".

Also, the "PROD" prefix can be changed as well from this table. Finally, there are no rules for what is allowed as ProductID, so when importing you may call it anything that can be contained within the nvarchar.

Let me know if this helps.

 

Regards /Snedker

Votes for this answer: 1
 
Kevin Krämer
Reply

Good to know .. I fixed by changing the prefix of the products .. Thanks.

 

- Kevin

 

You must be logged in to post in the forum