Compare commits

..

2 Commits

Author SHA1 Message Date
fe2a77e995 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>
2026-02-24 14:11:50 +01:00
f0b1152ab1 build: update package v0.321
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 14:00:08 +01:00
6 changed files with 46 additions and 11 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'])) {

View File

@@ -507,7 +507,7 @@ class ProductsApiController
continue;
}
$d['custom_field_name'][] = (string)$cf['name'];
$d['custom_field_type'][] = isset($cf['type']) ? (string)$cf['type'] : 'text';
$d['custom_field_type'][] = !empty($cf['type']) ? (string)$cf['type'] : 'text';
$d['custom_field_required'][] = !empty($cf['is_required']) ? 1 : 0;
}
}

BIN
updates/0.30/ver_0.321.zip Normal file

Binary file not shown.

View File

@@ -0,0 +1,23 @@
{
"changelog": "NEW - API: obsługa custom_fields w create/update produktu",
"version": "0.321",
"files": {
"added": [
],
"deleted": [
],
"modified": [
"autoload/api/Controllers/ProductsApiController.php"
]
},
"checksum_zip": "sha256:a04ac9975618bc3b21d80a8e449f98e5bc825ce49a37142e1e621a2ef34a19f1",
"sql": [
],
"date": "2026-02-24",
"directories_deleted": [
]
}

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
<?
$current_ver = 321;
$current_ver = 322;
for ($i = 1; $i <= $current_ver; $i++)
{