diff --git a/routes/web.php b/routes/web.php
index 6f409dab..9a76df48 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -6068,6 +6068,9 @@ Route::get('/aggiornapreorder/{idarticolo}/{postid}', function ($idarticolo, $po
// Aggiorna Preorder
$product = Product::where('sku', $idarticolo)->first();
+ // get the article by product
+ $article = Article::where('IdArticolo', $idarticolo)->first();
+
showarray($product);
$product_id = $product['id'];
@@ -6076,28 +6079,19 @@ Route::get('/aggiornapreorder/{idarticolo}/{postid}', function ($idarticolo, $po
if ($product) {
echo "Prodotto trovato: " . $product['name'] . "
";
- $attributes = $product['meta_data'];
+ $preordine = true;
- echo "Attributi:";
- showarray($attributes);
+ $data = [
+ '_wpro_variable_is_preorder' => $preordine,
+ 'stock_quantity' => 1000,
+ ];
- echo "Variazioni: " . $product_id;
+ $updated = Product::update($product_id, $data);
- $variations = Variation::all($sku);
- showarray($variations);
-
- $trovatosku = false;
- foreach ($variations as $variation) {
-
- showarray($variation);
-
- if ($variation->sku == $product_id) {
- $trovatosku = true;
- echo "SKU" . $variation->sku;
- }
+ if ($updated ) {
+ echo "Prodotto Aggiornato correttamente";
}
-
- showarray($variations);
+
} else {
echo "Il prodotto non esiste";
}
@@ -6207,7 +6201,18 @@ Route::get('/qtanegativa', function () {
echo '[' . $ind . ']' . $sep . $mydatestr . $sep . $article->Id . $sep . $article->IdArticolo . $sep . $article->Titolo . $sep . $article->DescrizioneStatoProdotto . $sep . $article->DescrizioneFormato . '[Quantita = ' . $article->QtaDisponibile . ']
';
$prodotto = Product::where('sku', $sku)->first();
if ($prodotto) {
-
+
+ if (isset($prodotto['_wpro_variable_is_preorder'])) {
+ echo '
PREORDINE: ' . $prodotto['_wpro_variable_is_preorder'] . '';
+ }
+ if (isset($prodotto['_wpro_label_variable'])) {
+ echo 'Etichetta: ' . $prodotto['_wpro_label_variable'];
+ }
+ if (isset($prodotto['_wpro_date_variable'])) {
+ echo 'Data Preordine: ' . $prodotto['_wpro_date_variable'];
+ }
+ echo '
';
+
showarray($prodotto);
}