feat(import-product): Update product activation status and enhance logging during import

This commit is contained in:
2025-06-09 21:22:41 +02:00
parent a4be3e3b20
commit 458cafec11
2 changed files with 55 additions and 13 deletions

View File

@@ -1129,7 +1129,7 @@
}, },
".htaccess": { ".htaccess": {
"type": "-", "type": "-",
"size": 3670, "size": 3669,
"lmtime": 0, "lmtime": 0,
"modified": true "modified": true
}, },
@@ -1139,6 +1139,12 @@
"lmtime": 0, "lmtime": 0,
"modified": false "modified": false
}, },
".htaccess.2025-06-06-1749205575": {
"type": "-",
"size": 3670,
"lmtime": 0,
"modified": false
},
"image_log.json": { "image_log.json": {
"type": "-", "type": "-",
"size": 128703, "size": 128703,
@@ -1632,8 +1638,8 @@
}, },
"import-product.php": { "import-product.php": {
"type": "-", "type": "-",
"size": 27503, "size": 32213,
"lmtime": 1748716588148, "lmtime": 1749162688552,
"modified": false "modified": false
}, },
"index.php": { "index.php": {
@@ -1680,7 +1686,38 @@
"modified": false "modified": false
}, },
"localization": {}, "localization": {},
"mails": {}, "mails": {
"pl": {
"order_conf.html": {
"type": "-",
"size": 81169,
"lmtime": 1749162986133,
"modified": false
}
},
"themes": {
"modern": {
"core": {
"order_conf.html.twig": {
"type": "-",
"size": 36632,
"lmtime": 1749162986135,
"modified": false
}
},
"modules": {
"ps_emailalerts": {
"new_order.html.twig": {
"type": "-",
"size": 36276,
"lmtime": 1749162986136,
"modified": false
}
}
}
}
}
},
"Makefile": { "Makefile": {
"type": "-", "type": "-",
"size": 88, "size": 88,
@@ -4463,20 +4500,20 @@
}, },
"custom.css": { "custom.css": {
"type": "-", "type": "-",
"size": 79135, "size": 81771,
"lmtime": 1741560447830, "lmtime": 1749162986138,
"modified": false "modified": false
}, },
"custom.css.map": { "custom.css.map": {
"type": "-", "type": "-",
"size": 116086, "size": 22919,
"lmtime": 1741560447830, "lmtime": 1749162986139,
"modified": false "modified": false
}, },
"custom.scss": { "custom.scss": {
"type": "-", "type": "-",
"size": 85778, "size": 71347,
"lmtime": 1741560447396, "lmtime": 1749162986151,
"modified": false "modified": false
}, },
"dce0916af972e3040aa191f74b17dd46.woff2": { "dce0916af972e3040aa191f74b17dd46.woff2": {
@@ -4523,7 +4560,7 @@
}, },
"theme.css": { "theme.css": {
"type": "-", "type": "-",
"size": 192477, "size": 192472,
"lmtime": 1737287962009, "lmtime": 1737287962009,
"modified": true "modified": true
}, },

View File

@@ -55,7 +55,7 @@ foreach ( $products_array as $product )
$price = 0; // jeśli są kombinacje, to cena jest 0 $price = 0; // jeśli są kombinacje, to cena jest 0
$reference = $product['ean']; $reference = $product['ean'];
$active = 0; // Ustawienie produktu jako nieaktywny $active = 1; // Ustawienie produktu jako nieaktywny
// table `materac_product` // table `materac_product`
if ( $reference ) if ( $reference )
@@ -68,7 +68,11 @@ foreach ( $products_array as $product )
{ {
$sql_shop = 'UPDATE `' . _DB_PREFIX_ . 'product_shop` SET `price` = ' . (float)$price . ', `active` = ' . (int)$active . ' WHERE `id_product` = ' . (int)$id['id_product']; $sql_shop = 'UPDATE `' . _DB_PREFIX_ . 'product_shop` SET `price` = ' . (float)$price . ', `active` = ' . (int)$active . ' WHERE `id_product` = ' . (int)$id['id_product'];
$result_shop = Db::getInstance()->execute($sql_shop); $result_shop = Db::getInstance()->execute($sql_shop);
echo "Zaktualizowano produkt z referencją $reference, id_product: " . $id['id_product'] . ", cena: $price, active: $active<br>";
// get prduct name
$product_name = Db::getInstance()->getValue('SELECT name FROM `' . _DB_PREFIX_ . 'product_lang` WHERE `id_product` = ' . (int)$id['id_product'] . ' AND id_shop = 1 AND `id_lang` = 7');
echo '<br>Aktualizacja produktu: ' . $product_name . ' (ID: ' . $id['id_product'] . ')<br>';
echo "Zaktualizowano produkt z referencją $reference, id_product: " . $id['id_product'] . ", cena: $price, active: $active, nazwa: $product_name<br>";
} }
} }
@@ -85,6 +89,7 @@ foreach ( $products_array as $product )
echo "Zaktualizowano kombinację z referencją " . $combination['ean'] . ", id_product_attribute: " . $id_combination['id_product_attribute'] . ", cena: " . $combination['price'] . "<br>"; echo "Zaktualizowano kombinację z referencją " . $combination['ean'] . ", id_product_attribute: " . $id_combination['id_product_attribute'] . ", cena: " . $combination['price'] . "<br>";
} }
} }
echo '----------------------------------------<br>';
} }
exit; exit;