tt
This commit is contained in:
@@ -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";
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user