$data = '{
"items": [{
"description": "Какое то описание",
"category_id": 78302015,
"name": "Laci 68000009",
"offer_id": "9220156399",
"price": "6293",
"old_price": "8990",
"premium_price": "5977",
"vat": "0",
"vendor": "Laci",
"height": 80,
"depth": 60,
"width": 170,
"dimension_unit": "mm",
"weight": 100,
"weight_unit": "g",
"images": [
{
"file_name": "/upload/iblock/cf6/cf6f3dced5f3eb83470685728fe519fb.jpg",
"default": true
}
],
"attributes": [
{
"id": 8229,
"value": "3263"
},
{
"id": 9163,
"collection": [
"1",
"2"
]
},
{
"id": 9725,
"value": "24"
},
{
"id": 9390,
"value": "1"
},
{
"id": 4384,
"value": "Подарок"
},
{
"id": 4385,
"value": "1 год"
},
{
"id": 4389,
"value": "161"
},
{
"id": 6586,
"collection": [
"5"
]
},
{
"id": 8016,
"value": "56"
},
{
"id": 8020,
"value": "140"
},
{
"id": 8022,
"value": "18"
},
{
"id": 9048,
"value": "02899/S MYC"
},
{
"id": 9751,
"value": "9"
}
]
}]
}';
$my_array['items'] = array(
'description' => $description,
'category_id' => $category_id,
'name' => $name,
'offer_id' => $offer_id,
'price' => $price,
'old_price' => $old_price,
'premium_price' => $premium_price,
'vat' => '0',
'vendor' => $vendor,
'height' => '80',
'depth' => '60',
'width' => '170',
'dimension_unit' => 'mm',
'weight' => '100',
'weight_unit' => 'g',
'images' => array('file_name' => $img, 'default' => 'true'),
'attributes'=> array (
array('id' => '8229', 'value' => '3263'),
array('id' => '9163', 'collection' => array(1, 2)),
array('id' => '9725', 'value' => '24'),
array('id' => '9390', 'value' => '1'),
array('id' => '4384', 'value' => 'Подарок'),
array('id' => '4385', 'value' => '1 год'),
array('id' => '4389', 'value' => $country),
array('id' => '6586', 'collection' => $color),
array('id' => '8016', 'value' => $shirina),
array('id' => '8020', 'value' => $zau),
array('id' => '8022', 'value' => $per),
array('id' => '9048', 'value' => $model),
array('id' => '9751', 'value' => $vid)
)
);
$data = json_encode($my_array);
PS: Совет на самом деле очень спорный. Может привести к быстрой утомляемости, выгоранию. В начале деятельности это работает, но потом может привести к вышесказанному.