This commit is contained in:
paoloar77
2024-05-17 19:13:00 +02:00
parent 18de78ce93
commit 7cb43e1a20

View File

@@ -6056,23 +6056,29 @@ Route::get('/provapao', [TestPaoController::class, 'provapao']);
Route::get('/aggiornapreorder/{idarticolo}/{postid}', function ($idarticolo, $postid) { Route::get('/aggiornapreorder/{idarticolo}/{postid}', function ($idarticolo, $postid) {
$product = Product::where('sku', $idarticolo)->first(); try {
// Aggiorna Preorder
$product = Product::where('sku', $idarticolo)->first();
if ($product) { if ($product) {
dd($product); dd($product);
$metadata = WpPostMeta::where('post_id', postid)->get(); $metadata = WpPostMeta::where('post_id', $postid)->get();
if ($metadata) { if ($metadata) {
dd($metadata); dd($metadata);
}
$aggiorna = false;
if ($aggiorna) {
Product::update($product->id, $data);
}
} else {
echo "Il prodotto non esiste";
} }
} catch (Exception $e) {
$aggiorna = false; echo "Errore: " . $e->getMessage();
if ($aggiorna) {
Product::update($product->id, $data);
}
} else {
echo "Il prodotto non esiste";
} }
}); });