aa
This commit is contained in:
@@ -1144,20 +1144,24 @@ class ArticleFormatter
|
|||||||
|
|
||||||
private static function findInsideProduct($product, $field)
|
private static function findInsideProduct($product, $field)
|
||||||
{
|
{
|
||||||
// Se il campo specificato non è presente, restituisce null
|
try {
|
||||||
if (!isset($product['meta_data']) || !is_array($product['meta_data'])) {
|
// Se il campo specificato non è presente, restituisce null
|
||||||
return 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
|
// Cerca nella meta_data il valore corrispondente alla chiave specificata
|
||||||
return null;
|
foreach ($product->meta_data as $meta) {
|
||||||
|
if (isset($meta->key) && $meta->key === $field) {
|
||||||
|
return $meta->value; // Accedi come oggetto
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restituisce null se non trovato
|
||||||
|
return null;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo $e->getMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user