This commit is contained in:
2026-04-02 00:17:46 +02:00
parent 34b0a2b4f5
commit 39c318382a
14 changed files with 417 additions and 16 deletions

View File

@@ -71,7 +71,7 @@ final class ShopproOrderMapper
$sourceOrderId = $fallbackOrderId;
}
$sourceCreatedAt = StringHelper::normalizeDateTime((string) $this->readPath($payload, ['created_at', 'date_created', 'date_add']));
$sourceCreatedAt = StringHelper::normalizeDateTime((string) $this->readPath($payload, ['created_at', 'date_created', 'date_add', 'date_order']));
$sourceUpdatedAt = StringHelper::normalizeDateTime((string) $this->readPath($payload, ['updated_at', 'date_updated', 'modified_at', 'date_modified', 'created_at']));
if ($sourceUpdatedAt === null) {
$sourceUpdatedAt = $fallbackUpdatedAt !== '' ? $fallbackUpdatedAt : date('Y-m-d H:i:s');
@@ -577,12 +577,30 @@ final class ShopproOrderMapper
'source_product_set_id' => StringHelper::nullableString((string) ($parentProductId > 0 ? $parentProductId : '')),
'sort_order' => $sort++,
'payload_json' => $row,
'personalization' => $this->extractPersonalization($row),
];
}
return $result;
}
/**
* @param array<string, mixed> $row
*/
private function extractPersonalization(array $row): ?string
{
$raw = $this->readPath($row, ['custom_fields']);
if ($raw === null || $raw === '' || $raw === false) {
return null;
}
$text = str_replace(['<br>', '<br/>', '<br />'], "\n", (string) $raw);
$text = html_entity_decode(strip_tags($text), ENT_QUOTES | ENT_HTML5, 'UTF-8');
$text = trim($text);
return $text !== '' ? $text : null;
}
/**
* @param array<string, mixed> $payload
* @return array<int, array<string, mixed>>