Developer forum

Forum » Development » Creating product fields

Creating product fields

Aki Ruuskanen
Aki Ruuskanen
Reply

Hi,

We are going to add a bunch of custom product fields. And we need to create those product fields for several exisiting solutions. 

Is there any CreateField() method somwhere in the API? I tried to search but could not find anything?

Regards / Aki

 


Replies

 
Dmitriy Benyuk
Reply
This post has been marked as an answer

Hi Aki,
yes, you could use the Dynamicweb.eCommerce.Products.ProductField class for that.
Here is a sample code for creating a new field:

var productField = new ProductField();            
productField.Name = "SomeFieldName";
productField.SystemName = "SomeFieldSystemName"; //must be unique for different fields
productField.TemplateName = "TemplateName";

//look into the table [EcomFieldType] for the available [FieldTypeID] values
productField.TypeID = 1;//1 is Text (255)
//save new field to database
productField.Save("0");

Regards, Dmitrij

Votes for this answer: 1
 
Aki Ruuskanen
Aki Ruuskanen
Reply

Thanks .

/Aki

 

You must be logged in to post in the forum