|
|
@@ -307,7 +307,7 @@ class Magento1ProductReader
|
|
|
'cost' => $eav['cost'] ?? '',
|
|
|
'weight' => $eav['weight'] ?? '',
|
|
|
// Magento: 1=Enabled, 2=Disabled. Keep disabled products importable for review matching.
|
|
|
- 'status' => ((int) ($eav['status'] ?? 1) === 1) ? 1 : 0,
|
|
|
+ 'status' => $this->mapMagentoStatus($eav['status'] ?? 1),
|
|
|
'featured' => 0,
|
|
|
'new' => 0,
|
|
|
'guest_checkout' => 1,
|
|
|
@@ -338,6 +338,26 @@ class Magento1ProductReader
|
|
|
return $row;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Magento 1 product status: 1=Enabled, 2=Disabled. Bagisto uses 1/0.
|
|
|
+ */
|
|
|
+ private function mapMagentoStatus(mixed $value): int
|
|
|
+ {
|
|
|
+ $enabled = (int) ($this->config['enabled_status'] ?? 1);
|
|
|
+
|
|
|
+ if (is_numeric($value)) {
|
|
|
+ return (int) $value === $enabled ? 1 : 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ $normalized = strtolower(trim((string) $value));
|
|
|
+
|
|
|
+ if (in_array($normalized, ['1', 'enabled', 'enable', 'yes', 'true'], true)) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @param array<int, int> $entityIds
|
|
|
* @return array<int, array<string, mixed>>
|
|
|
@@ -403,7 +423,9 @@ class Magento1ProductReader
|
|
|
foreach ($attributes as $code => $info) {
|
|
|
$input = (string) ($info->frontend_input ?? '');
|
|
|
|
|
|
- if (! in_array($input, ['select', 'multiselect'], true)) {
|
|
|
+ // Magento status is a select (1=Enabled, 2=Disabled). Keep the numeric
|
|
|
+ // value so mapMagentoStatus can map it; converting to "Enabled" makes (int) 0.
|
|
|
+ if ($code === 'status' || ! in_array($input, ['select', 'multiselect'], true)) {
|
|
|
continue;
|
|
|
}
|
|
|
|