Skip to main content

Complete the complex attribute

Formats the value in attribute format and adds it to the Attributes array of the collection

Function CompleteComplexAttribute(Collection, Val AttributeID, Val ComplexID, Val Values) Export

ParameterCLI optionTypeRequiredDescription
Collection--objectStructure Of StringComplex attribute structure or product structure
AttributeID--attributeidString, NumberAttribute ID
ComplexID--complexidString, NumberComplex attribute ID
Values--valuesArbitraryValue or array of values to add to Values field

Returns: Structure - A collection enhanced with a new attribute


tip

In 1C the method can be used as a procedure, without getting a return value. Return value is required for CLI version


1C:Enterprise/OneScript code example
    ItemStructure = New Structure;
ItemStructure.Insert("description_category_id", 17028922);
ItemStructure.Insert("name" , "Protective film set for X3 NFC. Dark cotton");
ItemStructure.Insert("offer_id" , "143210608");
ItemStructure.Insert("barcode" , "112772873170");
ItemStructure.Insert("price" , "1000");
ItemStructure.Insert("old_price" , "1100");
ItemStructure.Insert("vat" , "0.1");
ItemStructure.Insert("height" , 250);
ItemStructure.Insert("width" , 150);
ItemStructure.Insert("depth" , 10);
ItemStructure.Insert("dimension_unit" , "mm");
ItemStructure.Insert("weight" , 100);
ItemStructure.Insert("weight_unit" , "g");

CategoryAttribute1 = New Structure("dictionary_value_id,value", 971082156, "Speaker stand");

CategoryAttribute2 = New Structure("value", "Protective film set for X3 NFC. Dark cotton");

OPI_Ozon.CompleteComplexAttribute(ItemStructure, 5076 , 0, CategoryAttribute1);
OPI_Ozon.CompleteComplexAttribute(ItemStructure, 9048 , 0, CategoryAttribute2);
    # JSON data can also be passed as a path to a .json file

oint ozon CompleteComplexAttribute \
--object "{'description_category_id':17028922,'name':'Protective film set for X3 NFC. Dark cotton','offer_id':'143210609','barcode':'112772873170','price':'1300','old_price':'1300','vat':'0.1','height':250,'width':150,'depth':10,'dimension_unit':'mm','weight':100,'weight_unit':'g','images':['https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg','https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture2.jpg'],'complex_attributes':[{'attributes':[{'id':21841,'complex_id':100001,'values':[{'value':'https://rutube.ru/video/c6cc4d620b1d4338901770a44b3e82f4/'}]},{'id':21837,'complex_id':100001,'values':[{'value':'video1'}]}]}]}" \
--attributeid 5076 \
--complexid 0 \
--values "{'dictionary_value_id':971082156,'value':'Speaker stand'}"
Result
{
"description_category_id": 17028922,
"name": "Protective film set for X3 NFC. Dark cotton",
"offer_id": "143210608",
"barcode": "112772873170",
"price": "1000",
"old_price": "1100",
"vat": "0.1",
"height": 250,
"width": 150,
"depth": 10,
"dimension_unit": "mm",
"weight": 100,
"weight_unit": "g",
"attributes": [
{
"id": 5076,
"complex_id": 0,
"values": [
{
"dictionary_value_id": 971082156,
"value": "Speaker stand"
}
]
},
{
"id": 9048,
"complex_id": 0,
"values": [
{
"value": "Protective film set for X3 NFC. Dark cotton"
}
]
}
]
}