Product import

This commit is contained in:
2026-08-28 13:57:54 +02:00
parent 7442d10e68
commit 7833e1b668
21 changed files with 763 additions and 185 deletions

View File

@@ -40,6 +40,13 @@ foreach ($parsed['components'] as $c) {
);
}
echo "\n--- Composed sources (g:) ---\n";
foreach (($reader->sources($parsed)['Composed'] ?? []) as $entry) {
echo $entry['selector'] . "\n";
echo " label: " . $entry['label'] . "\n";
echo " html : " . $entry['value'] . "\n\n";
}
echo "\n--- Related Product Cards, raw ---\n";
foreach ($parsed['components'] as $c) {
if ($c['component'] !== 'Related Product Card') {

View File

@@ -0,0 +1,51 @@
<?php
declare(strict_types=1);
/**
* One-shot: clear the SAVED field mapping of the product-text import
* (tx_vitec_import_mapping, model "product_xlsx") so the corrected
* DEFAULT_MAPPING seed applies again.
*
* Deliberately clears ONLY the `mapping` column - the same row also stores
* `record_aliases` (the editor's manual related-product matches), and those
* must survive.
*
* Usage: php migrations/reset_product_mapping.php
*/
$root = null;
$dir = __DIR__;
for ($i = 0; $i < 5; $i++) {
if (is_file($dir . '/config/system/settings.php')) {
$root = $dir;
break;
}
$dir = dirname($dir);
}
if ($root === null) {
exit("Could not locate project root above " . __DIR__ . "\n");
}
$settings = require $root . '/config/system/settings.php';
$db = $settings['DB']['Connections']['Default'];
$pdo = new PDO(
sprintf('mysql:host=%s;port=%s;dbname=%s;charset=utf8mb4', $db['host'] ?? 'localhost', $db['port'] ?? 3306, $db['dbname'] ?? ''),
$db['user'] ?? '',
$db['password'] ?? '',
[PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC]
);
$row = $pdo->query("SELECT uid, mapping, record_aliases FROM tx_vitec_import_mapping WHERE model = 'product_xlsx'")->fetch();
if (!$row) {
exit("No row for model 'product_xlsx' - nothing to clear, defaults apply already.\n");
}
echo "Row uid " . $row['uid'] . "\n";
echo " mapping (cleared) : " . ($row['mapping'] ?: '(empty)') . "\n";
echo " aliases (KEPT) : " . ($row['record_aliases'] ?: '(empty)') . "\n";
$pdo->prepare("UPDATE tx_vitec_import_mapping SET mapping = '', tstamp = ? WHERE model = 'product_xlsx'")
->execute([time()]);
echo "Done - the saved field mapping is cleared, the corrected defaults apply on the next preview.\n";