preordini
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\ArticoliFatturati;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Carbon\Carbon;
|
||||
use Codexshaper\WooCommerce\Facades\Product;
|
||||
use Illuminate\Console\Command;
|
||||
@@ -19,6 +20,7 @@ use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
|
||||
use App\Orderdetail;
|
||||
use App\Services\ProductLogger;
|
||||
use App\Order as AppOrder;
|
||||
@@ -28,11 +30,7 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
use Illuminate\Support\Facades\Request;
|
||||
|
||||
|
||||
define('QTA_IN_PREVENDITA', 10000);
|
||||
define('QTA_MINIMA_PER_PREVENDITA', 9000);
|
||||
|
||||
define('CAMPO_PREORDINE', '_ywpo_preorder');
|
||||
use App\Helpers\MyConfig;
|
||||
|
||||
setlocale(LC_TIME, 'it_IT.UTF-8');
|
||||
|
||||
@@ -141,7 +139,7 @@ function setPreOrder($sku, $aggiornapreordine, $debug)
|
||||
}
|
||||
|
||||
//$campoPreOrder = '_wpro_variable_is_preorder';
|
||||
$campoPreOrder = CAMPO_PREORDINE;
|
||||
$campoPreOrder = MyConfig::$campoPreordine;
|
||||
|
||||
if ($product) {
|
||||
$titolo = $product['name'];
|
||||
@@ -211,7 +209,7 @@ function setPreOrder($sku, $aggiornapreordine, $debug)
|
||||
}
|
||||
}
|
||||
|
||||
$data['stock_quantity'] = QTA_IN_PREVENDITA;
|
||||
$data['stock_quantity'] = MyConfig::$qtaInPrevendita;
|
||||
|
||||
if ($debug) {
|
||||
echo "Data:";
|
||||
@@ -972,6 +970,7 @@ function findInsideProduct(array $prodotto, string $miocampo): ?string
|
||||
|
||||
class ArticleFormatter
|
||||
{
|
||||
|
||||
public static function getArticleRow($article, $index, $separator)
|
||||
{
|
||||
try {
|
||||
@@ -1026,7 +1025,7 @@ class ArticleFormatter
|
||||
}
|
||||
|
||||
return [
|
||||
'active' => self::findInsideProduct($product, self::CAMPO_PREORDINE) === 'yes',
|
||||
'active' => self::findInsideProduct($product, MyConfig::$campoPreordine) === 'yes',
|
||||
'date' => self::findInsideProduct($product, '_ywpo_for_sale_date')
|
||||
];
|
||||
}
|
||||
@@ -1107,7 +1106,7 @@ class ArticleFormatter
|
||||
{
|
||||
$baseUrl = $article->permalink . '/apimacro/public/aggiornapreorder/' . $article->IdArticolo;
|
||||
|
||||
if (!$preorderInfo['active'] || $stockInfo['quantity'] < self::QTA_MINIMA_PER_PREVENDITA) {
|
||||
if (!$preorderInfo['active'] || $stockInfo['quantity'] < MyConfig::$qtaMinima) {
|
||||
return sprintf(
|
||||
'<a href="%s/1/" target="_blank">Imposta in PRE-ORDINE!</a>%s',
|
||||
$baseUrl,
|
||||
@@ -1148,7 +1147,8 @@ class ArticleFormatter
|
||||
}
|
||||
}
|
||||
|
||||
function getRigaArticoloByArt($article, $index, $separator) {
|
||||
function getRigaArticoloByArt($article, $index, $separator)
|
||||
{
|
||||
return ArticleFormatter::getArticleRow($article, $index, $separator);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user