diff --git a/routes/web.php b/routes/web.php
index fbef2f28..714900eb 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -6078,11 +6078,23 @@ Route::get('/aggiornapreorder/{idarticolo}/{postid}', function ($idarticolo, $po
$sku = $product['sku'];
if ($product) {
+ $titolo = $article['title'];
+
echo "Prodotto trovato: " . $product['name'] . "StockQty = " . $product['stock_quantity'] . "
";
- $variations = Variation::all($product_id);
- showarray($variations);
-
+ $prodotti = null;
+ $prodotti = new ModelsProduct();
+
+ $prodotti = $prodotti->where('name', $titolo)->get();
+ $id = 0;
+
+ if (!is_null($prodotti) && $prodotti->count() > 0) {
+ foreach ($prodotti as $prodotto) {
+ $variations = Variation::all($prodotto->id);
+ showarray($variations);
+ }
+ }
+
/*foreach ($variations as $variation) {
$found_key_version = array_search('Versione', array_column($variation->attributes, 'name'));
if ($variation->attributes[$found_key_version]->option == 'Nuovo') {
@@ -6095,7 +6107,7 @@ Route::get('/aggiornapreorder/{idarticolo}/{postid}', function ($idarticolo, $po
$data = [];
$data['_wpro_variable_is_preorder'] = 'true';
$data['stock_quantity'] = '1000';
-
+
$idprodotto = $product['parent_id'];
if ($idprodotto > 0) {
$variation = Variation::update($idprodotto, $product['id'], $data);
@@ -6106,7 +6118,6 @@ Route::get('/aggiornapreorder/{idarticolo}/{postid}', function ($idarticolo, $po
// $log2 .= $article->Titolo . ' - ' . $article->DescrizioneTipologia . ' - ' . $article->DescrizioneFormato . ' - Articolo aggiornato - ' . $variation['permalink'] . "\n";
$aggiornato = true;
}
-
} else {
echo "Il prodotto non esiste";
}
@@ -6227,7 +6238,6 @@ Route::get('/qtanegativa', function () {
echo 'Data Preordine: ' . $prodotto['_wpro_date_variable'];
}
echo '
';
-
}
$ind++;