feat: implement product seeding logic from image catalog and add supporting service methods and requests

This commit is contained in:
2026-07-01 09:48:43 -03:00
parent 35384b48ab
commit e78e64ed2e
7 changed files with 99 additions and 47 deletions

View File

@@ -42,6 +42,7 @@ class ProductCatalogFromImagesSeeder extends Seeder
],
'zapatillas_lecoq' => ['price' => 109999, 'stock' => 6],
'zapatillas_topper' => ['price' => 104999, 'stock' => 7],
'pelota_mundial' => ['price' => 45000, 'stock' => 15],
];
/**
@@ -220,6 +221,15 @@ class ProductCatalogFromImagesSeeder extends Seeder
$variantGroup['files']
);
if ($attributeIds->isEmpty()) {
$this->productService->createVariant($product, [
'stock' => $variantGroup['stock'],
'definitions' => [],
'images' => $images,
]);
continue;
}
foreach ($sizes as $size) {
$definitions = [];
@@ -301,6 +311,19 @@ class ProductCatalogFromImagesSeeder extends Seeder
];
}
if ($groupKey === 'pelota_mundial') {
return [
'type' => 'pelota',
'category_name' => 'Accesorios',
'brand_name' => 'Adidas',
'color' => null,
'attribute_codes' => [],
'product_slug' => $groupKey,
'product_name' => 'Pelota Mundial 2026',
'description' => 'Pelota oficial del mundial 2026 sin variantes.',
];
}
$segments = explode('_', $groupKey);
$type = array_shift($segments);