diff --git a/database/seeders/ProductCatalogFromImagesSeeder.php b/database/seeders/ProductCatalogFromImagesSeeder.php index 78ff1f7..8f144d0 100644 --- a/database/seeders/ProductCatalogFromImagesSeeder.php +++ b/database/seeders/ProductCatalogFromImagesSeeder.php @@ -31,6 +31,7 @@ class ProductCatalogFromImagesSeeder extends Seeder 'variant_groups' => [ 'pantalon_blanco' => ['stock' => 14], 'pantalon_negro' => ['stock' => 14], + 'pantalon_azul' => ['stock' => 0], ], ], 'remera' => [ @@ -38,6 +39,7 @@ class ProductCatalogFromImagesSeeder extends Seeder 'variant_groups' => [ 'remera_blanca' => ['stock' => 22], 'remera_negra' => ['stock' => 22], + 'remera_azul' => ['stock' => 0], ], ], 'zapatillas_lecoq' => ['price' => 109999, 'stock' => 6], @@ -261,8 +263,23 @@ class ProductCatalogFromImagesSeeder extends Seeder 'value' => $size, ]; + // Override stock for specific variants as requested by the user + $stock = $variantGroup['stock']; + $productType = $metadata['type']; + $color = $variantGroup['metadata']['color']; + + if ($productType === 'remera' && $color === 'Blanco' && $size === 'L') { + $stock = 0; + } elseif ($productType === 'remera' && $color === 'Negro' && $size === 'S') { + $stock = 0; + } elseif ($productType === 'pantalon' && $color === 'Negro' && $size === 'XL') { + $stock = 0; + } elseif ($productType === 'pantalon' && $color === 'Blanco' && $size === 'M') { + $stock = 0; + } + $this->productService->createVariant($product, [ - 'stock' => $variantGroup['stock'], + 'stock' => $stock, 'definitions' => $definitions, 'images' => $images, ]); @@ -334,7 +351,7 @@ class ProductCatalogFromImagesSeeder extends Seeder $color = null; $brandSegments = $segments; - if (isset($segments[0]) && in_array($segments[0], ['blanco', 'blanca', 'negro', 'negra', 'gris'], true)) { + if (isset($segments[0]) && in_array($segments[0], ['blanco', 'blanca', 'negro', 'negra', 'gris', 'azul'], true)) { $color = $this->normalizeColor($segments[0]); $brandSegments = array_slice($segments, 1); } @@ -384,6 +401,7 @@ class ProductCatalogFromImagesSeeder extends Seeder 'blanco', 'blanca' => 'Blanco', 'negro', 'negra' => 'Negro', 'gris' => 'Gris', + 'azul' => 'Azul', default => throw new RuntimeException("Unsupported color '{$color}'."), }; } diff --git a/storage/public/catalog/pantalon_azul.png b/storage/public/catalog/pantalon_azul.png new file mode 100644 index 0000000..47b9a4f Binary files /dev/null and b/storage/public/catalog/pantalon_azul.png differ diff --git a/storage/public/catalog/remera_azul.webp b/storage/public/catalog/remera_azul.webp new file mode 100644 index 0000000..3a3e4d9 Binary files /dev/null and b/storage/public/catalog/remera_azul.webp differ