From d58bd30263e3f39ca50e8b51673ea3c5a0d34ef4 Mon Sep 17 00:00:00 2001 From: paoloar77 Date: Thu, 16 Jan 2025 09:25:31 +0100 Subject: [PATCH] aa --- app/CustomFuncPao.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/app/CustomFuncPao.php b/app/CustomFuncPao.php index a33da770..30c06cd6 100644 --- a/app/CustomFuncPao.php +++ b/app/CustomFuncPao.php @@ -977,8 +977,6 @@ class ArticleFormatter $stockInfo = self::getStockInfo($product); $preorderInfo = self::getPreorderInfo($product); - echo "PRODUCT "; - dd($product); echo "PREORDERINFO "; dd($preorderInfo); @@ -1145,10 +1143,22 @@ class ArticleFormatter } private static function findInsideProduct($product, $field) - { - // Implementation needed - this was referenced but not shown in original code - return $product[$field] ?? null; +{ + // Se il campo specificato non รจ presente, restituisce null + if (!isset($product['meta_data']) || !is_array($product['meta_data'])) { + return null; } + + // Cerca nella meta_data il valore corrispondente alla chiave specificata + foreach ($product['meta_data'] as $meta) { + if (isset($meta['key']) && $meta['key'] === $field) { + return $meta['value']; + } + } + + // Restituisce null se non trovato + return null; +} } function getRigaArticoloByArt($article, $index, $separator)