This commit is contained in:
paoloar77
2024-05-19 13:11:57 +02:00
parent 23c08749a0
commit e83b7d213e
2 changed files with 10 additions and 3 deletions

View File

@@ -27,6 +27,15 @@ function getValueByKey($array, $key)
// Funzione per aggiornare il valore di un certo key in un array di oggetti
function updateValueByKey(&$array, $key, $newValue) {
foreach ($array as &$item) {
if ($item->key === $key) {
$item->value = $newValue;
break; // Se trova il key, termina il loop
}
}
}
function updateValueByKeyArr(&$array, $key, $newValue) {
foreach ($array as &$item) {
if ($item['key'] === $key) {
$item['value'] = $newValue;

View File

@@ -6079,7 +6079,7 @@ Route::get('/aggiornapreorder/{idarticolo}/{postid}', function ($idarticolo, $po
if ($product) {
$titolo = $product['name'];
echo "Prodotto trovato: " . $product['name'] . "StockQty = " . $product['stock_quantity'];
echo "Prodotto trovato: " . $product['name'] . "StockQty = " . $product['stock_quantity'] . "<br>";
if (isKeyPresent($product['meta_data'], '_is_pre_order')) {
@@ -6088,8 +6088,6 @@ Route::get('/aggiornapreorder/{idarticolo}/{postid}', function ($idarticolo, $po
if ($preorder) {
echo "<span class='badge badge-success'>PREORDER</span>: " . $preorder;
} else {
echo "<span class='badge badge-danger'>NO PREORDER</span>: " . $preorder;
}
echo "<br>";