Aggiunto 'Rivista'

This commit is contained in:
paoloar77
2024-12-12 20:03:24 +01:00
parent f08c28b464
commit 4496847ab8
3 changed files with 147 additions and 98 deletions

View File

@@ -986,6 +986,29 @@ function showCartolibri()
}
}
function showRiviste()
{
$articles = getArticoliRiviste();
$sep = ' | ';
echo "PROVA:";
$ind = 1;
foreach ($articles as $article) {
if (true) {
// updateArticoloFromGM($article->IdArticolo);
}
$riga = getRigaArticoloByArt($article, $ind, $sep);
echo $riga;
$ind++;
}
}
function libriInPrevendita()
{
try {
@@ -1057,6 +1080,7 @@ function setProductFromGM($article, $initlog, ProductLogger &$passproductLogger)
case 'Libri':
case 'Cartolibro':
case 'Rivista':
$prodotti = $prodotti->where('name', $titolo)->get();
$id = 0;
@@ -2090,6 +2114,32 @@ function getArticoliCartolibro()
return $articles;
}
function getArticoliRiviste()
{
$articles = Article::join(DB::raw('(SELECT IdArticolo, MAX(DataOra) AS data FROM T_WEB_Articoli GROUP BY IdArticolo) b'), function ($join) {
$join->on('T_WEB_Articoli.IdArticolo', '=', 'b.IdArticolo')
->on('T_WEB_Articoli.DataOra', '=', 'b.data');
})
->leftJoin(DB::raw('(SELECT e.IdStatoProdotto, e.Descrizione as DescrizioneStatoProdotto FROM T_WEB_StatiProdotto e JOIN (SELECT IdStatoProdotto, MAX(DataOra) as data1 from T_WEB_StatiProdotto GROUP BY IdStatoProdotto) c ON e.IdStatoProdotto = c.IdStatoProdotto AND e.DataOra = c.data1 ) f'), function ($join) {
$join->on('T_WEB_Articoli.IdStatoProdotto', '=', 'f.IdStatoProdotto');
})
->leftJoin(DB::raw('(SELECT g.IdTipologia, g.Descrizione as DescrizioneTipologia FROM T_WEB_Tipologie g JOIN (SELECT IdTipologia, MAX(DataOra) as data1 from T_WEB_Tipologie GROUP BY IdTipologia) h ON g.IdTipologia = h.IdTipologia AND g.DataOra = h.data1 ) i'), function ($join) {
$join->on('T_WEB_Articoli.IdTipologia', '=', 'i.IdTipologia');
})
->leftJoin(DB::raw('(SELECT l.IdTipoFormato, l.Descrizione as DescrizioneFormato FROM T_WEB_TipiFormato l JOIN (SELECT IdTipoFormato, MAX(DataOra) as data1 from T_WEB_TipiFormato GROUP BY IdTipoFormato) m ON l.IdTipoFormato = m.IdTipoFormato AND l.DataOra = m.data1 ) n'), function ($join) {
$join->on('T_WEB_Articoli.IdTipoFormato', '=', 'n.IdTipoFormato');
})
->where('DescrizioneStatoProdotto', 'In commercio')
->where('DescrizioneTipologia', 'Rivista')
->orderBy('Titolo')
->get();
echo "Trovati " . $articles->count() . " riviste <br>";
return $articles;
}
function updateArticoloFromGM($idarticolo)
{
$productLogger = new ProductLogger(null, '');

View File

@@ -58,6 +58,7 @@
<button type="button" data-action="showTest">Test</button>
<button type="button" data-action="inprevendita">Libri in Prevendita</button>
<button type="button" data-action="cartolibri">Cartolibri</button>
<button type="button" data-action="riviste">Riviste</button>
<button type="button" data-action="showOrdini">Mostra Ordini</button>
<button type="button" data-action="showOrdiniWeb">Mostra Ordini Web</button>
<button type="button" data-action="Vendite">Vendite</button>

View File

@@ -105,7 +105,7 @@ Route::get('/updatesku', function () {
'visible' => true,
'options' =>
$autori
$autori
]
@@ -351,13 +351,13 @@ Route::get('/wooproducts', function () {
$products = Product::all($options = ['per_page' => 100, 'page' => $page, 'orderby' => 'title', 'order' => 'asc']);
foreach ($products as $product) {
echo ++$key . " | " . $product->name . " | " . $product->id;
echo ++$key . " | " . $product->name . " | " . $product->id;
$variations = Variation::all($product->id);
foreach ($variations as $variation) {
$id = array_search('formato', array_column($variation->meta_data, 'key'));
if ($id >= 0)
echo ' | ' . $variation->meta_data[$id]->value . ' | ' . $variation->id . ' | ' . $variation->sku;
echo ' | ' . $variation->meta_data[$id]->value . ' | ' . $variation->id . ' | ' . $variation->sku;
}
echo "<br>";
}
@@ -552,7 +552,7 @@ Route::get('/artlibronuovo', function () {
'name' => $article->Titolo,
'type' => 'variable',
'short_description' => $article->Sottotitolo,
'short_description' => $article->Sottotitolo,
'categories' => [
['id' => $categoriaid]
@@ -586,7 +586,7 @@ Route::get('/artlibronuovo', function () {
'visible' => true,
'options' =>
$article->authors
$article->authors
],
@@ -624,31 +624,31 @@ Route::get('/artlibronuovo', function () {
'meta_data' => [
[
'key' => 'pagine',
'value' => $article->Pagine
'value' => $article->Pagine
],
[
'key' => 'edizione',
'value' => $article->Edizione
'value' => $article->Edizione
],
[
'key' => 'ristampa',
'value' => $article->Ristampa
'value' => $article->Ristampa
],
[
'key' => 'DataPubblicazione',
'value' => $article->DataPubblicazione
'value' => $article->DataPubblicazione
],
[
'key' => 'misure',
'value' => $article->Misure
'value' => $article->Misure
],
[
'key' => 'isbn',
'value' => $article->Ean13
'value' => $article->Ean13
],
[
'key' => 'formato',
'value' => $article->DescrizioneFormato
'value' => $article->DescrizioneFormato
],
]
@@ -1059,7 +1059,7 @@ Route::get('/artlibroebook', function () {
}
}
if ($id > 0) {
if ($id > 0) {
//$sku = Product::where('sku',$article->IdArticolo)->first();
echo "Trovato " . $titolo . "<br>";
$product = Product::find($id);
@@ -1077,7 +1077,7 @@ Route::get('/artlibroebook', function () {
}
}
$attributes[] = [
$attributes[] = [
//'id' => 1,
'id' => 6,
'position' => 0,
@@ -1176,7 +1176,7 @@ Route::get('/artlibroebook', function () {
'name' => $titolo,
'type' => 'variable',
'short_description' => $article->Sottotitolo,
'short_description' => $article->Sottotitolo,
'categories' => [
['id' => $categoriaid]
@@ -1205,7 +1205,7 @@ Route::get('/artlibroebook', function () {
'visible' => true,
'options' =>
$article->authors
$article->authors
],
@@ -1243,31 +1243,31 @@ Route::get('/artlibroebook', function () {
'meta_data' => [
[
'key' => 'pagine',
'value' => $article->Pagine
'value' => $article->Pagine
],
[
'key' => 'edizione',
'value' => $article->Edizione
'value' => $article->Edizione
],
[
'key' => 'ristampa',
'value' => $article->Ristampa
'value' => $article->Ristampa
],
[
'key' => 'DataPubblicazione',
'value' => $article->DataPubblicazione
'value' => $article->DataPubblicazione
],
[
'key' => 'misure',
'value' => $article->Misure
'value' => $article->Misure
],
[
'key' => 'isbn',
'value' => $article->Ean13
'value' => $article->Ean13
],
[
'key' => 'formato',
'value' => $formato
'value' => $formato
],
]
@@ -1352,7 +1352,7 @@ Route::get('/changeversion', function () {
if ($product->id > 670) {
$old_attributes = $product->attributes;
$variations = Variation::all($product->id);
foreach ($variations as $variation) {
foreach ($variations as $variation) {
$old_variantion_attributes[$variation->id] = $variation->attributes[0]->option;
}
@@ -1371,7 +1371,7 @@ Route::get('/changeversion', function () {
'visible' => true,
'options' =>
$old_attributes[1]->options
$old_attributes[1]->options
],
@@ -1380,7 +1380,7 @@ Route::get('/changeversion', function () {
'visible' => true,
'options' =>
$old_attributes[2]->options
$old_attributes[2]->options
],
@@ -1389,7 +1389,7 @@ Route::get('/changeversion', function () {
'visible' => true,
'options' =>
$old_attributes[3]->options
$old_attributes[3]->options
]
@@ -1568,7 +1568,7 @@ Route::get('sistema', function () {
'meta_data' => [
[
'key' => 'casa_editrice',
'value' => $article->CasaEditrice
'value' => $article->CasaEditrice
]
]
];
@@ -1711,7 +1711,7 @@ Route::get('/test7/{name}', function ($name) {
ob_implicit_flush(true);
//dd($articles);
foreach ($articles as $article) {
echo $article->IdArticolo . " | " . $article->Titolo . " | " . $article->Ean13 . "|" . $article->DescrizioneStatoProdotto . " | " . $article->DescrizioneTipologia . " | " . $article->DescrizioneFormato . " | " . $article->QtaDisponibile . " | " . $article->data . "<br>";
echo $article->IdArticolo . " | " . $article->Titolo . " | " . $article->Ean13 . "|" . $article->DescrizioneStatoProdotto . " | " . $article->DescrizioneTipologia . " | " . $article->DescrizioneFormato . " | " . $article->QtaDisponibile . " | " . $article->data . "<br>";
}
});
Route::get('/test8/{tipologia}', function ($name) {
@@ -1742,7 +1742,7 @@ Route::get('/test8/{tipologia}', function ($name) {
ob_implicit_flush(true);
//dd($articles);
foreach ($articles as $article) {
echo $article->IdArticolo . " | " . $article->Titolo . " | " . $article->DescrizioneStatoProdotto . " | " . $article->DescrizioneTipologia . " | " . $article->DescrizioneFormato . " | " . $article->QtaDisponibile . " | " . $article->data . "<br>";
echo $article->IdArticolo . " | " . $article->Titolo . " | " . $article->DescrizioneStatoProdotto . " | " . $article->DescrizioneTipologia . " | " . $article->DescrizioneFormato . " | " . $article->QtaDisponibile . " | " . $article->data . "<br>";
}
});
Route::get('statoProdotto', function () {
@@ -1890,7 +1890,7 @@ Route::get('/sistema_campi', function () {
foreach ($variations as $variation) {
$metadata = [];
foreach ($metadatas_old as $key => $value) {
foreach ($metadatas_old as $key => $value) {
if ($value->key == 'pagine') {
$metadata[] = [
'key' => 'pagine',
@@ -2078,7 +2078,7 @@ Route::get('/artlibri', function () {
$prodotti = null;
$titolo = rtrim($titolo);
echo $key . ' | ' . $article->idArticolo . ' | ' . $article->Ean13 . ' | ' . $article->Pagine . ' | '. $article->Titolo . ' | ' . $titolo . "<br>";
echo $key . ' | ' . $article->idArticolo . ' | ' . $article->Ean13 . ' | ' . $article->Pagine . ' | ' . $article->Titolo . ' | ' . $titolo . "<br>";
}
});
@@ -2172,7 +2172,7 @@ Route::get('/testnimaia', function () {
echo "not found";
} else {
echo "found";
echo "found";
}
});
@@ -2245,7 +2245,8 @@ Route::post('/updatecreate', function (Request $request) {
$productLogger = new ProductLogger(null, 'neworders');
$productLogger->addLog('', 'updatecreate: check se ARRIVATO ORDINE ' . $request->payment_method . ' ' . $request->status);
if (($request->status == 'on-hold' && $request->payment_method == 'bacs') ||
if (
($request->status == 'on-hold' && $request->payment_method == 'bacs') ||
($request->status == 'processing' && $request->payment_method == 'wc_gateway_gestpay') ||
($request->status == 'processing' && $request->payment_method == 'paypal') ||
($request->status == 'processing' && $request->payment_method == 'test')
@@ -2286,7 +2287,7 @@ Route::post('/updatecreate', function (Request $request) {
}
$changedest = false;
if (($request->shipping['address_1'] != null && $request->shipping['address_1'] != '' && $request->shipping['address_1'] != $request->billing['address_1']) || ($request->shipping['first_name'] != null && $request->shipping['first_name'] != '' && $request->shipping['first_name'] != $request->billing['first_name'])) {
if (($request->shipping['address_1'] != null && $request->shipping['address_1'] != '' && $request->shipping['address_1'] != $request->billing['address_1']) || ($request->shipping['first_name'] != null && $request->shipping['first_name'] != '' && $request->shipping['first_name'] != $request->billing['first_name'])) {
$changedest = true;
}
//$orderold =
@@ -2705,7 +2706,7 @@ Route::get('/artlibroondemand', function () {
if (!is_null($prodotti) && $prodotti->count() > 0) {
echo "Cerco titoli" . "<br>";
foreach ($prodotti as $prodotto) {
echo "WOO: " . $prodotto->name . "<br>";
echo "WOO: " . $prodotto->name . "<br>";
echo "Cerco : " . $titolo . "<br>";
if (strtolower($prodotto->name) === strtolower($titolo)) {
echo "Trovato titolo uguale" . "<br>";
@@ -2724,7 +2725,7 @@ Route::get('/artlibroondemand', function () {
}
}
if ($id > 0) {
if ($id > 0) {
//$sku = Product::where('sku',$article->IdArticolo)->first();
echo "Trovato " . $titolo . "<br>";
$product = Product::find($id);
@@ -2742,7 +2743,7 @@ Route::get('/artlibroondemand', function () {
}
}
$attributes[] = [
$attributes[] = [
//'id' => 1,
'id' => 6,
'position' => 0,
@@ -2847,7 +2848,7 @@ Route::get('/artlibroondemand', function () {
'name' => $titolo,
'type' => 'variable',
'short_description' => $article->Sottotitolo,
'short_description' => $article->Sottotitolo,
'categories' => [
['id' => $categoriaid]
@@ -2879,7 +2880,7 @@ Route::get('/artlibroondemand', function () {
'visible' => true,
'options' =>
$article->authors
$article->authors
],
@@ -2917,27 +2918,27 @@ Route::get('/artlibroondemand', function () {
'meta_data' => [
[
'key' => 'pagine',
'value' => $article->Pagine
'value' => $article->Pagine
],
[
'key' => 'edizione',
'value' => $article->Edizione
'value' => $article->Edizione
],
[
'key' => 'ristampa',
'value' => $article->Ristampa
'value' => $article->Ristampa
],
[
'key' => 'DataPubblicazione',
'value' => $article->DataPubblicazione
'value' => $article->DataPubblicazione
],
[
'key' => 'misure',
'value' => $article->Misure
'value' => $article->Misure
],
[
'key' => 'isbn',
'value' => $article->Ean13
'value' => $article->Ean13
],
[
'key' => 'formato',
@@ -3029,7 +3030,7 @@ Route::get('/changeversion', function () {
if ($product->id > 670) {
$old_attributes = $product->attributes;
$variations = Variation::all($product->id);
foreach ($variations as $variation) {
foreach ($variations as $variation) {
$old_variantion_attributes[$variation->id] = $variation->attributes[0]->option;
}
@@ -3048,7 +3049,7 @@ Route::get('/changeversion', function () {
'visible' => true,
'options' =>
$old_attributes[1]->options
$old_attributes[1]->options
],
@@ -3057,7 +3058,7 @@ Route::get('/changeversion', function () {
'visible' => true,
'options' =>
$old_attributes[2]->options
$old_attributes[2]->options
],
@@ -3066,7 +3067,7 @@ Route::get('/changeversion', function () {
'visible' => true,
'options' =>
$old_attributes[3]->options
$old_attributes[3]->options
]
@@ -3180,7 +3181,7 @@ Route::get('/artlibrodvd', function () {
}
*/
$titolo = $article->Titolo;
$titolo = $article->Titolo;
$titolo = rtrim($titolo);
$titolo = rtrim(str_ireplace('DVD', '', $titolo));
@@ -3211,7 +3212,7 @@ Route::get('/artlibrodvd', function () {
}
}
if ($id > 0) {
if ($id > 0) {
//$sku = Product::where('sku',$article->IdArticolo)->first();
echo "Trovato " . $titolo . "<br>";
$product = Product::find($id);
@@ -3229,7 +3230,7 @@ Route::get('/artlibrodvd', function () {
}
}
$attributes[] = [
$attributes[] = [
//'id' => 1,
'id' => 6,
'position' => 0,
@@ -3334,7 +3335,7 @@ Route::get('/artlibrodvd', function () {
'name' => $titolo,
'type' => 'variable',
'short_description' => $article->Sottotitolo,
'short_description' => $article->Sottotitolo,
'categories' => [
['id' => $categoriaid]
@@ -3366,7 +3367,7 @@ Route::get('/artlibrodvd', function () {
'visible' => true,
'options' =>
$article->authors
$article->authors
],
@@ -3404,27 +3405,27 @@ Route::get('/artlibrodvd', function () {
'meta_data' => [
[
'key' => 'pagine',
'value' => $article->Pagine
'value' => $article->Pagine
],
[
'key' => 'edizione',
'value' => $article->Edizione
'value' => $article->Edizione
],
[
'key' => 'ristampa',
'value' => $article->Ristampa
'value' => $article->Ristampa
],
[
'key' => 'DataPubblicazione',
'value' => $article->DataPubblicazione
'value' => $article->DataPubblicazione
],
[
'key' => 'misure',
'value' => $article->Misure
'value' => $article->Misure
],
[
'key' => 'isbn',
'value' => $article->Ean13
'value' => $article->Ean13
],
[
'key' => 'formato',
@@ -3516,7 +3517,7 @@ Route::get('/changeversion', function () {
if ($product->id > 670) {
$old_attributes = $product->attributes;
$variations = Variation::all($product->id);
foreach ($variations as $variation) {
foreach ($variations as $variation) {
$old_variantion_attributes[$variation->id] = $variation->attributes[0]->option;
}
@@ -3535,7 +3536,7 @@ Route::get('/changeversion', function () {
'visible' => true,
'options' =>
$old_attributes[1]->options
$old_attributes[1]->options
],
@@ -3544,7 +3545,7 @@ Route::get('/changeversion', function () {
'visible' => true,
'options' =>
$old_attributes[2]->options
$old_attributes[2]->options
],
@@ -3553,7 +3554,7 @@ Route::get('/changeversion', function () {
'visible' => true,
'options' =>
$old_attributes[3]->options
$old_attributes[3]->options
]
@@ -3690,7 +3691,7 @@ Route::get('/artondemand', function () {
}
}
if ($id > 0) {
if ($id > 0) {
//$sku = Product::where('sku',$article->IdArticolo)->first();
echo "Trovato " . $titolo . "<br>";
} else {
@@ -3726,7 +3727,7 @@ Route::get('/changeversion', function () {
if ($product->id > 670) {
$old_attributes = $product->attributes;
$variations = Variation::all($product->id);
foreach ($variations as $variation) {
foreach ($variations as $variation) {
$old_variantion_attributes[$variation->id] = $variation->attributes[0]->option;
}
@@ -3745,7 +3746,7 @@ Route::get('/changeversion', function () {
'visible' => true,
'options' =>
$old_attributes[1]->options
$old_attributes[1]->options
],
@@ -3754,7 +3755,7 @@ Route::get('/changeversion', function () {
'visible' => true,
'options' =>
$old_attributes[2]->options
$old_attributes[2]->options
],
@@ -3763,7 +3764,7 @@ Route::get('/changeversion', function () {
'visible' => true,
'options' =>
$old_attributes[3]->options
$old_attributes[3]->options
]
@@ -3810,7 +3811,7 @@ Route::get('/appoggio', function () {
$products = Product::all($options = ['per_page' => 100, 'page' => $page, 'orderby' => 'title', 'order' => 'asc']);
foreach ($products as $product) {
echo ++$key . " | " . $product->name . " | " . $product->id;
echo ++$key . " | " . $product->name . " | " . $product->id;
$variations = Variation::all($product->id);
foreach ($variations as $variation) {
if (!Gm_product::where('id_gm', $variation->sku)->exists()) {
@@ -5081,21 +5082,16 @@ Route::get('/prossimauscita', function () {
$productsku = Product::where('sku', $article->IdArticolo)->first();
//if(Gm_product::where('id_gm',$article->IdArticolo)->doesntExist())
if ($productsku->count() == 0) {
$titolo = null;
$formato = null;
$prodotti = null;
$prodotti = new ModelsProduct();
$titolo = $article->Titolo;
$titolo = $article->Titolo;
switch ($article->DescrizioneTipologia) {
case 'Libri':
case 'Cartolibro':
case 'Rivista':
$prodotti = $prodotti->where('name', $titolo)->get();
$id = 0;
@@ -5107,7 +5103,7 @@ Route::get('/prossimauscita', function () {
if (array_diff($prodotto->attributes[$found_key]->options, $article->authors) === array_diff($article->authors, $prodotto->attributes[$found_key]->options)) {
$id = $prodotto->id;
$variations = Variation::all($prodotto->id);
foreach ($variations as $variation) {
foreach ($variations as $variation) {
$found_key_version = array_search('Versione', array_column($variation->attributes, 'name'));
if ($variation->attributes[$found_key_version]->option == 'Nuovo') {
$id = 0;
@@ -5159,11 +5155,11 @@ Route::get('/prossimauscita', function () {
],
[
'key' => 'ristampa',
'value' => $article->Ristampa
'value' => $article->Ristampa
],
[
'key' => 'DataPubblicazione',
'value' => $article->DataPubblicazione
'value' => $article->DataPubblicazione
],
]
@@ -5181,7 +5177,7 @@ Route::get('/prossimauscita', function () {
'name' => $article->Titolo,
'type' => 'variable',
'short_description' => $article->Sottotitolo,
'short_description' => $article->Sottotitolo,
'categories' => [
['id' => $categoriaid]
@@ -5221,7 +5217,7 @@ Route::get('/prossimauscita', function () {
'visible' => true,
'options' =>
$article->authors
$article->authors
],
@@ -5287,7 +5283,7 @@ Route::get('/prossimauscita', function () {
}
}
$attributes[] = [
$attributes[] = [
//'id' => 1,
'id' => 6,
'position' => 0,
@@ -5361,7 +5357,7 @@ Route::get('/prossimauscita', function () {
if (array_diff($prodotto->attributes[$found_key]->options, $article->authors) === array_diff($article->authors, $prodotto->attributes[$found_key]->options)) {
$id = $prodotto->id;
$variations = Variation::all($prodotto->id);
foreach ($variations as $variation) {
foreach ($variations as $variation) {
$found_key_version = array_search('Versione', array_column($variation->attributes, 'name'));
if ($variation->attributes[$found_key_version]->option == $formato) {
$id = 0;
@@ -5428,7 +5424,7 @@ Route::get('/prossimauscita', function () {
'name' => $titolo,
'type' => 'variable',
'short_description' => $article->Sottotitolo,
'short_description' => $article->Sottotitolo,
'categories' => [
['id' => $categoriaid]
@@ -5461,7 +5457,7 @@ Route::get('/prossimauscita', function () {
'visible' => true,
'options' =>
$article->authors
$article->authors
],
@@ -5525,7 +5521,7 @@ Route::get('/prossimauscita', function () {
}
}
$attributes[] = [
$attributes[] = [
//'id' => 1,
'id' => 6,
'position' => 0,
@@ -5577,7 +5573,7 @@ Route::get('/prossimauscita', function () {
if (array_diff($prodotto->attributes[$found_key]->options, $article->authors) === array_diff($article->authors, $prodotto->attributes[$found_key]->options)) {
$id = $prodotto->id;
$variations = Variation::all($prodotto->id);
foreach ($variations as $variation) {
foreach ($variations as $variation) {
$found_key_version = array_search('Versione', array_column($variation->attributes, 'name'));
if ($variation->attributes[$found_key_version]->option == 'DVD') {
$id = 0;
@@ -5642,7 +5638,7 @@ Route::get('/prossimauscita', function () {
'name' => $article->Titolo,
'type' => 'variable',
'short_description' => $article->Sottotitolo,
'short_description' => $article->Sottotitolo,
'categories' => [
['id' => $categoriaid]
@@ -5680,7 +5676,7 @@ Route::get('/prossimauscita', function () {
'visible' => true,
'options' =>
$article->authors
$article->authors
],
@@ -5745,7 +5741,7 @@ Route::get('/prossimauscita', function () {
}
}
$attributes[] = [
$attributes[] = [
//'id' => 1,
'id' => 6,
'position' => 0,
@@ -5818,7 +5814,7 @@ Route::get('/prossimauscita', function () {
if (array_diff($prodotto->attributes[$found_key]->options, $article->authors) === array_diff($article->authors, $prodotto->attributes[$found_key]->options)) {
$id = $prodotto->id;
$variations = Variation::all($prodotto->id);
foreach ($variations as $variation) {
foreach ($variations as $variation) {
$found_key_version = array_search('Versione', array_column($variation->attributes, 'name'));
if ($variation->attributes[$found_key_version]->option == $formato) {
$id = 0;
@@ -5884,7 +5880,7 @@ Route::get('/prossimauscita', function () {
'name' => $titolo,
'type' => 'variable',
'short_description' => $article->Sottotitolo,
'short_description' => $article->Sottotitolo,
'categories' => [
['id' => $categoriaid]
@@ -5917,7 +5913,7 @@ Route::get('/prossimauscita', function () {
'visible' => true,
'options' =>
$article->authors
$article->authors
],
@@ -5981,7 +5977,7 @@ Route::get('/prossimauscita', function () {
}
}
$attributes[] = [
$attributes[] = [
//'id' => 1,
'id' => 6,
'position' => 0,
@@ -6061,7 +6057,7 @@ Route::get('/articolidadata', function () {
foreach ($articles as $article) {
echo $article->IdArticolo . " | " . $article->Titolo . " | " . $article->DescrizioneStatoProdotto . " | " . $article->DescrizioneTipologia . " | " . $article->DescrizioneFormato . " | " . $article->QtaDisponibile . " | " . $article->data . "<br>";
echo $article->IdArticolo . " | " . $article->Titolo . " | " . $article->DescrizioneStatoProdotto . " | " . $article->DescrizioneTipologia . " | " . $article->DescrizioneFormato . " | " . $article->QtaDisponibile . " | " . $article->data . "<br>";
}
});
@@ -6176,7 +6172,7 @@ Route::get('/test31', function () {
$settingora = Setting::where('key', 'update_products')->first();
//echo $ora_update->diffInDays($settingora->value);
$totime = new Carbon($settingora->value);
$totime = $totime->addDays(15);
$totime = $totime->addDays(15);
$totime = str_replace('-', '', $totime);
echo $totime;
});
@@ -6426,6 +6422,8 @@ Route::get('/handle-article-action-pao/{id}/{action}', function ($id, $action) {
return libriInPrevendita();
} elseif ($action == 'cartolibri') {
return showCartolibri();
} elseif ($action == 'riviste') {
return showRiviste();
} elseif ($action == 'showOrdini') {
return showOrdini();
} elseif ($action == 'showTest') {