ver. 0.322: fix custom_fields — jawne mapowanie kluczy w ProductRepository, spójne !empty w ProductsApiController

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-24 14:11:50 +01:00
parent f0b1152ab1
commit fe2a77e995
3 changed files with 12 additions and 3 deletions

View File

@@ -737,7 +737,16 @@ class ProductRepository
// Custom fields (Dodatkowe pola)
$customFields = $this->db->select('pp_shop_products_custom_fields', ['name', 'type', 'is_required'], ['id_product' => $id]);
$result['custom_fields'] = is_array($customFields) ? $customFields : [];
$result['custom_fields'] = [];
if (is_array($customFields)) {
foreach ($customFields as $cf) {
$result['custom_fields'][] = [
'name' => $cf['name'],
'type' => !empty($cf['type']) ? $cf['type'] : 'text',
'is_required' => $cf['is_required'],
];
}
}
// Variants (only for parent products)
if (empty($product['parent_id'])) {