aa
This commit is contained in:
@@ -876,58 +876,62 @@ function showprice($prezzo)
|
|||||||
function getRigaArticoloByArt($article, $ind, $sep)
|
function getRigaArticoloByArt($article, $ind, $sep)
|
||||||
{
|
{
|
||||||
|
|
||||||
$str = "";
|
try {
|
||||||
|
$str = "";
|
||||||
|
|
||||||
$mydatestr = $article->DataPubblicazione;
|
$mydatestr = $article->DataPubblicazione;
|
||||||
|
|
||||||
$sku = $article->IdArticolo;
|
$sku = $article->IdArticolo;
|
||||||
|
|
||||||
$prodotto = Product::where('sku', $sku)->first();
|
$prodotto = Product::where('sku', $sku)->first();
|
||||||
|
|
||||||
$qtyinstock = intval($prodotto['stock_quantity']);
|
$qtyinstock = intval($prodotto['stock_quantity']);
|
||||||
$prezzo = $prodotto['sale_price'];
|
$prezzo = $prodotto['sale_price'];
|
||||||
if (!$prezzo) {
|
if (!$prezzo) {
|
||||||
$prezzo = $prodotto['price'];
|
$prezzo = $prodotto['price'];
|
||||||
}
|
|
||||||
|
|
||||||
if ($qtyinstock <= 0) {
|
|
||||||
$colore = 'red';
|
|
||||||
} else {
|
|
||||||
$colore = 'green';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// echo '[' . $ind . ']' . $sep . $mydatestr . $sep . $article->IdArticolo . $sep . $article->Titolo . $sep . $article->DescrizioneStatoProdotto . $sep . $article->DescrizioneFormato . ' [Quantita = ' . $article->QtaDisponibile . ']';
|
|
||||||
$myview = '[' . $ind . ']' . $sep .
|
|
||||||
'<a href="' . $article->permalink . '?id=' . $article->IdArticolo . '" target="_blank">' . $article->IdArticolo . '</a>' . $sep .
|
|
||||||
'<a href="' . $prodotto['permalink'] . '" target="_blank"><span style="color:' . $colore . '; font-weight: bold;"> ' . $article->Titolo . '</span></a>' . $sep .
|
|
||||||
' Pubb:' . formatDateToItalian($article->DataPubblicazione) . $sep .
|
|
||||||
$article->DescrizioneStatoProdotto . ' (' . $article->DescrizioneFormato . ')' . $sep .
|
|
||||||
'[Qta = <span style="">' . $article->QtaDisponibile . '</span>]' . $sep .
|
|
||||||
' [' . showprice($prezzo) . ' ]' . $sep .
|
|
||||||
'[In Stock = <span style="color:' . $colore . '; font-weight: bold;">' . $qtyinstock . '</span>]' . $sep;
|
|
||||||
|
|
||||||
if ($qtyinstock < QTA_MINIMA_PER_PREVENDITA) {
|
|
||||||
$myview .= '<a href="' . $article->permalink . '/apimacro/public/aggiornapreorder/' . $article->IdArticolo . '/1/" target="_blank">Imposta in PRE-ORDINE!</a>' . $sep;
|
|
||||||
} else {
|
|
||||||
$myview .= '<a href="' . $article->permalink . '/apimacro/public/aggiornapreorder/' . $article->IdArticolo . '/-1/" target="_blank">Impostalo Non Disponibile</a>' . $sep;
|
|
||||||
}
|
|
||||||
$myview .= '<a href="' . $article->permalink . '/apimacro/public/aggiornadatapubblicazione/' . $article->IdArticolo . '/" target="_blank">Aggiorna Data Pubb</a>' . $sep;
|
|
||||||
|
|
||||||
$str .= $myview;
|
|
||||||
|
|
||||||
if ($prodotto) {
|
|
||||||
|
|
||||||
if (isset($prodotto['_wpro_variable_is_preorder'])) {
|
|
||||||
$str .= '<br><span style="color:red">PREORDINE: ' . $prodotto['_wpro_variable_is_preorder'] . '</span>';
|
|
||||||
}
|
}
|
||||||
if (isset($prodotto['_wpro_label_variable'])) {
|
|
||||||
$str .= 'Etichetta: ' . $prodotto['_wpro_label_variable'];
|
if ($qtyinstock <= 0) {
|
||||||
|
$colore = 'red';
|
||||||
|
} else {
|
||||||
|
$colore = 'green';
|
||||||
}
|
}
|
||||||
if (isset($prodotto['_wpro_date_variable'])) {
|
|
||||||
$str .= 'Data Preordine: ' . $prodotto['_wpro_date_variable'];
|
|
||||||
|
// echo '[' . $ind . ']' . $sep . $mydatestr . $sep . $article->IdArticolo . $sep . $article->Titolo . $sep . $article->DescrizioneStatoProdotto . $sep . $article->DescrizioneFormato . ' [Quantita = ' . $article->QtaDisponibile . ']';
|
||||||
|
$myview = '[' . $ind . ']' . $sep .
|
||||||
|
'<a href="' . $article->permalink . '?id=' . $article->IdArticolo . '" target="_blank">' . $article->IdArticolo . '</a>' . $sep .
|
||||||
|
'<a href="' . $prodotto['permalink'] . '" target="_blank"><span style="color:' . $colore . '; font-weight: bold;"> ' . $article->Titolo . '</span></a>' . $sep .
|
||||||
|
' Pubb:' . formatDateToItalian($article->DataPubblicazione) . $sep .
|
||||||
|
$article->DescrizioneStatoProdotto . ' (' . $article->DescrizioneFormato . ')' . $sep .
|
||||||
|
'[Qta = <span style="">' . $article->QtaDisponibile . '</span>]' . $sep .
|
||||||
|
' [' . showprice($prezzo) . ' ]' . $sep .
|
||||||
|
'[In Stock = <span style="color:' . $colore . '; font-weight: bold;">' . $qtyinstock . '</span>]' . $sep;
|
||||||
|
|
||||||
|
if ($qtyinstock < QTA_MINIMA_PER_PREVENDITA) {
|
||||||
|
$myview .= '<a href="' . $article->permalink . '/apimacro/public/aggiornapreorder/' . $article->IdArticolo . '/1/" target="_blank">Imposta in PRE-ORDINE!</a>' . $sep;
|
||||||
|
} else {
|
||||||
|
$myview .= '<a href="' . $article->permalink . '/apimacro/public/aggiornapreorder/' . $article->IdArticolo . '/-1/" target="_blank">Impostalo Non Disponibile</a>' . $sep;
|
||||||
}
|
}
|
||||||
$str .= '<br>';
|
$myview .= '<a href="' . $article->permalink . '/apimacro/public/aggiornadatapubblicazione/' . $article->IdArticolo . '/" target="_blank">Aggiorna Data Pubb</a>' . $sep;
|
||||||
|
|
||||||
|
$str .= $myview;
|
||||||
|
|
||||||
|
if ($prodotto) {
|
||||||
|
|
||||||
|
if (isset($prodotto['_wpro_variable_is_preorder'])) {
|
||||||
|
$str .= '<br><span style="color:red">PREORDINE: ' . $prodotto['_wpro_variable_is_preorder'] . '</span>';
|
||||||
|
}
|
||||||
|
if (isset($prodotto['_wpro_label_variable'])) {
|
||||||
|
$str .= 'Etichetta: ' . $prodotto['_wpro_label_variable'];
|
||||||
|
}
|
||||||
|
if (isset($prodotto['_wpro_date_variable'])) {
|
||||||
|
$str .= 'Data Preordine: ' . $prodotto['_wpro_date_variable'];
|
||||||
|
}
|
||||||
|
$str .= '<br>';
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return "Errore getRigaArticoloByArt: " . $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $str;
|
return $str;
|
||||||
@@ -2046,10 +2050,14 @@ function getArticoliCartolibro()
|
|||||||
->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) {
|
->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');
|
$join->on('T_WEB_Articoli.IdTipoFormato', '=', 'n.IdTipoFormato');
|
||||||
})
|
})
|
||||||
|
->where('DescrizioneStatoProdotto', 'In commercio')
|
||||||
->where('DescrizioneTipologia', 'Cartolibro')
|
->where('DescrizioneTipologia', 'Cartolibro')
|
||||||
->orderBy('dataOra', 'desc')
|
->orderBy('Titolo')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
|
||||||
|
echo "Trovati " . $articles->count() . "articoli <br>";
|
||||||
|
|
||||||
return $articles;
|
return $articles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user