ver. 0.321: API produkty — obsługa custom_fields w create/update
- ProductsApiController: parsowanie custom_fields z body (name, type, is_required) - Zaktualizowano docs/API.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -497,6 +497,21 @@ class ProductsApiController
|
||||
$d['products_related'] = $body['products_related'];
|
||||
}
|
||||
|
||||
// Custom fields (Dodatkowe pola)
|
||||
if (isset($body['custom_fields']) && is_array($body['custom_fields'])) {
|
||||
$d['custom_field_name'] = [];
|
||||
$d['custom_field_type'] = [];
|
||||
$d['custom_field_required'] = [];
|
||||
foreach ($body['custom_fields'] as $cf) {
|
||||
if (!is_array($cf) || empty($cf['name'])) {
|
||||
continue;
|
||||
}
|
||||
$d['custom_field_name'][] = (string)$cf['name'];
|
||||
$d['custom_field_type'][] = isset($cf['type']) ? (string)$cf['type'] : 'text';
|
||||
$d['custom_field_required'][] = !empty($cf['is_required']) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
return $d;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user