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": {
"type": "-",
"size": 3670,
"size": 3669,
"lmtime": 0,
"modified": true
},
@@ -1139,6 +1139,12 @@
"lmtime": 0,
"modified": false
},
".htaccess.2025-06-06-1749205575": {
"type": "-",
"size": 3670,
"lmtime": 0,
"modified": false
},
"image_log.json": {
"type": "-",
"size": 128703,
@@ -1632,8 +1638,8 @@
},
"import-product.php": {
"type": "-",
"size": 27503,
"lmtime": 1748716588148,
"size": 32213,
"lmtime": 1749162688552,
"modified": false
},
"index.php": {
@@ -1680,7 +1686,38 @@
"modified": false
},
"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": {
"type": "-",
"size": 88,
@@ -4463,20 +4500,20 @@
},
"custom.css": {
"type": "-",
"size": 79135,
"lmtime": 1741560447830,
"size": 81771,
"lmtime": 1749162986138,
"modified": false
},
"custom.css.map": {
"type": "-",
"size": 116086,
"lmtime": 1741560447830,
"size": 22919,
"lmtime": 1749162986139,
"modified": false
},
"custom.scss": {
"type": "-",
"size": 85778,
"lmtime": 1741560447396,
"size": 71347,
"lmtime": 1749162986151,
"modified": false
},
"dce0916af972e3040aa191f74b17dd46.woff2": {
@@ -4523,7 +4560,7 @@
},
"theme.css": {
"type": "-",
"size": 192477,
"size": 192472,
"lmtime": 1737287962009,
"modified": true
},

View File

@@ -55,7 +55,7 @@ foreach ( $products_array as $product )
$price = 0; // jeśli są kombinacje, to cena jest 0
$reference = $product['ean'];
$active = 0; // Ustawienie produktu jako nieaktywny
$active = 1; // Ustawienie produktu jako nieaktywny
// table `materac_product`
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'];
$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 '----------------------------------------<br>';
}
exit;